how to get soap response from webServiceTemplate

旧巷老猫 提交于 2020-01-04 13:48:49

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!