Hi, I tried the standard way which is as follows: OMTextImpl omText = (OMTextImpl) childElem.getOMFactory().createOMText(elementWhichNeedsCData,"A'B'C'D",XMLStreamConstants.CDATA);
When I do a omText.getText() or elementWhichNeedsCData.toString(), I can see the <![CDATA[ ]]> created automatically. However, <![CDATA[ ]]> is stripped when I see the SOAP request in the TCP Monitor as shown below. <soapenv:Body xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="Id-17777129"> <s1:EdiCustomsDeclaration xmlns:s1="http://www.examples.com/schemas/custom/edi/v1"> A'B'C'D </s1:EdiCustomsDeclaration> </soapenv:Body></soapenv:Envelope> Regards, Vinay Cardoza Vinay Cardoza wrote: > > Hi, > I am trying to send a SOAP request using Apache Axis 1.3. An element > in the SOAP body requires the text to be wrapped in CDATA element. > > The code snippet is as follows: > > String stringToBeWrapped = "<![CDATA[" + "A'B'C'D" +"]]>"; > > OMElement elementWhichNeedsCData = ....; > > TextImpl omText = (TextImpl) > bodyElement.getOMFactory().createOMText(stringToBeWrapped); > omText.setType(XMLStreamConstants.CDATA); > elementWhichNeedsCData.addChild(omText); > > The code compiles without any problems. However the SOAP request is as > follows: > > <soapenv:Body > xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" > wsu:Id="Id-17777129"> > <s1:EdiCustomsDeclaration > xmlns:s1="http://www.examples.com/schemas/custom/edi/v1"> > &lt;![CDATA[A'B'C'D]]&gt; > </s1:EdiCustomsDeclaration> > </soapenv:Body></soapenv:Envelope> > > The CDATA text element has &gt; and &lt; escape characters. > > When I print the omText value, I can see the CDATA construct intact. But > the SOAP message shows something else. > > The problem is replicated in Axis 1.3, 1.4 and 1.4.1. > > How do I prevent escape characters from appearing in the CDATA construct? > Please help. > > Regards, > Vinay Cardoza > > > -- View this message in context: http://www.nabble.com/Problem-in-rendering-CDATA-tag.-tp19551580p19553595.html Sent from the Axis - Dev mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
