Search code examples
javaweb-servicesapache-axis

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


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)

Solution

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