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

Reply via email to