The ServiceClass object does not implement the required method in the following form: OMElement add(OMElement e)

15,108

Solution 1

Yeah I did. I finally figured out that in Axis2.xml we need to add

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

This snippet to make it work. I am not sure why this is important instead of default

<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"/>.

Thanks everyone for your prompt replies. Really helped me a lot to figure out what had to be done.

Solution 2

I had the same issue

I solved it by updating WSDL Version as follows

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

Example services.xml

Earlier

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

New

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

Solution 3

Faced the same issue. Made the below change to the WEB-INF->services->MyService -> META-INF -> services.xml

From:

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

To:

<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>
Share:
15,108
dodger
Author by

dodger

I am batman!

Updated on June 04, 2022

Comments

  • dodger
    dodger almost 2 years

    I am unable to figure out where the error is occurring. I checked my Axis2.xml and I have installed the latest Axis2 API. I am currently using Apache Tomcat 8 and JDK 1.8 for development.

    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)
    
  • dodger
    dodger almost 8 years
    so is it the problem with the wsdl version ? I haven't been able to figure out the real issue here
  • Danh
    Danh over 7 years
    It's the same with other answer
  • PGP
    PGP almost 6 years
    I concur... in my case the default message receivers were commented out and ONLY 1 proprietary in-out receiver was defined in the services.XML. Doing the above (adding default and proprietary message receivers) solved my problem.
  • Raul Lapeira Herrero
    Raul Lapeira Herrero over 2 years
    As other answer states you also need to add all the messageReceivers in the axis2.xml file