title: AxisFault: The ServiceClass object does not implement the required method in the following form: OMElement add(OMElement e)
body: <p>I am trying to learn WebServices (Axis2)</p>
  
  <p>I am using Jboss EAP 7.0, eclipse_mars with JDK 8, and the latest Axis2 (axis2-1.7.4).</p>
  
  <p>When running the client code,</p>
  
  <pre><code>package com.durgasoft.service;
  
  public class Test {
  public static void main(String[] args) throws Exception{
      CalServiceStub stub = new CalServiceStub();
      //Code to invoke add()
      CalServiceStub.Add params =
      new CalServiceStub.Add();
      params.setI(13);
      params.setJ(10);
      CalServiceStub.AddResponse
      res = stub.add(params);
      int result = res.get_return();
      System.out.println(result);
      } 
  }
  </code></pre>
  
  <p>The error that I get is:</p>
  
  <pre><code>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.durgasoft.service.CalServiceStub.add(CalServiceStub.java:181)
      at com.durgasoft.service.Test.main(Test.java:12)
  </code></pre>
  
  <p><strong><em>I have looked into the below posts on StackOverFlow:</em></strong></p>
  
  <ol>
  <li><p><a href="https://stackoverflow.com/questions/35720181/the-serviceclass-object-does-not-implement-the-required-method-in-the-following">https://stackoverflow.com/questions/35720181/the-serviceclass-object-does-not-implement-the-required-method-in-the-fowingoll</a></p>
  
  <p><strong>tried updating <a href="http://www.w3.org/2004/08/wsdl/in-only" rel="nofollow noreferrer">http://www.w3.org/2004/08/wsdl/in-only</a> to <a href="http://www.w3.org/ns/wsdl/in-only" rel="nofollow noreferrer">http://www.w3.org/ns/wsdl/in-only</a> and <a href="http://www.w3.org/2004/08/wsdl/in-out" rel="nofollow noreferrer">http://www.w3.org/2004/08/wsdl/in-out</a> to <a href="http://www.w3.org/ns/wsdl/in-out" rel="nofollow noreferrer">http://www.w3.org/ns/wsdl/in-out</a></strong></p></li>
  <li><p>Tried adding  operation tag in the service.xml as described in the 
  <a href="https://stackoverflow.com/questions/16692896/simple-axis2-xml-for-axis2-embedded-in-webapp">Simple axis2.xml for Axis2 embedded in webapp</a></p></li>
  <li><p><strong>Also I have even ensured that the messageReceivers described in Axis2.xml and the one mentioned in service.xml are the same. I have
  completely run out of idea. Kindly help me if you know how to
  resolve this issue.</strong></p></li>
  </ol>
  
  <p>I have created the services, </p>
  
  <pre><code>package com.durgaSoft.service;
  
  public class CalService {
  
      public int add(int i, int j){
          return i+j;
      }
  }
  </code></pre>
  
  <p>I have used eclipse wsdl generation tool to generate WSDL. and the generated WSDL file is as shown below.</p>
  
  <pre><code>This XML file does not appear to have any style information associated with it. The document tree is shown below.
  &lt;wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns="http://service.durgaSoft.com" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ns1="http://org.apache.axis2/xsd" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" targetNamespace="http://service.durgaSoft.com"&gt;
      &lt;wsdl:documentation&gt;Please Type your service description here&lt;/wsdl:documentation&gt;
      &lt;wsdl:types&gt;
          &lt;xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://service.durgaSoft.com"&gt;
              &lt;xs:element name="add"&gt;
                  &lt;xs:complexType&gt;
                      &lt;xs:sequence&gt;
                          &lt;xs:element name="i" type="xs:int"/&gt;
                          &lt;xs:element name="j" type="xs:int"/&gt;
                      &lt;/xs:sequence&gt;
                  &lt;/xs:complexType&gt;
              &lt;/xs:element&gt;
              &lt;xs:element name="addResponse"&gt;
                  &lt;xs:complexType&gt;
                      &lt;xs:sequence&gt;
                          &lt;xs:element name="return" type="xs:int"/&gt;
                      &lt;/xs:sequence&gt;
                  &lt;/xs:complexType&gt;
              &lt;/xs:element&gt;
          &lt;/xs:schema&gt;
      &lt;/wsdl:types&gt;
      &lt;wsdl:message name="addRequest"&gt;
          &lt;wsdl:part name="parameters" element="ns:add"/&gt;
      &lt;/wsdl:message&gt;
      &lt;wsdl:message name="addResponse"&gt;
          &lt;wsdl:part name="parameters" element="ns:addResponse"/&gt;
      &lt;/wsdl:message&gt;
      &lt;wsdl:portType name="CalServicePortType"&gt;
          &lt;wsdl:operation name="add"&gt;
              &lt;wsdl:input message="ns:addRequest" wsaw:Action="urn:add"/&gt;
              &lt;wsdl:output message="ns:addResponse" wsaw:Action="urn:addResponse"/&gt;
          &lt;/wsdl:operation&gt;
      &lt;/wsdl:portType&gt;
      &lt;wsdl:binding name="CalServiceSoap11Binding" type="ns:CalServicePortType"&gt;
          &lt;soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/&gt;
          &lt;wsdl:operation name="add"&gt;
              &lt;soap:operation soapAction="urn:add" style="document"/&gt;
              &lt;wsdl:input&gt;
                  &lt;soap:body use="literal"/&gt;
              &lt;/wsdl:input&gt;
              &lt;wsdl:output&gt;
                  &lt;soap:body use="literal"/&gt;
              &lt;/wsdl:output&gt;
          &lt;/wsdl:operation&gt;
      &lt;/wsdl:binding&gt;
      &lt;wsdl:binding name="CalServiceSoap12Binding" type="ns:CalServicePortType"&gt;
          &lt;soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/&gt;
          &lt;wsdl:operation name="add"&gt;
              &lt;soap12:operation soapAction="urn:add" style="document"/&gt;
              &lt;wsdl:input&gt;
                  &lt;soap12:body use="literal"/&gt;
              &lt;/wsdl:input&gt;
              &lt;wsdl:output&gt;
                  &lt;soap12:body use="literal"/&gt;
              &lt;/wsdl:output&gt;
          &lt;/wsdl:operation&gt;
      &lt;/wsdl:binding&gt;
      &lt;wsdl:binding name="CalServiceHttpBinding" type="ns:CalServicePortType"&gt;
          &lt;http:binding verb="POST"/&gt;
          &lt;wsdl:operation name="add"&gt;
              &lt;http:operation location="add"/&gt;
              &lt;wsdl:input&gt;
                  &lt;mime:content type="application/xml" part="parameters"/&gt;
              &lt;/wsdl:input&gt;
              &lt;wsdl:output&gt;
                  &lt;mime:content type="application/xml" part="parameters"/&gt;
              &lt;/wsdl:output&gt;
          &lt;/wsdl:operation&gt;
      &lt;/wsdl:binding&gt;
      &lt;wsdl:service name="CalService"&gt;
          &lt;wsdl:port name="CalServiceHttpSoap11Endpoint" binding="ns:CalServiceSoap11Binding"&gt;
              &lt;soap:address location="http://localhost:8080/Axis2CalService/services/CalService.CalServiceHttpSoap11Endpoint/"/&gt;
          &lt;/wsdl:port&gt;
          &lt;wsdl:port name="CalServiceHttpSoap12Endpoint" binding="ns:CalServiceSoap12Binding"&gt;
              &lt;soap12:address location="http://localhost:8080/Axis2CalService/services/CalService.CalServiceHttpSoap12Endpoint/"/&gt;
          &lt;/wsdl:port&gt;
          &lt;wsdl:port name="CalServiceHttpEndpoint" binding="ns:CalServiceHttpBinding"&gt;
              &lt;http:address location="http://localhost:8080/Axis2CalService/services/CalService.CalServiceHttpEndpoint/"/&gt;
          &lt;/wsdl:port&gt;
      &lt;/wsdl:service&gt;
  &lt;/wsdl:definitions&gt;
  </code></pre>
  
  <p>ServiceXML:</p>
  
  <pre><code>&lt;service name="CalService" &gt;
      &lt;Description&gt;
          Please Type your service description here
      &lt;/Description&gt;
  
      &lt;messageReceivers&gt;
          &lt;messageReceiver mep="http://www.w3.org/ns/wsdl/in-only" class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver" /&gt;
          &lt;messageReceiver  mep="http://www.w3.org/ns/wsdl/in-out"  class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/&gt;
      &lt;/messageReceivers&gt;
      &lt;!-- 
      &lt;messageReceivers&gt;
          &lt;messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only" class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver" /&gt;
          &lt;messageReceiver  mep="http://www.w3.org/2004/08/wsdl/in-out"  class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/&gt;
      &lt;/messageReceivers&gt;
      --&gt;
      &lt;parameter name="ServiceClass" locked="false"&gt;com.durgaSoft.service.CalService&lt;/parameter&gt;
  &lt;/service&gt;
  </code></pre>