synapse-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hira...@wso2.com
Subject Re: Interesting problem introduced by CDATA section
Date Fri, 28 Mar 2008 04:23:49 GMT
Hi,

I guess the culprit is AXIOM (see [1]). It doesn't handle CDATA elements
very well. I encountered similar issues when developing the FIX transport
module for Synapse. But fortunately for me I could take care of the
problem at the transport level itself.

Thanks

Best Regards,
Hiranya Jayathilaka

[1] https://issues.apache.org/jira/browse/WSCOMMONS-305)




> I suppose one horrible hack I could employ would be to use a Ruby script
> or
> Java class to post it as a regular HTTP post and then simply not specify a
> send element so that it doesn't get posted from Synapse?
>
> jeff
>
> On Thu, Mar 27, 2008 at 9:25 AM, Jeff Davis <jdavis@idalica.com> wrote:
>
>> I played around with a jRuby script that adds the CDATA segment back,
>> but
>> unfortunately, when the XML is sent out, it again resorts to the other
>> behavior (this is probably an obvious thing to you guys,but I'm not as
>> familiar with the inner workings of Synapse). It sounds like I might be
>> out
>> of luck here, and as someone pointed earlier, it's not an issue with
>> Synapse, per se, but an erroneously design web service.
>>
>> I take it there is no way to send back a "raw" request, whereby no XML
>> processing is done (basically posts a string, as-is).
>>
>> jeff
>>
>>
>> On Thu, Mar 27, 2008 at 8:51 AM, Paul Fremantle <pzfreo@gmail.com>
>> wrote:
>>
>> > 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 <pzfreo@gmail.com>
>> > Date: Thu, Mar 27, 2008 at 2:19 PM
>> > Subject: Re: Interesting problem introduced by CDATA section
>> > To: user@synapse.apache.org
>> >
>> >
>> > 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 <jdavis@idalica.com>
>> 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
>> <upulg.dev@gmail.com>
>> > 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 &lt; 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 <jdavis@idalica.com>
>> > 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>
>> >  >  > >            &lt;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#">
>> >  >  > >            &lt;test>
>> >  >  > >            &lt;info>this is a test&lt;/info>
>> >  >  > >            &lt;/test></env:payload>
>> >  >  > >    </env:Packet>
>> >  >  > > </env:Envelope>
>> >  >  > >
>> >  >  > > Notice the CDATA section has disappeared, and the unwanted
>> &lt;
>> > 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="&lt;" string="&lt;"
/>
>> >  >  > >        <xsl:output-character character="&gt;" string="&gt;"
/>
>> >  >  > >        <xsl:output-character character="&#xD;" string="&#xD;"
>> />
>> >  >  > >        <xsl:output-character character="&#47;" string="&#47;"
>> />
>> >  >  > >        <xsl:output-character character="&#xE0F1;"
>> >  >  > string="&lt;![CDATA["/>
>> >  >  > >        <xsl:output-character character="&#xE0F2;"
>> 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: jeffdavis_ca@hotmail.com
>> >  >  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
>> >  paul@wso2.com
>> >
>> >  "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
>> > paul@wso2.com
>> >
>> > "Oxygenating the Web Service Platform", www.wso2.com
>> >
>>
>>
>>
>> --
>> Jeff Davis
>> Senior Architect
>> Idalica Corporation
>> MSN: jeffdavis_ca@hotmail.com
>> 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.
>>
>
>
>
> --
> Jeff Davis
> Senior Architect
> Idalica Corporation
> MSN: jeffdavis_ca@hotmail.com
> 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.
>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@synapse.apache.org
For additional commands, e-mail: dev-help@synapse.apache.org


Mime
View raw message