发布.net webservice得到wsdl地址:(你的)http://222.92.47.171:8003/SZDataExchange/SZDataExchange.asmx?wsdl
根据wsdl2java工具包生成对应java客户端
可以自己加批处理如下
set Axis_Lib=.\lib
set Java_Cmd=java -Djava.ext.dirs=%Axis_Lib%
set Output_Path=.\source
set Package= com.msclient
%Java_Cmd% org.apache.axis.wsdl.WSDL2Java -o%Output_Path% -p%Package% http://localhost:8987/Service1.asmx?WSDL
生成客户端java类如下(CallService是我写的调用测试类,可忽略)
有了客户端就可以像调用本地方法一样调用webservice服务方法了,具体代码如下:
public static void main(String[] args) throws ServiceException, RemoteException {
// TODO Auto-generated method stub
Service1 _Service1 = new Service1Locator();
Service1Soap_PortType _Service1Soap_PortType;
String resultStr = null;
_Service1Soap_PortType = _Service1.getService1Soap();
resultStr = _Service1Soap_PortType.helloWorld("zybaby");
System.out.println(resultStr);
}
用Axis组件,按照相应的WSDL文件生成框架之后填写功能即可。