How to convert a string to a SOAPMessage in Java?

前端 未结 6 917
轻奢々
轻奢々 2020-12-23 21:38

I wonder is there any way to convert a string to SOAPMessage?

Let me say I have a string as follows:

String send = "

        
6条回答
  •  天命终不由人
    2020-12-23 22:24

    This way you can read from a file:

    byte[] encoded = Files.readAllBytes(Paths.get("C:/resources/soap/RequestFileReply.xml"));
    InputStream bStream = new ByteArrayInputStream(encoded);
    SOAPMessage request = MessageFactory.newInstance().createMessage(null, bStream);
    SOAPBody body = request.getSOAPBody();
    

提交回复
热议问题