soupUI导出webservice客户端
2016-01-26 15:48
405 查看
一、背景介绍:
a、有时遇到复杂的webservice接口,如直接访问的webservice通过<import>引用其他webservice且被引用页和引用页namespace不相同时,
JDK反编译webservice客户端就会报错。
二、问题分析:
a、用soapUI导出客户端需要axis2-1.4.1这个jar来支持,该包可以在云盘公用软件中找到。
b、使用soapUI导出客户端代码等同与wsdl2java-p com -d src -uri aa.wsdl而且后者往往更有效,参数项可省略。这个需要上述压缩包中的axis2-1.4.1-bin中的bin目录下在命令行执行。
-p
指定其wsdl的命名空间,也就是要生成代码的包名:
-d
指定要产生代码所在目录
-client
生成客户端测试web service的代码
-server
生成服务器启动web service的代码
-impl
生成web service的实现代码
-ant
生成build.xml文件
-all
生成所有开始端点代码:types,service proxy,,serviceinterface, server mainline, client mainline,
三、具体实现
操作步骤(使用的jar是axis2-1.4.1-bin/axis2-1.4.1)
启动soapUI工具,效果如下图:
选择菜单栏中的“Tools” -> “Axis2 Artifacts”选项:
在“Axis2 Artifacts”界面,点击“Tools”按钮:
配置axis2解压后的路径地址,完成后点击“Ok”按钮确定:
参照如下截图,配置WSDL文件路径和代码输出路径:
完成如上设置后,点击“Generate”按钮,即可生成客户端代码,生成过程如下图:
四、程序运行需要的JAR
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2</artifactId>
<version>1.5.1</version>
<type>pom</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-adb</artifactId>
<version>1.5.1</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-kernel</artifactId>
<version>1.5.1</version>
<type>jar</type>
<scope>compile</scope>
<exclusions>
<exclusion>
<artifactId>org.apache.ws.commons.schema</artifactId>
<groupId>XmlSchema</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.ws.commons.axiom</groupId>
<artifactId>axiom-api</artifactId>
<version>1.2.8</version>
</dependency>
<dependency>
<groupId>org.apache.ws.commons.axiom</groupId>
<artifactId>axiom-impl</artifactId>
<version>1.2.8</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-transport-local</artifactId>
<version>1.6.3</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-transport-http</artifactId>
<version>1.6.3</version>
</dependency>
<dependency>
<groupId>org.apache.neethi</groupId>
<artifactId>neethi</artifactId>
<version>3.0.3</version>
</dependency>
a、有时遇到复杂的webservice接口,如直接访问的webservice通过<import>引用其他webservice且被引用页和引用页namespace不相同时,
JDK反编译webservice客户端就会报错。
二、问题分析:
a、用soapUI导出客户端需要axis2-1.4.1这个jar来支持,该包可以在云盘公用软件中找到。
b、使用soapUI导出客户端代码等同与wsdl2java-p com -d src -uri aa.wsdl而且后者往往更有效,参数项可省略。这个需要上述压缩包中的axis2-1.4.1-bin中的bin目录下在命令行执行。
-p
指定其wsdl的命名空间,也就是要生成代码的包名:
-d
指定要产生代码所在目录
-client
生成客户端测试web service的代码
-server
生成服务器启动web service的代码
-impl
生成web service的实现代码
-ant
生成build.xml文件
-all
生成所有开始端点代码:types,service proxy,,serviceinterface, server mainline, client mainline,
三、具体实现
操作步骤(使用的jar是axis2-1.4.1-bin/axis2-1.4.1)
启动soapUI工具,效果如下图:
选择菜单栏中的“Tools” -> “Axis2 Artifacts”选项:
在“Axis2 Artifacts”界面,点击“Tools”按钮:
配置axis2解压后的路径地址,完成后点击“Ok”按钮确定:
参照如下截图,配置WSDL文件路径和代码输出路径:
完成如上设置后,点击“Generate”按钮,即可生成客户端代码,生成过程如下图:
四、程序运行需要的JAR
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2</artifactId>
<version>1.5.1</version>
<type>pom</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-adb</artifactId>
<version>1.5.1</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-kernel</artifactId>
<version>1.5.1</version>
<type>jar</type>
<scope>compile</scope>
<exclusions>
<exclusion>
<artifactId>org.apache.ws.commons.schema</artifactId>
<groupId>XmlSchema</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.ws.commons.axiom</groupId>
<artifactId>axiom-api</artifactId>
<version>1.2.8</version>
</dependency>
<dependency>
<groupId>org.apache.ws.commons.axiom</groupId>
<artifactId>axiom-impl</artifactId>
<version>1.2.8</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-transport-local</artifactId>
<version>1.6.3</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-transport-http</artifactId>
<version>1.6.3</version>
</dependency>
<dependency>
<groupId>org.apache.neethi</groupId>
<artifactId>neethi</artifactId>
<version>3.0.3</version>
</dependency>
相关文章推荐
- Aixs2开发Web service操作数据库demo
- ubuntu下安装 gSOAP 用于C/C++开发web service服务端与客户端
- Linux下用gSOAP开发Web Service服务端和客户端程序(一)
- Linux下用gSOAP开发Web Service服务端和客户端程序(二)
- web service, wcf, web api
- Axis2用法:soap消息携带消息头
- Axis2用法:JAVA2WSDL和WSDL2JAVA
- Axis2用法:客户端和服务端
- Axis2用法:soap消息携带附件
- 使用axis2生成客户端(异步/同步)调用代码
- eclipse下安装axis2工具插件
- arcengine发布webservice编辑sde
- axis2调用webservice接口核心代码
- axis2发布的webservices在flex中调用出错的解决方案(通过代理服务器发布)
- High scalability - Harvard notes.
- 使用 CXF 做 webservice 简单例子
- Axis 配置webService 配置文件未找到
- java调用SAP PI webservice ,用户名密码认证
- web service与wcf的区别
- axis2报错:The following error occurred during schema generation: null