WebServices客户端代码生成

方式一:

官网下载cxf运行包:http://cxf.apache.org/download.html

axis2:http://axis.apache.org/axis2/java/core/download.cgi

进入cxf的bin目录,cmd控制台运行:wsdl2java -d e:\ws\ http://219.139.241.227:8724/services/WMSPDAServices?wsdl

 

生成ws客户端代码。

 

附wsdl2java用法:

wsdl2java -p com -d D:\\src -all xx.wsdl

-p 指定其wsdl的命名空间,也就是要生成代码的包名:

-d 指定要产生代码所在目录

-client 生成客户端测试web service的代码

-server 生成服务器启动web service的代码

-impl 生成web service的实现代码

-ant 生成build.xml文件

-all 生成所有开始端点代码:types,service proxy,,service interface, server mainline, client mainline, implementation object, and an Ant build.xml file.

 

 

方式二:

maven项目pom.xml文件,配置以下插件:

  

<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>2.7.3</version>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<configuration>
<sourceRoot>E:\workspaces\IdeaProjects\orderCenter\ordercenter-parent\ordercenter-job\src\main\java\com\ehaoyao\jobcenter\order\webservices\jyzx</sourceRoot>
<wsdlOptions>
<wsdlOption>
<wsdl>http://****:***/services/WMSPDAServices?wsdl</wsdl>
</wsdlOption>
</wsdlOptions>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin>

clean install 即可生成ws客户端代码。


调用测试:

 

接口存在问题。

 


posted @ 2017-08-11 15:49  air_balloon  阅读(268)  评论(0编辑  收藏  举报