Re: Problem with CDATA tags in SOAP message.
Hi, This is not a bug. This is due to c14n rules. Please refer to the CDATA information on this page - http://www.w3.org/TR/xml-c14n.html . Regards, Vinay Cardoza Vinay Cardoza wrote: Hi, I managed to isolate the problem. The problem vanishes when Rampart module is not engaged in axis2.xml. I can get the ![CDATA[ ]] intact. However, when I engage the rampart module, the CDATA tag is removed. I have used Rampart 1.4 , example 04. The steps to reproduce is shown below. 1. Download Rampart 1.4 from http://mirrors.enquira.co.uk/apache/ws/rampart/1_4/rampart-dist-1.4-bin.zip. 2. Extract it to d:\ 3. Ensure AXIS2_HOME is set to Axis2 1.4. Mine is d:\axis2-1.4. Ensure ANT_HOME and JAVA_HOME is set. 4. Open a command prompt. prompt cd D:\rampart-1.4\samples\ promptant -The above step will copy the rampart jars to AXIS2_HOME installation. prompt cd D:\rampart-1.4\samples\basic prompt ant service.04 5. Edit D:\rampart-1.4\samples\basic\sample04\src\org\apache\rampart\samples\sample04\Client.java Add the imports. import org.apache.axiom.om.impl.llom.OMTextImpl; import javax.xml.stream.XMLStreamConstants; In getPayload(), replace childElem.setText(value); with OMTextImpl omText = (OMTextImpl) childElem.getOMFactory().createOMText(childElem,value,XMLStreamConstants.CDATA); Save the file. 5. Open another DOS prompt. prompt cd D:\rampart-1.4\samples\basic prompt ant client.04 Observe the SOAP request using TCP Monitor. soapenv:Body xmlns:wsu=http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd; wsu:Id=id-22584918 ns1:echo xmlns:ns1=http://sample04.samples.rampart.apache.org; param0Hello world/param0 /ns1:echo /soapenv:Body The CDATA tag is not present. 6. Edit D:\rampart-1.4\samples\basic\sample04\client.axis2.xml. Remove the line module ref=rampart / and save the file. 7. Repeat the step 5 and observe the SOAPBody in TCP Monitor. soapenv:Bodyns1:echo xmlns:ns1=http://sample04.samples.rampart.apache.org; param0![CDATA[Hello world]]/param0 /ns1:echo/soapenv:Body The CDATA tag is intact. Please advice. Regards, Vinay Cardoza Vinay Cardoza wrote: Hi Saliya, I have also tried Axis 1.4.1 and 1.4. The CDATA is always escaped. If you can point where is the Axis2 snapshot is located, then I will try that. Regards, Vinay Cardoza Saliya Ekanayake wrote: Hi, I tested this using Axis2 nightly build but couldn't recreate your issue. I mean, it works fine. If you can please try with Axis2 Snapshot. Thanks, Saliya On Wed, Sep 17, 2008 at 9:03 PM, Vinay Cardoza [EMAIL PROTECTED]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 = 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-1129 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. 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-with-CDATA-tags-in-SOAP-message.-tp19534836p19534836.html Sent from the Axis - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Saliya Ekanayake http://www.esaliya.blogspot.com http://www.esaliya.wordpress.com -- View this message in context: http://www.nabble.com/Problem-with-CDATA-tags-in-SOAP-message.-tp19534836p19823664.html Sent from the Axis - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problem with CDATA tags in SOAP message.
Hi, I managed to isolate the problem. The problem vanishes when Rampart module is not engaged in axis2.xml. I can get the ![CDATA[ ]] intact. However, when I engage the rampart module, the CDATA tag is removed. I have used Rampart 1.4 , example 04. The steps to reproduce is shown below. 1. Download Rampart 1.4 from http://mirrors.enquira.co.uk/apache/ws/rampart/1_4/rampart-dist-1.4-bin.zip. 2. Extract it to d:\ 3. Ensure AXIS2_HOME is set to Axis2 1.4. Mine is d:\axis2-1.4. Ensure ANT_HOME and JAVA_HOME is set. 4. Open a command prompt. prompt cd D:\rampart-1.4\samples\ promptant -The above step will copy the rampart jars to AXIS2_HOME installation. prompt cd D:\rampart-1.4\samples\basic prompt ant service.04 5. Edit D:\rampart-1.4\samples\basic\sample04\src\org\apache\rampart\samples\sample04\Client.java Add the imports. import org.apache.axiom.om.impl.llom.OMTextImpl; import javax.xml.stream.XMLStreamConstants; In getPayload(), replace childElem.setText(value); with OMTextImpl omText = (OMTextImpl) childElem.getOMFactory().createOMText(childElem,value,XMLStreamConstants.CDATA); Save the file. 5. Open another DOS prompt. prompt cd D:\rampart-1.4\samples\basic prompt ant client.04 Observe the SOAP request using TCP Monitor. soapenv:Body xmlns:wsu=http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd; wsu:Id=id-22584918 ns1:echo xmlns:ns1=http://sample04.samples.rampart.apache.org; param0Hello world/param0 /ns1:echo /soapenv:Body The CDATA tag is not present. 6. Edit D:\rampart-1.4\samples\basic\sample04\client.axis2.xml. Remove the line module ref=rampart / and save the file. 7. Repeat the step 5 and observe the SOAPBody in TCP Monitor. soapenv:Bodyns1:echo xmlns:ns1=http://sample04.samples.rampart.apache.org; param0![CDATA[Hello world]]/param0 /ns1:echo/soapenv:Body The CDATA tag is intact. Please advice. Regards, Vinay Cardoza Vinay Cardoza wrote: Hi Saliya, I have also tried Axis 1.4.1 and 1.4. The CDATA is always escaped. If you can point where is the Axis2 snapshot is located, then I will try that. Regards, Vinay Cardoza Saliya Ekanayake wrote: Hi, I tested this using Axis2 nightly build but couldn't recreate your issue. I mean, it works fine. If you can please try with Axis2 Snapshot. Thanks, Saliya On Wed, Sep 17, 2008 at 9:03 PM, Vinay Cardoza [EMAIL PROTECTED]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 = 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-1129 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. 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-with-CDATA-tags-in-SOAP-message.-tp19534836p19534836.html Sent from the Axis - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Saliya Ekanayake http://www.esaliya.blogspot.com http://www.esaliya.wordpress.com -- View this message in context: http://www.nabble.com/Problem-with-CDATA-tags-in-SOAP-message.-tp19534836p19569416.html Sent from the Axis - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problem with CDATA tags in SOAP message.
Hi Saliya, I have also tried Axis 1.4.1 and 1.4. The CDATA is always escaped. If you can point where is the Axis2 snapshot is located, then I will try that. Regards, Vinay Cardoza Saliya Ekanayake wrote: Hi, I tested this using Axis2 nightly build but couldn't recreate your issue. I mean, it works fine. If you can please try with Axis2 Snapshot. Thanks, Saliya On Wed, Sep 17, 2008 at 9:03 PM, Vinay Cardoza [EMAIL PROTECTED]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 = 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-1129 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. 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-with-CDATA-tags-in-SOAP-message.-tp19534836p19534836.html Sent from the Axis - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Saliya Ekanayake http://www.esaliya.blogspot.com http://www.esaliya.wordpress.com -- View this message in context: http://www.nabble.com/Problem-with-CDATA-tags-in-SOAP-message.-tp19534836p19548996.html Sent from the Axis - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problem with CDATA tags in SOAP message.
Hi, I tested this using Axis2 nightly build but couldn't recreate your issue. I mean, it works fine. If you can please try with Axis2 Snapshot. Thanks, Saliya On Wed, Sep 17, 2008 at 9:03 PM, Vinay Cardoza [EMAIL PROTECTED]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 = 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-1129 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. 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-with-CDATA-tags-in-SOAP-message.-tp19534836p19534836.html Sent from the Axis - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Saliya Ekanayake http://www.esaliya.blogspot.com http://www.esaliya.wordpress.com