用的不多,甚至很少。
客户度程序:
package cn.client;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import cn.itcast.ws.HelloService;
/**
* 通过客户端编程的方式调用Webservice服务
*
*/
public class client {
public static void main(String[] args) throws Exception {
URL wsdlUrl = new URL("http://192.168.1.100:6789/hello?wsdl");
Service s = Service.create(wsdlUrl, new QName("http://ws.itcast.cn/","HelloServiceService"));
HelloService hs = s.getPort(new QName("http://ws.itcast.cn/","HelloServicePort"), HelloService.class);
String ret = hs.sayHello("zhangsan");
System.out.println(ret);
}
}