java jdk1.6内置支持的webservice使用示范
java jdk1.6内置支持的webservice使用示例???5.然后我们编写客户端的调用代码???import localhost.client.
java jdk1.6内置支持的webservice使用示例
?
??5.然后我们编写客户端的调用代码
?
??import localhost.client.MyWebService;
?7.我们看下最终生成客户端服务调用的类内容
?
?
?package localhost.client;import java.net.MalformedURLException;import java.net.URL;import javax.xml.namespace.QName;import javax.xml.ws.Service;import javax.xml.ws.WebEndpoint;import javax.xml.ws.WebServiceClient;/** * This class was generated by the JAXWS SI. * JAX-WS RI 2.0_02-b08-fcs * Generated source version: 2.0 * */@WebServiceClient(name = "MyWebService", targetNamespace = "http://localhost/client", wsdlLocation = "http://localhost:8080/MyWebService?wsdl")public class MyWebService extends Service{ private final static URL MYWEBSERVICE_WSDL_LOCATION; static { URL url = null; try { url = new URL("http://localhost:8080/MyWebService?wsdl"); } catch (MalformedURLException e) { e.printStackTrace(); } MYWEBSERVICE_WSDL_LOCATION = url; } public MyWebService(URL wsdlLocation, QName serviceName) { super(wsdlLocation, serviceName); } public MyWebService() { super(MYWEBSERVICE_WSDL_LOCATION, new QName("http://localhost/client", "MyWebService")); } /** * * @return * returns MyTestWS */ @WebEndpoint(name = "MyTestWSPort") public MyTestWS getMyTestWSPort() { return (MyTestWS)super.getPort(new QName("http://localhost/client", "MyTestWSPort"), MyTestWS.class); }}?