mardi 19 juillet 2016

How to insert XML into soap header in Java

Is there a clean way (no string concatenation) to insert an XML document into a soap header? I used JAXB to compile schemas and now i need to wrap it in soap envelope. for the body i used:

SOAPMessage soapMessage = MessageFactory.newInstance().createMessage();
soapMessage.getSOAPBody().addDocument(userDataDocument);

now for the header i also need to add a document, but the API does not have an

addDocument

Previously i used string concatenation, which is easy but not the most flexible way in my mind. I am not just adding a single Qname but a whole XML doc. Is there any way to accomplish this?

Aucun commentaire:

Enregistrer un commentaire