webService客户端工具类
来源:互联网 发布:excel拆分数据公式 编辑:程序博客网 时间:2024/05/23 15:39
package com.dg11185.zhjy.commonUtils;import javax.xml.namespace.QName;import org.apache.axis2.AxisFault;import org.apache.axis2.addressing.EndpointReference;import org.apache.axis2.client.Options;import org.apache.axis2.rpc.client.RPCServiceClient;import org.apache.log4j.Logger;/******************************************************************************* * web Service 客户端工具类 * ******************************************************************************/public class WebServiceClient {private static final Logger log = Logger.getLogger(WebServiceClient.class);/** * WebService客户端请求 * * @param wsURL * @param nameSpace * @param mehtod * @param xml ***/public static String findWebSerivceResultAsString(String wsURL,String nameSpace, String method, String xml){log.info("-------------findWebSerivceResultAsString-->method:"+method+",URL:"+wsURL);log.info("-------------findWebSerivceResultAsString-->xml:"+xml);return findWebSerivceResultAsString(wsURL, nameSpace, method, new Object[]{xml});}/** * WebService客户端请求 * * @param wsURL * @param nameSpace * @param mehtod * @param args ***/public static String findWebSerivceResultAsString(String wsURL,String nameSpace, String method, Object[] args) {long startTime = System.currentTimeMillis();try {RPCServiceClient client = new RPCServiceClient();Options options = client.getOptions();// 设置调用WebService的URLEndpointReference epf = new EndpointReference(wsURL);//设置超时options.setTimeOutInMilliSeconds(Long.parseLong("1000*8"));options.setTo(epf);//查看wsdl的空间名targetNamespaceQName qname = new QName(nameSpace, method);Object[] result = client.invokeBlocking(qname, args,new Class[] { String.class });if (null != result && result.length > 0) {String rs = (String) result[0];log.info("---------------->result:"+rs);return rs;}} catch (AxisFault e) {e.printStackTrace();log.error("--------------Exception-->msg:"+e.getMessage());}finally{log.info("--------------useTimes:"+(System.currentTimeMillis()-startTime));}return null;}}
0 0
- webService客户端工具类
- webservice公共调用 客户端接口工具类 cfx axis2
- 用WSAD工具生成WebService客户端代码
- webservice生成Java客户端工具axis2.md
- Android 通过WebService进行网络编程,使用工具类轻松实现------客户端编程
- WebService 工具类
- WebService工具类
- 几种常用的REST webservice客户端测试工具
- 利用wsdl2java工具生成webservice的客户端代码
- 利用wsdl2java工具生成webservice的客户端代码,编码问题
- 利用原生态的jdk生成 WebService客户端调用工具
- 利用wsdl2java工具生成webservice的客户端代码
- 几种常用的REST webservice客户端测试工具
- WebService客户端
- webservice客户端
- MongoDB客户端工具类
- zookeeper客户端工具类
- WebService客户端代理类的生成
- 最近的学习计划
- hdu2049 不容易系列之(4)——考新郎(全错排,组合数)
- 浙大 pat Basic Level 1021
- ubuntu下安装Apache+PHP+Mysql
- ios键盘通知和自定义键盘
- webService客户端工具类
- 图论模版
- PB数据窗口中各项指标的获取方法
- 龚康太抠了
- OCP-1Z0-053-V12.02-683题
- Android实现js及webview交互之在html页面中调用系统摄像头
- 浙大 pat Basic Level 1022
- Hibernate实战_笔记6(第一个Hibernate项目)
- 20 款处理键盘事件的 JavaScript 库