Hi Wayne,

We've talked about this but I thought I'd post to see if anyone else can
give us insight.


The original message context of the MySoapReceiverInOut.invokeBusinessLogic()
code stores the incoming soap envelope.  If your skeleton throws an
exception, AxisFault.handleFault() will replace the messageContext's soap
envelope with faultContext.getEnvelope().  If there is no exception in your
code, the setEnvelope() call is not invoked.


The reason why you cannot use
msgContext.getOperationContext().getMessageContext("In")
to get the orignal envelope, is that the getMessage("In") refers to the
original message context (because the hashmap stores a reference to original
message context).  Its envelope was overwritten with the fault envelope
during the fault handling.  Not sure why there is also a getMessage("Fault")
that returns the same envelope.  Perhaps it's a bug or maybe there is a
reason for this.  I don't know enough about the Axis2 code.


Kevin


------------------------------
From: [EMAIL PROTECTED]
To: [email protected]
Subject: Accessing SOAP message from MessageContexts in Handlers
Date: Wed, 20 Jun 2007 16:09:20 -0400


Using Axis2 1.2.  Is there a way to read the original SOAP message within a
PostDispatch Handler?

I'm invoking a custom handler in the PostDispatch phase.  The handler reads
the uses the MessageContext to get the original soap request message.
Something like this:

 String incomingMsg=msgContext.getOperationContext
().getMessageContext("In").getEnvelope().toString();
 System.out.println("Original SOAPMessage: "+incomingMsg);

This works fine in the success case.  The problem is if the Skeleton code
throws an exception, the above code prints the "Fault" soap message.  For
example, the following code prints exactly the same output:

 String incomingMsg=3DmsgContext.getOperationContext
().getMessageContext("In").getEnvelope().toString();
 System.out.println("SOAPMessage: "+incomingMsg);=0A=

 String faultMsg=3DmsgContext.getOperationContext
().getMessageContext("Fault").getEnvelope().toString();
 System.out.println("SOAPMessage: "+faultMsg);

Am I doing something incorrectly?  Is there another way to get the original
SOAP message in a Handler?

Thanks,
Wayne

Reply via email to