How to convert XML to SOAP on the Vordel Gateway
Join the DZone community and get the full member experience.
Join For FreeWhen 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>
Published at DZone with permission of Mark O'Neill, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.
Trending
-
How To Scan and Validate Image Uploads in Java
-
Five Java Books Beginners and Professionals Should Read
-
DevOps Midwest: A Community Event Full of DevSecOps Best Practices
-
Database Integration Tests With Spring Boot and Testcontainers
Comments