Thanks Glen, I will pick up the nightly build ... tonight ;-) and run the test again.
Cheers Romin. -----Original Message----- From: Glen Daniels [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 20, 2002 8:14 PM To: '[EMAIL PROTECTED]' Subject: RE: Response Flow Problem Hi Romin! This was due to a bug in our MessageElement class. We were relying on the fact that the MessageElement had been created from deserializing XML for our typemappings to work. The code in MessageElement which calls the SerializationContextImpl wasn't correctly setting up the MessageContext (which contains the typemappings that are in scope) because there was no DeserializationContext sitting around because the response message was created from scratch. I fixed the code so we now use the currently in-scope MessageContext if there is no DeserializationContext, and so your Handler should now do the right thing after updating from the latest CVS or tomorrow's nightly build. Thanks for finding this problem - I'm somewhat surprised none of our unit tests caught it! (I'm going to write one for it now) --Glen > -----Original Message----- > From: Romin Irani [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, February 20, 2002 7:49 PM > To: [EMAIL PROTECTED] > Subject: Response Flow Problem > > > 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. >
