java axis2 调用webservice接口客户端
2017-09-26 00:00
429 查看
摘要: jar包版本axis2-1.7.6
代码可以直接运行。
jar包已经精简到最小了。不用引用那么多没用的jar包
引用最精简jar包列表:
jar包列表下载地址:
http://download.csdn.net/download/matt0614/9995548
代码可以直接运行。
jar包已经精简到最小了。不用引用那么多没用的jar包
package com.quickmap.common; import org.apache.axiom.om.OMAbstractFactory; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMNamespace; import org.apache.axis2.AxisFault; import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.client.Options; import org.apache.axis2.client.ServiceClient; /** * Created by matt0614@qq.com on 2017/6/6 0006. */ public class WebServicesClient { public static void main(String[] args) throws Exception { getRes3(); } public static void getRes3(){ try { String soapBindingAddress = "http://www.webxml.com.cn/WebServices/ChinaZipSearchWebService.asmx"; ServiceClient sender = new ServiceClient(); EndpointReference endpointReference = new EndpointReference( soapBindingAddress); Options options = new Options(); options.setAction("http://WebXml.com.cn/getSupportCity"); options.setTo(endpointReference); //options.setProperty(HTTPConstants.CHUNKED, "false"); sender.setOptions(options); OMFactory fac = OMAbstractFactory.getOMFactory(); // 这个和qname差不多,设置命名空间 OMNamespace omNs = fac.createOMNamespace("http://WebXml.com.cn/", "getSupportCity"); OMElement data = fac.createOMElement("getSupportCity", omNs); // 对应参数的节点 String[] strs = new String[] {"byProvinceName" }; // 参数值 String[] val = new String[] {"上海"}; for (int i = 0; i < strs.length; i++) { OMElement inner = fac.createOMElement(strs[i], omNs); inner.setText(val[i]); data.addChild(inner); } // 发送数据,返回结果 OMElement result = sender.sendReceive(data); System.out.println(result.toString()); } catch (AxisFault ex) { ex.printStackTrace(); } } }
引用最精简jar包列表:
jar包列表下载地址:
http://download.csdn.net/download/matt0614/9995548
相关文章推荐
- gsoap生成webservice调用客户端接口
- gsoap生成webservice调用客户端接口
- gsoap生成webservice调用客户端接口
- Java Axis2发布及调用webservice接口
- Java 调用C# webservice接口 生成java客户端 实现方式
- gsoap生成webservice调用客户端接口
- CXF客户端调用webservice接口报错
- Java.WebService - Webservice初体验之调用学院客户端开放接口
- 生成webservice接口以及通过客户端调用接口。
- 使用Axis2开发webservice服务端接口+axis开发的客户端调用
- Android客户端WebService访问接口(Ksoap2Android调用.net服务端)
- webService 客户端接口调用【java】
- 基于Spring注解的WebService接口,服务端编码与客户端调用
- gsoap生成webservice调用客户端接口
- webservice实际应用之调用外部系统提供的服务端地址,写java的webservice客户端程序并通过接口给外部系统传数据
- cxf客户端代码调用cxf的webservice接口,报错:XJC,classnotfound,引入了tool.jar,却还是报classnotfound
- 用jdk生成webservice客户端代码(调用免费接口)
- eclipse生成的webservice客户端调用webservice接口返回值慢的问题
- 提供了webservice的wsdl地址,如何生成消费端(客户端),怎么调用已经提供的wsdl接口
- webservice 生成客户端接口调用