如何从 webServiceTemplate 获取soap响应 [英] how to get soap response from webServiceTemplate
问题描述
我需要使用webServiceTemplate"获得soap响应.目前在我现有的架构中,它使用函数public boolean sendSourceAndReceiveToResult(String uri, Source requestPayload, Result responseResult) {} "但这仅返回布尔值,但有没有办法捕获soap响应?
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?
我尝试使用marshalSendAndReceive"函数,但它不起作用.
I tried with "marshalSendAndReceive" functions but its not working.
您能否建议我如何使用 webServiceTemplate 函数获得soap响应,或者我是否必须为此编写自定义函数?
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 ?
谢谢!
推荐答案
你可以这样做:
ByteArrayOutputStream bytArrayOutputStream = new ByteArrayOutputStream();
StreamResult result = new StreamResult(bytArrayOutputStream);
wsTemplate.sendSourceAndReceiveToResult(defautUri, source, result);
final String reply = new String(bytArrayOutputStream.toByteArray());
这篇关于如何从 webServiceTemplate 获取soap响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!