javax.xml.soap.SOAPPart sp = soapMessage.getSOAPPart();
javax.xml.soap.SOAPEnvelope se = sp.getEnvelope();
se.getBody().detachNode();
javax.xml.soap.SOAPBody nsb = se.addBody();
javax.xml.soap.Name name = se.createName("test_element");
javax.xml.soap.SOAPBodyElement sbe = nsb.addBodyElement(name);
javax.xml.soap.Name name2 = se.createName("version");
javax.xml.soap.SOAPElement sel = sbe.addChildElement(name2);
sel.addTextNode("1.0");
-----Original Message-----
From: Tripper McCarthy [mailto:[EMAIL PROTECTED]
Sent: Monday, June 23, 2003 4:34 PM
To: '[EMAIL PROTECTED]'
Subject: HELP: Modify Message Body in HandlerI 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
[EMAIL PROTECTED]
