I am getting the following exception when I try to use the RPCMessageReceiver to handle this method:

public void createItem( Item item )
{
        System.err.println(
                "creating item: " +
                item.getUpc() +
                " - " +
                item.getDescription() );                
}


Here is the exception:

org.apache.axis2.AxisFault: Invalid message addition , operation context completed
        at org.apache.axis2.description.InOnlyAxisOperation.addMessageContext(InOnlyAxisOperation.java:62)
        at org.apache.axis2.context.OperationContext.addMessageContext(OperationContext.java:85)
        at org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.receive(AbstractInOutSyncMessageReceiver.java:35)
        at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:454)
        at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:284)
        at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:136)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
        at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
        at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
        at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
        at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
        at java.lang.Thread.run(Thread.java:595)


If I change the above method to:

public boolean createItem( Item item )
{
        System.err.println(
                "creating item: " +
                item.getUpc() +
                " - " +
                item.getDescription() );
       
        return true;
}

Then everything works fine.  Given the exception and the code change it looks like the RPC Message Receiver doesn't like dealing with methods that return void.  Is this correct?  Is there something I am missing here?

Other information that might help is that if I try to define my services.xml like this:

        <operation name="createItem">
                <messageReceiver
                        class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"
                />
        </operation>

Axis can't create the WSDL.  I get the following message when going to the ?wsdl url:

<error><description>Unable to generate WSDL for this service</description><reason>Either user has not dropped the wsdl into META-INF or operations use message receivers other than RPC.</reason></error>

The only way I could get it to create the WSDL for me is to do this in the services.xml:

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

This may very well be the cause of the problem I am seeing, but if it is, then how am I supposed to get Axis2 to generate the WSDL?  Any help would be much appreciated.

Basically I am trying to create an RPC service for a class that has the following API.

Item getItem( int id );
void createItem( Item input );

I would like the WSDL created automatically as well if possible.  I can't seem to get the services.xml right to get the WSDL to work and for the web service to work with the above API.  I really would appreciate some help.


Michael MacFadden

Reply via email to