Well I found the answer to my own question.

For interest, here's how to do it:

Somehow obtain a DOM Element object which contains all the stuff which will go INSIDE the body (don't include the SOAP Envelope and SOAP Body tags or you'll get a deserialization exception).

Then do the following (assuming the Element is called elem):

SOAPEnvelope se = new SOAPEnvelope();
SOAPBodyElement sbe = new SOAPBodyElement(elem);
se.addBodyElement(sbe);
Message newMsg = new Message((Object)se);
msgContext.setCurrentMessage(newMsg);

:) :)

stephen




Stephen Gordon wrote:

Hi there,

I'm just wondering if anyone knows how to modify the SOAP content of a server response message using a Handler object?? What I want to do is get my Handler to change the response message to a SOAP message (in XML) which is read in from an InputStream.

I've tried like this:

InputSource xmlSource = new InputSource(pis);
DeserializationContext dser = new DeserializationContextImpl(xmlSource, msgContext, Message.RESPONSE);
dser.parse();


But this causes a SocketTimeoutException when a call a service.

Any ideas??

stephen









Reply via email to