Is there a way we can create a mediator that reconverts back to a CDATA? I've played around a bit with Axiom, but it seems a little tricky to force CDATA.
Paul ---------- Forwarded message ---------- From: Paul Fremantle <[EMAIL PROTECTED]> Date: Thu, Mar 27, 2008 at 2:19 PM Subject: Re: Interesting problem introduced by CDATA section To: [EMAIL PROTECTED] Jeff The annoying answer is that the service is wrong - its an XML error to differentiate between those two XMLs. However, we'll see if there is a way to sort this out. Paul On Thu, Mar 27, 2008 at 4:28 AM, Jeff Davis <[EMAIL PROTECTED]> wrote: > Well, the problem is that the web service receiving the request validates > it, and they have it setup on their side so that if the CDATA isnt' present, > the service call fails because of validation errors. I have to have that > present or it won't work (it's a partner's service). > > jeff > > > > On Wed, Mar 26, 2008 at 10:05 PM, Upul Godage <[EMAIL PROTECTED]> wrote: > > > Content wise there is no difference between CDATA sections and the > > resultant > > escaped text data. < cannot be in parsed character data so it is > > converted > > to < so it is not mixed up with element starting elements. I think when > > reading from the parser, default parser does not make a difference between > > the CDATA sections and the normal text sections and the Synapse sees them > > as > > just normal text. So the significance of CDATA markers are dropped when it > > is parsed. Only the serialized form changes but the "content remains > > exactly > > the same." > > > > Do you face a problem when not having it in the extact CDATA form? > > > > Upul > > > > > > > > On Thu, Mar 27, 2008 at 8:07 AM, Jeff Davis <[EMAIL PROTECTED]> wrote: > > > > > I'm attempting to access a SOAP web service that, unfortunately, uses a > > > CDATA section within the body of the XML (this wasn't my choosing, :-). > > > The > > > abbreviated XML looks like: > > > > > > <env:Envelope xmlns:env="http://www.xxx.com/hrit/envelope" > > > xmlns:hrxml="http://ns.hr-xml.org/2004-08-02" > > > xmlns:datetime="http://exslt.org/dates-and-times"> > > > <env:Sender> > > > <env:id>test</env:id> > > > </env:Sender> > > > > > > <env:Packet> > > > <env:PacketInfo packetType="data"> > > > <env:packetId>1</env:packetId> > > > </env:PacketInfo> > > > <env:payload><![CDATA[ > > > <Candidate xmlns="http://ns.hr-xml.org/2004-08-02" > > > > <test> > > > <info>this is a test</info> > > > </test>]]></env:payload> > > > </env:Packet> > > > </env:Envelope> > > > > > > The issue I encounter is that, when this is sent out by Synapse, it > > > appears > > > as (not showing the soap wrapper): > > > > > > <env:Envelope xmlns:hrxml="http://ns.hr-xml.org/2004-08-02" > > > xmlns:datetime=" > > > http://exslt.org/dates-and-times"> > > > <env:Sender> > > > <env:id>test</env:id> > > > </env:Sender> > > > > > > <env:Packet> > > > <env:PacketInfo packetType="data"> > > > <env:packetId>1</env:packetId> > > > </env:PacketInfo> > > > <env:payload> > > > <Candidate xmlns="http://ns.hr-xml.org/2004-08-02" > > > xmlns:oa=" > > > http://www.openapplications.org/oagis" xmlns:ds=" > > > http://www.w3.org/2000/09/xmldsig#"> > > > <test> > > > <info>this is a test</info> > > > </test></env:payload> > > > </env:Packet> > > > </env:Envelope> > > > > > > Notice the CDATA section has disappeared, and the unwanted < appear > > in > > > lieu of the < within that. Researching the issue a bit, I discovered > > this > > > is > > > the expected behavior from Saxon (which I believe is the XSTL being used > > > by > > > Synapse). I can reproduce this if I just use a blank stylesheet. Now, if > > I > > > apply this stylesheet and run it through Saxon manually, it works great: > > > > > > <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > > version=" > > > 2.0" xmlns:env="http://www.xxx.com/hrit/envelope"> > > > <xsl:output use-character-maps="xml" > > > cdata-section-elements="env:payload"/> > > > <xsl:character-map name="xml"> > > > <xsl:output-character character="<" string="<" /> > > > <xsl:output-character character=">" string=">" /> > > > <xsl:output-character character="
" string="
" /> > > > <xsl:output-character character="/" string="/" /> > > > <xsl:output-character character="" > > string="<![CDATA["/> > > > <xsl:output-character character="" string="]]>"/> > > > </xsl:character-map> > > > > > > <xsl:template match="/'"> > > > <xsl:copy-of select="*" /> > > > </xsl:template> > > > > > > </xsl:stylesheet> > > > > > > Unfortunately, when I plugin this stylesheet into the Synapse <in> > > route, > > > it > > > has no apparent affect (I twiddled with it to make sure it was, in fact, > > > being used, and it was). > > > > > > This is leaving me with a real quandary -- any suggestions? > > > > > > jeff > > > > > > > > > -- > Jeff Davis > Senior Architect > Idalica Corporation > MSN: [EMAIL PROTECTED] > Skype: jeffdavis_ca > Phone: 719-287-8656 > Enabling Business Through Open Source Technologies > www.idalica.com > > IMPORTANT: This electronic message is for exclusive use by the person(s) to > whom it is addressed, and may contain information that is confidential or > privileged and exempt from disclosure under applicable law. If you are not > an intended recipient, please be aware that any disclosure, dissemination, > distribution or copying of this communication, or the use of its contents, > is prohibited. If you have received this message in error, please > immediately notify the sender of your inadvertent receipt and delete this > message from all data storage systems. > -- Paul Fremantle Co-Founder and VP of Technical Sales, WSO2 Apache Synapse PMC Chair OASIS WS-RX TC Co-chair blog: http://pzf.fremantle.org [EMAIL PROTECTED] "Oxygenating the Web Service Platform", www.wso2.com -- Paul Fremantle Co-Founder and VP of Technical Sales, WSO2 Apache Synapse PMC Chair OASIS WS-RX TC Co-chair blog: http://pzf.fremantle.org [EMAIL PROTECTED] "Oxygenating the Web Service Platform", www.wso2.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
