axis2 调用webservice
maven配置:主要引用包及plugins
<properties>
<axis2.version>1.6.1</axis2.version>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-kernel</artifactId>
<version>${axis2.version}</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-adb</artifactId>
<version>${axis2.version}</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-transport-http</artifactId>
<version>${axis2.version}</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-transport-local</artifactId>
<version>${axis2.version}</version>
</dependency> </dependencies> <build>
<plugins>
<plugin>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-wsdl2code-maven-plugin</artifactId>
<version>1.6.1</version>
<executions>
<execution>
<id>wsdl2code-client</id>
<phase>generate-sources</phase>
<goals>
<goal>wsdl2code</goal>
</goals>
</execution>
</executions>
<configuration>
<wsdlFile>src/main/resources/wsdl/IXman.wsdl</wsdlFile>
<packageName>com.stub.generated</packageName>
<generateServicesXml>false</generateServicesXml>
<unpackClasses>true</unpackClasses>
</configuration>
</plugin>
</plugins>
</build>
通过wsdlFile属性指定wsdl所在文件。
如果是有多个wsdl需要生成java代码,则可以用下面的配置:
<plugin>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-wsdl2code-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<id>ws1</id>
<goals>
<goal>wsdl2code</goal>
</goals>
<configuration>
<unpackClasses>true</unpackClasses>
<databindingName>adb</databindingName>
<packageName>org.example.stackoverflow.axis2-maven</packageName>
<wsdlFile>src/main/resources/service1.wsdl</wsdlFile>
<outputDirectory>target/generated-sources</outputDirectory>
<syncMode>sync</syncMode>
</configuration>
</execution>
<execution>
<id>ws2</id>
<goals>
<goal>wsdl2code</goal>
</goals>
<configuration>
<unpackClasses>true</unpackClasses>
<databindingName>adb</databindingName>
<packageName>org.example.stackoverflow.axis2-maven</packageName>
<wsdlFile>src/main/resources/service2.wsdl</wsdlFile>
<outputDirectory>target/generated-sources</outputDirectory>
<syncMode>sync</syncMode>
</configuration>
</execution>
</executions>
</plugin>
注意,这段xml配置,如果使用axis2-wsdl2code:wsdl2code命令去生成会报错,但使用install者可以生成成功。
之后通过中间代码调用即可。
@Test
public void testWs() throws Exception{
AIServiceStub aiServiceStub=new AIServiceStub();
AIRequest aiRequest=new AIRequest();
aiRequest.setMsgHeader("test");
aiRequest.setMsgBody("test");
AIResponse response= aiServiceStub.aIService_visit(aiRequest);
System.out.println(response.getRes());
}
axis2 调用webservice的更多相关文章
- Java调用WebService方法总结(5)--Axis2调用WebService
Axis2是新一点Axis,基于新的体系结构进行了全新编写,有更强的灵活性并可扩展到新的体系结构.文中demo所使用到的软件版本:Java 1.8.0_191.Axis2 1.7.9. 1.准备 参考 ...
- axis2调用webservice
public static long TIMEOUTINMILLISECONDS=100000; /** * 调用webservice * @param url webserviceURL * @pa ...
- axis2调用webService几种方式
主要有三种方式: 第一RPC方式,不生成客户端代码 第二,document方式,不生成客户端代码 第三,用wsdl2java工具,生成客户端方式调用 java代码: package samples.q ...
- axis2调用webservice教训
总结教训,axis2client调用WS接口时url不能加?wsdl,而用cxf调用时则要加上. 今天用axis2的RpcServerClient调用https的webservice接口,在设置完op ...
- 使用axis2调用webservice需要导入的依赖
<properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> &l ...
- Java调用WebService方法总结(1)--准备工作
WebService是一种跨编程语言.跨操作系统平台的远程调用技术,已存在很多年了,很多接口也都是通过WebService方式来发布的:本系列文章主要介绍Java调用WebService的各种方法,使 ...
- 使用AXIS2客户端调用 WEBSERVICE
问题 在调用WEBSERVICE时,可以使用wsdl2java生成java代码,调用接口,这种方法在接口固定的情况下是一种不错的选择,如果需要动态调用接口,那么这样就行不通了. 解决办法 1.直接构建 ...
- 使用Axis2实现WebService的发布和调用
一.Axis2的下载和安装 1.可从http://ws.apache.org/axis2/ 下载Axis2的最新版本: 可以下载如下三个zip包: axis2-1.7.3-bin.zip(用 ...
- Axis2 webservice 之使用java调用webservice
在上一篇中写了一个简单了webservice,实现了一个sayHello功能.那么webservice写好之后我们如何使用Java程序来调用webservice呢? 一.java调用的webservi ...
随机推荐
- neo4j-备份、恢复
neo4j备份命令(本例linux) neo4j-backup 命令使用: ./neo4j-backup -full -from single://[machine IP] -to ~/backup- ...
- 【转】MipMap
原文地址http://www.cppblog.com/wc250en007/archive/2011/08/06/152653.html 首先从MIPMAP的原理说起,它是把一张贴图按照2的倍数进行缩 ...
- py-faster-rcnn搭配pycharm使用
先在ubuntu下配置好cuda.cudnn以及py-faster-rcnn,然后安装pycharm. 打开pycharm看py-faster-rcnn代码,import处各种红色下划曲线,提示报错. ...
- 使用Zabbix官方模板监控Redis运行状况
运行环境: OS:CentOS 6.8 / Python: 2.6.6 / Pip: 7.1.0 / Redis:3.0 / Zabbix:3.0.3 Zabbix官方提供的监控模板. 项目地址:ht ...
- Oracle 查询表中字段里数据是否有重复
1.查找单个字段 select 字段名,count(*) from table group by 字段名 having count(*) > 1 2.查找组合字段: SELECT TEST_NA ...
- Mac OS sierra app is damaged
想升级系统,然后发生如题错误,谷歌之,解决方法如下(希望帮助大家): Step 1. Go to your applications folder. Step 2. Find the installe ...
- 每天一个 Linux 命令(21):find命令之xargs
在使用 find命令的-exec选项处理匹配到的文件时, find命令将所有匹配到的文件一起传递给exec执行.但有些系统对能够传递给exec的命令长度有限制,这样在find命令运行几分钟之后,就会出 ...
- Zabbix监控
安装zabbix首先需要安装Nginx+Mysql+PHP,然后再安装zabbix 安装zabbix1:创建用户及组: groupadd zabbix useradd -g zabbix zabbix ...
- thinkphp3.2.3版本文件目录及作用
下载thinkphp3.2.3版本,解压缩后将文件夹名字改为thinkphp,然后放在www目录下,里面的文件夹和文件的名字和作用如下:(前面有Tab健的表示下一级,thinkphp是根目录) //t ...
- 使用django开发博客过程记录4——Category分类视图
在写点击博客的所属分类,显示所有该分类的文章时真是让我想了好一会,为什么呢?因为我使用的是cbv模式开发的而不是简单的视图处理逻辑的,所以,有些操作会被包装好了,你并不知道它的细节,那么我们今天要实现 ...