博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
axis2生成webservice客户端代码及使用方法
阅读量:7136 次
发布时间:2019-06-28

本文共 1289 字,大约阅读时间需要 4 分钟。

hot3.png

1.下载axis2,并安装,具体安装方法自行百度;

2.dos环境进入bin文件夹

wsdl2java -uri https://XXXXX.com.cn/xyt/services/AppInfoPushService?wsdl -p com.client -s -o stubwsdl2java -uri https://XX.com.cn/xyt/services/AppInfoPushService?wsdl -p axis2.service.server -o stub

输入命令即可在bin路径下生成有代码

3.使用方法 

public static String excute(String requestXml) {		String responseXml = "";		try {			WebRequestServiceServiceStub stub = new WebRequestServiceServiceStub();			Options options = stub._getServiceClient().getOptions();			//等待接收数据的时间也是 默认60s 修改为90s			options.setTimeOutInMilliSeconds(60000*3);			stub._getServiceClient().setOptions(options);			DoRequestService doRequestService = new DoRequestService();			org.apache.axis2.databinding.types.soapencoding.String xmlinput = new org.apache.axis2.databinding.types.soapencoding.String();			xmlinput.setString(requestXml);			doRequestService.setXmlInput(xmlinput);			DoRequestServiceResponse doRequestServiceResponse = stub.doRequestService(doRequestService);			org.apache.axis2.databinding.types.soapencoding.String result = doRequestServiceResponse.getDoRequestServiceReturn();			responseXml = result.toString();			stub._getServiceClient().cleanup();		} catch (Exception e) {			logger.error("调用XXX出错", e);		}		return responseXml;	}

 

转载于:https://my.oschina.net/u/2277088/blog/995279

你可能感兴趣的文章
有关xerosploit运行报错问题的有效解决方案
查看>>
ABP官方文档翻译 1.4 启动配置
查看>>
js框架简明
查看>>
Java volatile 关键字
查看>>
http 头信息详解
查看>>
ATS项目更新(4) 更新DLL到远程服务器
查看>>
mac 多显示器焦点快速切换
查看>>
第六周学习进度报告
查看>>
nginx发布静态网页
查看>>
Hadoop 面试题之一
查看>>
有关方法重载的实例(例4-10)
查看>>
用数组模拟邻接表
查看>>
**Git中的AutoCRLF与SafeCRLF换行符问题
查看>>
Android布局文件layout.xml的一些属性值
查看>>
三种new
查看>>
多项式与三角函数求导——BUAA OO 第一单元作业总结
查看>>
VsCode 格式化插件配置
查看>>
JAVA 23种开发模式详解(代码举例)
查看>>
Windows上搭建Flume运行环境
查看>>
Linux系统排查4——网络篇
查看>>