I am having a problem retrieving the SOAP Response in the Response Flow as
explained below:

a) I have simple HelloWorld RPC Service:

package com.myclasses;

public class HelloWorld {

    public HelloWorld() {
    }

    public String sayHelloWorld(String name) {
      return "Hello World to " + name;
    }
}

b) I have defined a couple of handlers that intercept the request flow and
response flow. The WSDD file for HelloWorld Service is shown below:

<deployment name="SparePartInfo" xmlns="http://xml.apache.org/axis/wsdd/";
            xmlns:java="http://xml.apache.org/axis/wsdd/providers/java";>
            xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance";>

<!-- Define the Request Handler i.e. SOAPRequestLogger -->
<handler name="SOAPRequestLogger"
type="java:com.myclasses.SOAPRequestLogger">
  <parameter name="SOAPLogFile" value="d:\\SOAP.log"/>
</handler>

<!-- Define the Response Handler i.e. SOAPResponseLogger -->
<handler name="SOAPResponseLogger"
type="java:com.myclasses.SOAPResponseLogger">
  <parameter name="SOAPLogFile" value="d:\\SOAP.log"/>
</handler>

<!-- Define the Service (HelloWorld) -->
<service name="HelloWorld" provider="java:RPC">
<requestFlow>
<handler type="SOAPRequestLogger"/>
</requestFlow>
<responseFlow>
<handler type="SOAPResponseLogger"/>
</responseFlow>
<parameter name="className" value="com.myclasses.HelloWorld"/>
<parameter name="allowedMethods" value="sayHelloWorld"/>
</service>
</deployment>

c) In my SOAPRequestHandler defined in the requestFlow of the service, I
have the following code in the invoke(MessageContext ctx) method

                .......
            Message reqMessage = messageContext.getRequestMessage();
            SOAPPart soappart = reqMessage.getSOAPPart();
            SOAPEnvelope env = soappart.getAsSOAPEnvelope();
            Element envElement = env.getAsDOM();
            String strSOAPRequest = XMLUtils.ElementToString(envElement);

                //Log strSOAPRequest into File (CODE NOT SHOWN)
                .......

d) In my SOAPResponseHandler defined in the responseFlow of the service, I
have the following code in the invoke(MessageContext ctx) method

            .......
            Message resMessage = messageContext.getResponseMessage();
            SOAPPart soappart = reqMessage.getSOAPPart();
            SOAPEnvelope env = soappart.getAsSOAPEnvelope();
            Element envElement = env.getAsDOM();
            String strSOAPResponse = XMLUtils.ElementToString(envElement);

                //Log strSOAPResponse into File (CODE NOT SHOWN)
            .......

If I run a client for the above service, WITHOUT the <responseFlow> element
for the <service>, everything is fine and the SOAP Request is logged
correctly in the file.

If I run a client for the above service, WITH the <responseFlow> element for
the <service>, I get the following error:
---------------
java.io.IOException: No serializer found for class java.lang.String in
registry org.apache.axis.encoding
.SerializationContextImpl@4cf67
---------------

I traced the problem to the getAsDOM() method on the SOAPEnvelope class. Why
is the getAsDOM() failing at this point ? Any clues ???

Any pointers will be appreciated :-)

Thanks
Romin.

Reply via email to