Convert StreamResult to string or xml

前端 未结 4 1603
滥情空心
滥情空心 2021-02-02 08:18

Using spring ws to get the StreamResult as below

StreamSource source = new StreamSource(new StringReader(MESSAGE));
StreamResult result = new StreamResult(System         


        
4条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-02 08:49

    You can get the reader of your StreamSource by using getReader(). You should then be able to use read(char[] cbuf) to write the contents of the stream to a character array which can easily be converted into a string and printed to the console if you wish.

提交回复
热议问题