1.使用JAVA自带的wsiport生成客户端
命令wsimport -s . xxxxxx.wsdl
2.生成客户端使用idea生成
右键需要生成的包,选择webservice-Generate Java Code From Wsdl……
添加本地或者远程wsdl地址,点击ok生成
3.调用JAX客户端
HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
httpClientPolicy.setConnectionTimeout(30000);
httpClientPolicy.setReceiveTimeout(120000);
HttpConduitConfig httpConduitConfig = new HttpConduitConfig();
httpConduitConfig.setClientPolicy(httpClientPolicy);
HttpConduitFeature httpConduitFeature = new HttpConduitFeature();
httpConduitFeature.setConduitConfig(httpConduitConfig);
//实例化实现类
XxxAdapterService xxxAdapterService = new XxxAdapterService (httpConduitFeature);
//获取接口方法
XxxAdapterServiceInterface xxxAdapterServiceInterface = xxxAdapterServiceInterface .getXxxAdapterServicePort();
4.使用eclipse生成axis带用户名密码的客户端
右键点击New-Other
选择Web Service Client
完成WebService客户端生成
4.使用eclipse生成axis带用户名密码的客户端
xxxServiceLocator locator = new xxxServiceLocator();
xxxAdapterServicePortBindingStub stub = (xxxAdapterServicePortBindingStub) locator.getXxxAdapterServicePortBindingQSPort();
stub.setUsername("用户名");
stub.setPassword("密码");
StringHolder _return = new StringHolder();
StringHolder returnStatus = new StringHolder();
StringHolder returnMsg = new StringHolder(); stub.xxxService(method,data,_return,returnStatus,returnMsg);