门外小白用axis2调用接口,发送数据请求
来源:互联网 发布:手机日记本数据库表 编辑:程序博客网 时间:2024/06/07 04:03
1.axis2不建议用1.5版本,用1.6以上的,1.5版本本身存在坑
2.jar包
pom.xml:
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-aar-maven-plugin</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-adb</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-adb-codegen</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-ant-plugin</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-clustering</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-codegen</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-integration</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-java2wsdl</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-java2wsdl-maven-plugin</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-jaxbri</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-jaxws</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-jaxws-integration</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-jibx</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-json</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-kernel</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-mar-maven-plugin</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-metadata</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-mtompolicy</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-repo-maven-plugin</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-resource-bundle</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-saaj</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-soapmonitor-servlet</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-spring</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-transport-http</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-transport-local</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-wsdl2code-maven-plugin</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-xmlbeans</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>org.apache.axis2.osgi</artifactId>
<version>1.6.2</version>
</dependency>
<!-- axis2 -->
3.demo:
public static String sendService(String mainJson,String sType,String url,String method){
String xml=null;
try {
String sign = null;
sign = string2MD5(appkey+mainJson);//appkey加上数据 做个MD5验证,可有可无
RPCServiceClient serviceClient = new RPCServiceClient();
Options options = serviceClient.getOptions();
EndpointReference targetEPR = new EndpointReference(url);
options.setTo(targetEPR);
QName opAddEntry = new QName("服务器域名",method);//服务器域名路径+方法名
// 参数,如果有多个,继续往后面增加即可,不用指定参数的名称
Object[] opAddEntryArgs = new Object[] {sign,mainJson};
Class[] classes = new Class[] { String.class };
xml=(String)serviceClient.invokeBlocking(opAddEntry,opAddEntryArgs, classes)[0];
System.out.println("服务器返回结果"+method+":"+xml);
} catch (Exception e) {
e.printStackTrace();
}
return xml;
}
- 门外小白用axis2调用接口,发送数据请求
- httpClient发送get请求调用接口
- Axis2 调用Webservice 接口
- python 调用webserver接口请求数据
- axis2 远程调用webservice接口
- C#通过发送 http 请求调用接口之Get
- C#通过发送 http 请求调用接口之Post
- JAVA发送http get/post请求,调用http接口、方法
- JAVA发送http get/post请求,调用http接口、方法
- JAVA发送http get/post请求,调用http接口、方法
- JAVA发送http get/post请求,调用http接口、方法
- JAVA发送http get/post请求、调用http接口、方法
- JAVA发送http get/post请求,调用http接口、方法
- JAVA发送http请求,调用http接口与方法
- JAVA发送http get/post请求,调用http接口、方法
- 发送请求读取接口
- 对接第三方接口--使用post请求发送json数据
- httpClient使用,1 发送post请求 2 发送get请求取得接口中的数据
- Android 开源简单控件
- 1.下载安装Nexus搭建Maven私服
- 剑指offer
- 学习ASP.NET之前,先了解它
- 1000. String Reversion
- 门外小白用axis2调用接口,发送数据请求
- 进程间共享内存操作简易封装
- 神经网络正向反向传播算法
- Notification
- Shader记录0912
- 学习SLAM预备知识
- HTML标签
- JavaScript window、location对象基础知识整理
- Android LayoutParams