java - How to add CDATA section to SOAPMessage using SAAJ? -


I'm trying to add a CDAT section using a soap message (axis2-saaj-1.5.4) I am I have an XML document that I want to define as a CDAT section and want to put it inside a element inside a soap document ... something like that (though it causes compiler errors) :

  element cdataElem = doc.createElement ("cdata"); CDATATION CDATA = Doc.Creative CDATxation (XMLDCestestString); CdataElem.appendChild (cdata); SOAPMessage Message = Factory. Message Sentence (); . SoapMessage.getSOAPBody () addChildElement (cdataElem);   

I can not find a way to do this properly and I'm sure it should be simple ... can anyone help?

Thanks

I had a similar problem. Finally I found a solution using the decoration:

  SOAPMessage message = factory.createMessage (); . Message.getSOAPBody () addChildElement (message.getSOAPpart () createCDATASection (xmlDocAsString).);   

Apparently SOAPPart acts as a DOM doctor.

Comments