目前我正在我的项目中实施Axis2(ROOT.war,http://localhost:8080/),但我们需要使用下一个网址来调用我们的网络服务" http://localhost:8080/axis2/services/MyService",所以我在web.xml上实现了这个设置:
<servlet-mapping>
<servlet-name>AxisServlet</servlet-name>
<url-pattern>/axis2/services/*</url-pattern>
</servlet-mapping>
但是当我们检查生成的wsdl(http://localhost:8080/axis2/services/MyService?wsdl)时,有一个部分(位置值)仍然指向 http://localhost:8080/services/ 而不是 {{3 }}
<wsdl:service name="MyService">
<wsdl:port name="MyServiceHttpSoap11Endpoint" binding="tns:MyServiceSoap11Binding">
<soap:address location="http://localhost:8080/services/MyService.MyServiceHttpSoap11Endpoint/"/>
</wsdl:port>
<wsdl:port name="MyServiceHttpSoap12Endpoint" binding="tns:MyServiceSoap12Binding">
<soap12:address location="http://localhost:8080/services/MyService.MyServiceHttpSoap12Endpoint/"/>
</wsdl:port>
<wsdl:port name="MyServiceHttpEndpoint" binding="tns:MyServiceHttpBinding">
<http:address location="http://localhost:8080/services/MyService.MyServiceHttpEndpoint/"/>
</wsdl:port>
</wsdl:service>
因此,当我尝试使用SOAP UI测试我的WS时,由于我尝试使用http://localhost:8080/axis2/services/进行测试但是设置了http://localhost:8080/axis2/services/MyService
,因此会引发错误这是我的services.xml
<service name="MyService" >
<Description>
MyService Web Service
</Description>
<messageReceivers>
<messageReceiver mep="http://www.w3.org/ns/wsdl/in-only" class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver" />
<messageReceiver mep="http://www.w3.org/ns/wsdl/in-out" class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
</messageReceivers>
<parameter name="ServiceClass" locked="false">com.xxx.yyy.ws.webservice.MyService</parameter>
</service>
有没有办法在services.xml上设置一些东西来改变url?或任何其他方法来避免这种不匹配?
答案 0 :(得分:0)
我解决了实现axis2.xml并将servicepath参数更新为:
的问题<parameter name="servicePath">axis2/services</parameter>