将StreamResult转换为字符串或XML。

7 浏览
0 Comments

将StreamResult转换为字符串或XML。

使用Spring WS获取StreamResult的内容如下:

StreamSource source = new StreamSource(new StringReader(MESSAGE));
StreamResult result = new StreamResult(System.out);
webServiceTemplate.sendSourceAndReceiveToResult("http://someUri",
                source, new SoapActionCallback("someCallBack"), result); 
return result;

我得到了结果,但我想将它提取为某种形式的XML,甚至作为一个字符串(只是想看到内容以生成响应)。我该如何做到这一点?

0