Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

How to convert XML to SOAP on the Vordel Gateway

DZone's Guide to

How to convert XML to SOAP on the Vordel Gateway

· Cloud Zone
Free Resource

Site24x7 - Full stack It Infrastructure Monitoring from the cloud. Sign up for free trial.

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">
&lt;</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">&gt;</xsl:text>
<xsl:text disable-output-escaping="yes">&lt;</xsl:text>SOAP-ENV:Body<xsl:text disable-output-escaping="yes">&gt;</xsl:text>

<xsl:copy-of select="*" />

<xsl:text disable-output-escaping="yes">&lt;</xsl:text>/SOAP-ENV:Body<xsl:text disable-output-escaping="yes">&gt;</xsl:text>
<xsl:text disable-output-escaping="yes">&lt;</xsl:text>/SOAP-ENV:Envelope<xsl:text disable-output-escaping="yes">&gt;</xsl:text>
</xsl:template>

</xsl:stylesheet>

Site24x7 - Full stack It Infrastructure Monitoring from the cloud. Sign up for free trial.

Topics:

Published at DZone with permission of Mark O'Neill, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}