You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Tripper McCarthy <Tr...@pdsi-software.com> on 2003/06/24 01:34:03 UTC
HELP: Modify Message Body in Handler
I have been trying to modify the content of the message body in one of my
handlers before the message reaches the actual web service. I have read
through a number of message from the mailing list, and tried just about
everything I can think of. But my message body is unchanged after leaving my
handler. Below is my current code. Does anyone have any suggestions?
public void invoke(MessageContext msgContext) throws AxisFault {
// Retrieve the soap body out of the message
Message message = msgContext.getRequestMessage();
org.apache.axis.message.SOAPEnvelope se =
message.getSOAPEnvelope();
org.apache.axis.message.SOAPBody sb =
(org.apache.axis.message.SOAPBody)se.getBody();
// Generic test
MessageElement mElement = new MessageElement("","body_test");
mElement.addTextNode("body test");
sb.addChild(mElement);
message.saveChanges();
System.out.println("handler 1 = " + sb.toString());
}
The final println statement shows the exact message I started off with,
without my changes.
Thanks
Tripper McCarthy
trippermccarthy@pdsi-software.com