我在使用 axis2-1.6.2 制作客户端时遇到问题,然后我总结了问题。
我正在尝试使用下一个 wsdl 来创建客户端:http://www.mobilefish.com/services/web_service/countries.php?wsdl
我在 Windows 中使用这一行:
WSDL2Java.bat -uri http://www.mobilefish.com/services/web_service/countries.php?wsdl -d xmlbeans -s
我正在使用xmlbeans,因为使用adb我遇到了问题
当我尝试将此客户端与下一个代码一起使用时:
public static void main(String[] args) throws RemoteException {
CountriesWebserviceMobilefishComServiceStub countriWebService =
new CountriesWebserviceMobilefishComServiceStub("http://www.mobilefish.com/services/web_service/countries.php?wsdl");
CountryInfoByIanaDocument cidocument = CountryInfoByIanaDocument.Factory.newInstance();
CountryInfoByIana ci = CountryInfoByIana.Factory.newInstance();
ci.setIanacode("us");
cidocument.setCountryInfoByIana( ci );
countriWebService.countryInfoByIana( cidocument );
}
我收到下一个错误:
Exception in thread "main" org.apache.axis2.AxisFault: No method specified in request. at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:531) at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:375) at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:421) at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229) at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165) at com.mobilefish.webservice.countries.CountriesWebserviceMobilefishComServiceStub.countryInfoByIana(CountriesWebserviceMobilefishComServiceStub.java:462) at Main.main(Main.java:33)
如果有人可以帮助解决这个问题,我将不胜感激。 提前致谢。
最佳答案
看起来很像 Web 服务没有正确发送消息所需的信息。您正在调用 RPC/编码样式的 Web 服务,该服务期望通过提供包含操作名称的消息有效负载来调用其操作。验证这是否确实发生,并且您的原始 SOAP 消息包含操作名称。
另一种可能性是该服务可能需要您填充 soap action
header 才能处理您的请求。填充此 http header 并查看会发生什么
关于java - 错误 : org. apache.axis2.AxisFault:请求中未指定方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13789987/