Your solution is standard for JAX-RPC.

But for other people it might be interesting to look at other possibilities how to use JAX-RPC and SAAJ in "The Java Web Services Tutorial"

http://java.sun.com/webservices/downloads/webservicestutorial.html

Chapter 12:   Building Web Services With JAX-RPC
Section 13. SOAP with Attachments API for Java

They have quite good examples for both Handlers for server and for client.

Yuri

Stephen Gordon wrote:

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