Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to get soap response from webServiceTemplate

I need to get a soap response using "webServiceTemplate". Currently in my existing architecture it's using function "public boolean sendSourceAndReceiveToResult(String uri, Source requestPayload, Result responseResult) { } " but this is returning only boolean value, but is there any way to capture the soap response?

I tried with "marshalSendAndReceive" functions but its not working.

Could you please suggest how can I get the soap response using webServiceTemplate functions, or will I have to write a customized function for this ?

Thank You !

like image 651
user3365075 Avatar asked Oct 18 '25 22:10

user3365075


1 Answers

You could do something like that:

ByteArrayOutputStream  bytArrayOutputStream = new ByteArrayOutputStream();

StreamResult result = new StreamResult(bytArrayOutputStream);

wsTemplate.sendSourceAndReceiveToResult(defautUri, source, result); 

final String reply = new String(bytArrayOutputStream.toByteArray());
like image 145
VirtualTroll Avatar answered Oct 21 '25 18:10

VirtualTroll



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!