Web Services ServiceClass对象未实现以下形式的所需方法:OMElement add(OMElement e)

wko9yo5t  于 2023-06-06  发布在  其他
关注(0)|答案(4)|浏览(111)

我不知道错误发生在哪里。我检查了我的Axis2.xml,我已经安装了最新的Axis2 API。我目前正在使用Apache Tomcat 8和JDK 1.8进行开发。

Exception in thread "main" org.apache.axis2.AxisFault: The ServiceClass object does not implement the required method in the following form: OMElement add(OMElement e)
    at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:508)
    at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:368)
    at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:414)
    at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:225)
    at org.apache.axis2.client.OperationClient.execute(OperationClient.java:150)
    at com.test.axis2.AddOperatorStub.add(AddOperatorStub.java:181)
    at com.test.axis2.client.AddClientApp.main(AddClientApp.java:29)
e37o9pze

e37o9pze1#

我也有同样的问题
我通过如下方式更新WSDL版本来解决这个问题
http://www.w3.org/2004/08/wsdl/in-only --> http://www.w3.org/ns/wsdl/in-only
&
http://www.w3.org/2004/08/wsdl/in-out --> http://www.w3.org/ns/wsdl/in-out

services.xml示例

  • 早些时候 *
<service name="Axis2HelloWorld" >
    <Description>
        Please Type your service description here
    </Description>
    <messageReceivers>
        <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only" class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver" />
        <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.ciber.webservices.Axis2HelloWorld</parameter>
</service>
  • 新 *
<service name="Axis2HelloWorld" >
    <Description>
        Please Type your service description here
    </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.ciber.webservices.Axis2HelloWorld</parameter>
</service>
g6baxovj

g6baxovj2#

面对同样的问题。对WEB-INF->services->MyService -> META-INF -> services.xml进行以下更改

发件人:

<messageReceivers>
		<messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only" class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver" />
		<messageReceiver  mep="http://www.w3.org/2004/08/wsdl/in-out"  class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
</messageReceivers>

收件人:

<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>
gkl3eglg

gkl3eglg3#

是的。我最终发现在Axis2.xml中我们需要添加
<messageReceiver mep="w3.org/ns/wsdl/in-only"; class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver" /> <messageReceiver mep="w3.org/ns/wsdl/in-out"; class="org.apache.axis2.rpc.receivers.RPCMessageReceiver" />
这段代码使它工作。我不知道为什么这是重要的,而不是默认
<messageReceiver mep="w3.org/ns/wsdl/in-only"; class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver"/> <messageReceiver mep="w3.org/ns/wsdl/in-out"; class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
感谢大家的及时回复。真的帮了我很大的忙,让我明白了该做什么。

c3frrgcw

c3frrgcw4#

消息接收者的设置对我来说在'Axis 1.8.2'中不再起作用,所以解决方案也是设置名称空间:

<service name="MyService" targetNamespace="http://service">

    <schema schemaNamespace="http://service"/>

    <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>

相关问题