Re: add DOM Document to SOAP Body (JAXM)
Posted By:
Sharath_Jonnalagadda
Posted On:
Thursday, April 18, 2002 02:21 AM
hai moses,
here is one such solution.
imagine sMessage as JAXM's SOAPMessage Classes object.
and imagine doc1 is the xml document which u have to add to the soap message
import org.dom4j.*;
DocumentSource source = (DocumentSource)
sMessage.getSOAPPart().getContent();
Document doc = source.getDocument();
Element elem = doc.getRootElement();
List elements = elem.elements();
Element body = elements.get(elements.size() -1);
body.addChildElement(doc1.getRootElement());
DocumentSource dSource = new DocumentSource(doc1);
sMessage.getSOAPPart().setContent(dSource);
sMessage.saveChanges();
sMessage.writeTo(System.out);
these steps should do the magic for u.
cheers
sharath.
Re: add DOM Document to SOAP Body (JAXM)
Posted By:
vikas_pandya
Posted On:
Thursday, April 4, 2002 10:45 AM
If you want to send xml document using SOAP(utilizing JAXM) then i would say easiest way to achieve this is using JAXM attachment (AttachmentPart API). pretty neat and clean way of sending documents as SOAP attachment.