How to convert XML to SOAP on the Vordel Gateway
When you think about converting XML in general, it's natural to think
"use XSLT". But it's important to note that the Vordel Gateway actually
supports conversion of XML to SOAP out-of-the-box without having to
resort to using xslt. Simply use a "Set Message" with a SOAP Envelope
and inside the SOAP Body put a ${content.body} attribute and then the
incoming XML will be automatically placed into a SOAP envelope
on-the-fly. Like this:
...
and, as they say in the UK, "Bob's your uncle".
But if you want to do this using
an XSLT transformation, here is one you can use (import it using the
"Stylesheet Conversion" filter):
<?xml version="1.0"
encoding="UTF-8"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template
match="/">
<xsl:text disable-output-escaping="yes">
<</xsl:text>SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"<xsl:text
disable-output-escaping="yes">></xsl:text>
<xsl:text
disable-output-escaping="yes"><</xsl:text>SOAP-ENV:Body<xsl:text
disable-output-escaping="yes">></xsl:text>
<xsl:copy-of
select="*" />
<xsl:text
disable-output-escaping="yes"><</xsl:text>/SOAP-ENV:Body<xsl:text
disable-output-escaping="yes">></xsl:text>
<xsl:text
disable-output-escaping="yes"><</xsl:text>/SOAP-ENV:Envelope<xsl:text
disable-output-escaping="yes">></xsl:text>
</xsl:template>
</xsl:stylesheet>
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)




