If you use a SFTP front side handler, you can use this styleSheet (you have to use Transform binary action)
- This xslt below parse the input context into binary node and send it to the backend
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dp="http://www.datapower.com/extensions" xmlns:regexp="http://exslt.org/regular-expressions" extension-element-prefixes="dp regexp" exclude-result-prefixes="dp regexp" version="1.0">
<dp:input-mapping href="store:///pkcs7-convert-input.ffd" type="ffd"/>
<xsl:template match="/">
<xsl:variable name="FrontsideFTP" select="dp:variable('var://service/URL-in')"/>
<xsl:variable name="Filename" select="regexp:match($FrontsideFTP, '([^\/]*)$')"/>
<xsl:variable name="Filename2" select="substring-before($Filename,'?Rename')"/>
<xsl:variable name="BacksideFTP" select="concat('sftp://admin:Passxxxx/home/admin/File/FTP/',$Filename2)"/>
<dp:set-variable name="'var://service/routing-url'" value="$BacksideFTP"/>
<xsl:message dp:priority="debug">OId URL: <xsl:value-of select="$FrontsideFTP"/>
</xsl:message>
<xsl:message dp:priority="debug">Filename: <xsl:value-of select="$Filename"/>
</xsl:message>
<xsl:message dp:priority="debug">Filename2: <xsl:value-of select="$Filename2"/>
</xsl:message>
<xsl:message dp:priority="debug">New URL: <xsl:value-of select="$BacksideFTP"/>
</xsl:message>
<xsl:copy-of select="*"/>
<xsl:variable name="response">
<dp:url-open target="{$BacksideFTP}" response="ignore" data-type="base-64">
<xsl:value-of select="dp:binary-encode(/object/message/node())"/>
</dp:url-open>
</xsl:variable>
<xsl:message dp:priority="error">responseL: <xsl:value-of select="$response"/>
</xsl:message>
<xsl:variable name="encdata" select="dp:binary-encode($Filename2)"/>
<xsl:message dp:priority="error">encdata: <xsl:value-of select="$encdata"/>
</xsl:message>
</xsl:template>
</xsl:stylesheet>
- This xslt below parse the input context into binary node and send it to the backend in base64 format
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dp="http://www.datapower.com/extensions" xmlns:regexp="http://exslt.org/regular-expressions" extension-element-prefixes="dp regexp" exclude-result-prefixes="dp regexp" version="1.0">
<dp:input-mapping href="store:///pkcs7-convert-input.ffd" type="ffd"/>
<xsl:template match="/">
<xsl:variable name="FrontsideFTP" select="dp:variable('var://service/URL-in')"/>
<xsl:variable name="Filename" select="regexp:match($FrontsideFTP, '([^\/]*)$')"/>
<xsl:variable name="Filename2" select="substring-before($Filename,'?Rename')"/>
<xsl:variable name="BacksideFTP" select="concat('sftp://admin:Passxxxx/home/admin/File/FTP/',$Filename2)"/>
<dp:set-variable name="'var://service/routing-url'" value="$BacksideFTP"/>
<xsl:message dp:priority="debug">OId URL: <xsl:value-of select="$FrontsideFTP"/>
</xsl:message>
<xsl:message dp:priority="debug">Filename: <xsl:value-of select="$Filename"/>
</xsl:message>
<xsl:message dp:priority="debug">Filename2: <xsl:value-of select="$Filename2"/>
</xsl:message>
<xsl:message dp:priority="debug">New URL: <xsl:value-of select="$BacksideFTP"/>
</xsl:message>
<xsl:copy-of select="*"/>
<xsl:variable name="response">
<dp:url-open target="{$BacksideFTP}" response="ignore">
<xsl:value-of select="dp:binary-encode(/object/message/node())"/>
</dp:url-open>
</xsl:variable>
<xsl:message dp:priority="error">responseL: <xsl:value-of select="$response"/>
</xsl:message>
<xsl:variable name="encdata" select="dp:binary-encode($Filename2)"/>
<xsl:message dp:priority="error">encdata: <xsl:value-of select="$encdata"/>
</xsl:message>
</xsl:template>
</xsl:stylesheet>
#DataPower#Support#SupportMigration