0
votes

I am developing a webapp with an embedded webservice with Axis2 using Maven. The service implementation is a POJO with RPC-style interaction, the target appserver is Tomcat running the Axis2 servlet.

The "Hello world" works but now I need to configure some global axis2 settings in the axis2.xml file (placed under WEB-INF/conf).

Please provide or point to a simple configuration for axis2.xml for this common environment. The default taken from the binary distribution has too many features activated (hotdeploy?) and also causes this problem:

<soapenv:Reason>
    <soapenv:Text xml:lang="en-US">
        The ServiceClass object does not implement the required method 
        in the following form: OMElement ping(OMElement e)
    </soapenv:Text>
</soapenv:Reason>

As a reference: http://axis.apache.org/axis2/java/core/docs/servlet-transport.html says to configure the servlet transport in this way, but it does not solve the issue.

<transportReceiver name="http" class="org.apache.axis2.transport.http.AxisServletListener"/>
2

2 Answers

3
votes

Apparently the problem is that the default axis2.xml sets raw xml messageReceivers, instead of the RPC ones.

Try to add this to the services.xml for the developed service, should fix the problem.

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

"Solution that worked for me was adding the operation tag in the service.xml against the Java Service method name:

 <operation name="sayHello" >
        <messageReceiver  mep="http://www.w3.org/2004/08/wsdl/in-out" class="org.apache.axis2.rpc.receivers.RPCMessageReceiver" />
    </operation>        
<parameter name="ServiceClass" locked="false">com.learning.webservices.pojo.HelloService</parameter>