使用jetty+axis2实现webservice服务端,且无需使用axis2命令生成服务端代码,只要services.xml配置实现类。
工程为gradle工程配置文件在src/main/resources/axis2/WEB-INF/services.xml:
<?xml version="1.0" encoding="UTF-8"?> <serviceGroup> <service name="wifiecService"> <Description> Please Type your service description here </Description> <messageReceivers> <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out" class="org.apache.axis2.rpc.receivers.RPCMessageReceiver" /> </messageReceivers> <parameter name="ServiceClass" locked="false">com.smsservice.webservices.SmsService </parameter> </service> </serviceGroup>
浏览器访问服务端wsdl地址,保存下来的wsdl文件无法通过eclipse luna自带的axis1插件生成客户端代码,缺少一个xxxPortType类,
解决方法:使用axis1的wsdl2java命令来生成客户端代码:
脚本:wsdl2java.bat
set Axis_Lib=G:\jar-lib\axis1.4 set Java_Cmd=java -Djava.ext.dirs=%Axis_Lib% set Output_Path=C:\Users\tower\Desktop\test set Package=wcf %Java_Cmd% org.apache.axis.wsdl.WSDL2Java http://x.x.x.x:9002/services/xxxService?wsdl -o%Output_Path% -p%Package%
dos下执行此脚本,会生成服务端代码和客户端代码到test目录。
G:\jar-lib\axis1.4 的目录 2007-10-17 11:05 56,290 activation.jar 2006-04-22 18:56 33,202 axis-ant.jar 2006-04-22 18:56 1,599,570 axis.jar 2006-04-22 18:56 71,442 commons-discovery-0.2.jar 2006-04-22 18:56 38,015 commons-logging-1.0.4.jar 2006-04-22 18:56 31,191 jaxrpc.jar 2011-06-02 16:30 391,834 log4j-1.2.15.jar 2006-04-22 18:56 921 log4j.properties 2009-08-02 15:04 436,053 mail.jar 2006-04-22 18:56 18,979 saaj.jar 2006-04-22 18:56 126,771 wsdl4j-1.5.1.jar
axis2的wsdl无法使用eclipse axis1插件来生成客户端--解决方法
时间: 2024-10-11 02:45:36