package com.wujianjun.axis2.client;
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;
import org.apache.axis2.transport.http.HTTPConstants;
import org.apache.axis2.transport.http.HttpTransportProperties;
public class TestClient {
public static void main(String[] args) {
try {
ServiceClient sc = new ServiceClient();
Options opts = sc.getOptions();
opts.setTo(new EndpointReference("http://10.10.0.68:8000/sap/bc/srt/rfc/sap/ztest/110/ztest/ztest"));
opts.setAction("urn:ZTEST");
HttpTransportProperties.Authenticator basicAuth = new HttpTransportProperties.Authenticator();
basicAuth.setUsername("liuhand");
basicAuth.setPassword("dev110");
// basicAuthentication.setHost("xx.xx.x.xx");
// basicAuthentication.setDomain("xx.xx.xx.xx");
opts.setProperty(HTTPConstants.AUTHENTICATE, basicAuth);
OMElement res = sc.sendReceive(createPayLoad());
System.out.println(res);
} catch (AxisFault e) {
e.printStackTrace();
}
}
public static OMElement createPayLoad() {
OMFactory fac = OMAbstractFactory.getOMFactory();
OMNamespace omNs = fac.createOMNamespace("urn:sap-com:document:sap:rfc:functions","m");
OMElement method = fac.createOMElement("ZTEST", omNs);
OMElement value = fac.createOMElement("IM_P", null);
value.setText("Hello");
method.addChild(value);
System.out.println(method);
return method;
}
}
PS:Endpoint只能用WSDL文件里面的SOAP address,不可用类似:http://gdsrmdev.gdtel.com:8000/sap/bc/srt/wsdl/bndg_4E2652F7D114020FE10080000A10064B/wsdl11/allinone/ws_policy/document?sap-client=100
转:http://wujianjun.iteye.com/blog/523727
分享到:
相关推荐
本案例实现使用Axis2生成.arr包发布WebService服务,并使用Axis2生成客户端代码方式调用WebService
使用Java+Axis2调用Web Services 网络接口,代码中列举4个例子可以查看,有详细注释提供参考。
Axis2调用SAP Webservice源码 使用Axis2 org.apache.axis2.eclipse.codegen.plugin_1.6.2.jar插件生成本地Java Proxy同事生成同步和异步调用测试用例 更重要的是配备详细文档,实乃Java与SAP集成是宝典!
<groupId>org.apache.axis2 <artifactId>axis2 <version>1.6.2 <groupId>org.apache.axis2 <artifactId>axis2-adb <version>1.6.2 <groupId>org.apache.axis2 ...
Java通过Axis2调用SAP的Webservice 生成Java Proxy
axis2例子 webservice axis2 示例axis2例子 webservice axis2 示例axis2例子 webservice axis2 示例axis2例子 webservice axis2 示例axis2例子 webservice axis2 示例
Android 利用axis2 调用webservice 包含j2ee服务端代码和Android客户端代码 代码实现包含 List,map ,对象传递
Axis2教程和java调用webservice的各种方法总结
axis2客户端调用webService接口需要用的jar包,在一次调接口中遇到的问题,亲测可用(整理成了比较精简的jar包)
1、java调用第三方webservice接口时,需要的最少jar包 2、提供一个简单的demo实例供参考,包括将类转化为XML,以及将XML运用axis上传到服务器
java axis客户端调用webservice,可应用于ofbiz框架。 解决网络上共享代码两次调用后会出现timeout的BUG
Java Axis 直接调用webservice 接口工具类, 无需根据wsdl编译客户端,需要axis相关包,测试使用axis 1.4, 附demo引入axis包后直接可以测试;
webService—Axis实例webService—Axis实例webService—Axis实例webService—Axis实例webService—Axis实例webService—Axis实例webService—Axis实例
axis2客户端,调用带ntlm认证的web service的代码例子和所需jar和java
简单例子:axis2整合spring发布webservice,以及session的管理
之前webservice客户端调用,使用RPC客戶端接口调用方法,但发现此种调用方式针对携参方式并不适用。最后经过多种方式测试选择了OMFactory......调用。经测试好用
Axis2 调用webservice Axis2是一套崭新的WebService引擎,该版本是对Axis1.x重新设计的产物。 Axis2不仅支持SOAP1.1和SOAP1.2,还集成了非常流行的REST WebService,同时还支持Spring、JSON等技术
axis调用第三方webservice接口所需的jar包,包括axis-1.4.jar,axis-jaxrpc-1.3.jar,axis-jaxrpc-1.4.jar,commons-discovery-0.5.jar,commons-logging-1.2.jar,cxf-rt-databinding-jaxb-3.3.1.jar,javax.mail-...
axis2客户端调用服务端,带用户身份认证
本方法是用axis1.4技术,实现java客户端调用webservice。已经可实现过可行的,如果不行可加我QQ号302633进行详细解析。