I have a business requirement to:
- Put the "Request" tag and child nodes into CDATA or xml string. put in arg0 element
- Concat
<Request>
node and value from<Checkword>
, then do an MD5 to it. put in arg1
I was able to do the 1st. But I don't have a clue how to do the 2nd.
here's the sample XML
<?xml version="1.0" encoding="UTF-8"?>
<ns0:MT_AddressValidation_Req><Request service="OrderFilterService" lang="zh-CN">
<Head>BSPdevelop</Head>
<Body>
<OrderFilter d_address="address"></OrderFilter>
</Body>
</Request>
<Checkword>f2209jdlwne1Q=</Checkword>
</ns0:MT_AddressValidation_Req>
So far with the XSLT I did, here is the output. my problem is the md5 encryption for arg1. I am still thinking of what to do with it.
XSLT output
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://service.expressservice.integration.sf.com/"><soapenv:Header/>
<soapenv:Body>
<ser:sfexpressService>
<arg0><![CDATA[<Request lang="zh-CN" service="OrderFilterService"><Head>BSPdevelop</Head><Body><OrderFilter d_address="address"/></Body></Request>]]></arg0>
<arg1></arg1>
</ser:sfexpressService>
</soapenv:Body>
</soapenv:Envelope>
Code
<xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="no" omit-xml-declaration="yes"/>
<xsl:template match="/">
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://service.expressservice.integration.sf.com/">
<soapenv:Header/>
<soapenv:Body>
<ser:sfexpressService>
<arg0>
<xsl:text disable-output-escaping="yes"><![CDATA[</xsl:text>
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
<xsl:text disable-output-escaping="yes">]]></xsl:text>
</arg0>
<arg1></arg1>
</ser:sfexpressService>
</soapenv:Body>
</soapenv:Envelope>
</xsl:template>
<xsl:template match="/*">
<xsl:copy-of select="Request"/>
</xsl:template>
</xsl:transform>
expect is that in arg1, I will be able to get the MD5 hash
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://service.expressservice.integration.sf.com/"><soapenv:Header/>
<soapenv:Body>
<ser:sfexpressService>
<arg0><![CDATA[<Request lang="zh-CN" service="OrderFilterService"><Head>BSPdevelop</Head><Body><OrderFilter d_address="address"/></Body></Request>]]></arg0>
<arg1>1309740fa1e193</arg1>
</ser:sfexpressService>
</soapenv:Body>
</soapenv:Envelope>