问题
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 !
回答1:
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());
来源:https://stackoverflow.com/questions/22939440/how-to-get-soap-response-from-webservicetemplate