Using spring ws to get the StreamResult as below
StreamSource source = new StreamSource(new StringReader(MESSAGE));
StreamResult result = new StreamResult(System.out);
webServiceTemplate.sendSourceAndReceiveToResult("http://someUri",
source, new SoapActionCallback("someCallBack"), result);
return result;
I get the result, But I want to extract it to some sort of xml or even as a string (Just want to see the contents in order to generate the response).
How can I do this?
You can get the reader of your StreamSource by using getReader(). You should then be able to use read(char[] cbuf) to write the contents of the stream to a character array which can easily be converted into a string and printed to the console if you wish.
Try this one:
If none of these works, try this
Assuming you have this kind of structure ,
You can try this way , although the same thing, wanted to point it out clearly
If you use Spring you could also use this way: