简体   繁体   English

错误:org.apache.axis2.AxisFault:请求中未指定方法

[英]Error: org.apache.axis2.AxisFault: No method specified in request

I have problem to make a client with axis2-1.6.2 Then I summarize the problem. 我有一个问题要用axis2-1.6.2做一个客户,然后我总结问题。

I'm trying to use the next wsdl to make a client: http://www.mobilefish.com/services/web_service/countries.php?wsdl 我正在尝试使用下一个wsdl来建立客户端: http : //www.mobilefish.com/services/web_service/countries.php? wsdl

I'm using this line in windows: 我在Windows中使用此行:

WSDL2Java.bat -uri http://www.mobilefish.com/services/web_service/countries.php?wsdl -d xmlbeans -s

I'm using xmlbeans because with adb I have problems 我使用xmlbeans,因为使用adb时遇到问题

When I try to use this client with the next code: 当我尝试将此客户端与下一个代码一起使用时:

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 );
}

I'm receiving the next error : 我收到下一个错误:

Exception in thread "main" org.apache.axis2.AxisFault: No method specified in request. 线程“主” org.apache.axis2.AxisFault中的异常:请求中未指定任何方法。 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) 在org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:531)在org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:375)在org.apache.axis2.description.OutInAxisOperationClient.send (OutInAxisOperation.java:421)位于org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)位于org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)com.mobilefish。位于Main.main(Main.java:33)的webservice.countries.CountriesWebserviceMobilefishComServiceStub.countryInfoByIana(CountriesWebserviceMobilefishComServiceStub.java:462)

Please if someone can help with this problem would greatly appreciate it. 如果有人可以帮助解决这个问题,请多加赞赏。 Thanks in advance. 提前致谢。

Looks a lot like the web service doesn't have the information it needs to properly dispatch the message. 看起来很像Web服务没有正确分发消息所需的信息。 You're calling an RPC/encoded style web service which expects it's operation to be called by supplying a message payload wrapped with the name of the operation. 您正在调用RPC /编码样式的Web服务,该服务期望通过提供包装有操作名称的消息有效负载来调用该操作。 Verify that this is actually happening and your raw SOAP messages contain the operation name. 验证这种情况确实正在发生,并且原始SOAP消息包含操作名称。

Another possibility is that the service might require you populate the soap action header for it to be able to process your request. 另一种可能性是该服务可能要求您填充soap action头,以便它能够处理您的请求。 Populate this http header and see what happens 填充此http标头,看看会发生什么

I'm here to answer my own question, exactly I don't know what happen with axis2 when I consume the webservice, after the error that I reported here I had a lot of new errors ,but I can solve this problem using axis1.4 to consume all the operations of the web service. 我在这里回答我自己的问题,我使用网络服务时我完全不知道axis2会发生什么,在我在这里报告了错误之后,我遇到了很多新错误,但是我可以使用axis1解决此问题。 4消耗Web服务的所有操作。

Just I create the Objects : 我创建对象:

java -cp %AXISCLASSPATH% org.apache.axis.wsdl.WSDL2Java http://www.mobilefish.com/services/web_service/countries.php?wsdl

And then I use the next code: 然后使用下面的代码:

public static void main(String[] args) throws MalformedURLException, RemoteException, ServiceException {


    String  endpoint = "http://www.mobilefish.com/services/web_service/countries.php?wsdl";

    Service  service = new Service();
    Call     call    = (Call) service.createCall();

    call.setTargetEndpointAddress( new java.net.URL(endpoint) );
    call.setOperationName( "countryInfoByIana" );
    call.addParameter( "ianacode", XMLType.XSD_STRING, ParameterMode.IN );
    call.setReturnType(XMLType.SOAP_ARRAY);

    Object _resp = call.invoke( new Object [] { "us" });

    Object[] objetoArray = (Object[]) _resp;

    for(int i = 0; i< objetoArray.length; i++){
        System.out.println( objetoArray[ i ] );
    }

}

Maybe is not possible to consume the web service with axis2 I don't know but now I find out this solution which is valid to me. 也许无法使用我不知道的axis2来使用Web服务,但是现在我找到了对我有效的解决方案。

Thanks anyway. 不管怎么说,还是要谢谢你。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 org.apache.axis2.AxisFault:传输错误:501错误:未实现 - org.apache.axis2.AxisFault: Transport error: 501 Error: Not Implemented org.apache.axis2.AxisFault连接被拒绝 - org.apache.axis2.AxisFault connection refused org.apache.axis2.AxisFault:尝试调用服务方法getUserInfomationByEmail时发生异常 - org.apache.axis2.AxisFault: Exception occurred while trying to invoke service method getUserInfomationByEmail 错误:“ org.apache.axis2.AxisFault:传输错误:403错误:禁止” - Error : “org.apache.axis2.AxisFault: Transport error: 403 Error: Forbidden” org.apache.axis2.AxisFault:尚未设置转出 - org.apache.axis2.AxisFault: Transport out has not been set 引起:org.apache.axis2.AxisFault:无法参与模块:城墙 - Caused by: org.apache.axis2.AxisFault: Unable to engage module : rampart org.apache.axis2.AxisFault: sun.security.validator.ValidatorException: - org.apache.axis2.AxisFault: sun.security.validator.ValidatorException: org.apache.axis2.AxisFault:传输错误:407错误:需要代理身份验证 - org.apache.axis2.AxisFault:Transport error: 407 Error:Proxy Authentication Required 导入 org.apache.axis2.AxisFault 无法解析。 什么依赖安装必要的 AxisFault? - The import org.apache.axis2.AxisFault cannot be resolved. What dependency installs necessary AxisFault? org.apache.axis2.AxisFault:org.apache.axis2.databinding.ADBException:Unexpected subelement underTimelyRenewal - org.apache.axis2.AxisFault: org.apache.axis2.databinding.ADBException: Unexpected subelement underTimelyRenewal
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM