WebService的URL的简单使用

利用小工具axis2自带命令生成WebServiceClient
1.确保已配置好环境变量,JAVA_HOME,AXIS2_HOME,Path加上%JAVA_HOME%\bin;%AXIS2_HOME%\bin;
2.解压axis2.rar,在axis2-1.4.1\bin目录下,编辑批处理文件
wsdl2java -uri XXXXXXXXXXXX -p client -s -o stub
pause
XXXXXXXXXXXX为提供的webservice地址,stub为生成的文件夹名字(可更改,生成后就在本目录下)
3.点击执行批处理文件就可以生成客户端文件啦,如果出现闪退或许试试重启电脑。

利用生成的java文件,调用如下:

ServiceAppStub stub = new ServiceAppStub();
Reception reception = new Reception();
reception.setParam(param);
ReceptionResponse response = stub.Reception(reception);
return String.valueOf(response.get_return());

猜你喜欢

转载自astring.iteye.com/blog/2204545