JBoss Community

Re: How to modify SOAP body in JBoss 6.1.0. final?

created by Jim Ma in JBoss Web Services - View the full discussion

From the error stack trace, looks you are using jbossws-cxf stack to send message. Because jbossws-cxf uses different saaj implementation, soapFactory.newInstance().createElement() could create element with another document. Below is an example appendChild with the retrieved document from soapBody, it may help resolve your problem.  

 

SOAPMessage soapMessage = messagecontext.getMessage();
SOAPBody soapBody = soapMessage.getSOAPBody();
Node firstChild = soapBody.getFirstChild();
Document doc = firstChild.getOwnerDocument();
Node node1 = doc.createElementNS("http://www.foo.org", "bar");
node1.appendChild(doc.createTextNode("text"));
firstChild.appendChild(node1); 
soapMessage.saveChanges();

Reply to this message by going to Community

Start a new discussion in JBoss Web Services at Community