DataPower

DataPower

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
  • 1.  Base64 encoding of MQ msg-body

    Posted 08/16/21 09:29 AM

    Hi'

    I want to base64 encode the context of the MQ msg-body - currenly using the following .xsl but it doesn't seem to encode the content as expected:

    <?xml version="1.0"?>

    <xsl:stylesheet version="1.0"

    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

    xmlns:env="http://www.w3.org/2003/05/soap-envelope"

    xmlns:dp="http://www.datapower.com/extensions"

    xmlns:dpconfig="http://www.datapower.com/param/config"

    xmlns:date="http://exslt.org/dates-and-times"

    extension-element-prefixes="dp date"

    exclude-result-prefixes="dp dpconfig date env">

    <xsl:output method="html"/>

    <xsl:template match="SOAP.ENV.Body">

    <xsl:variable name="encoding">

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

    </xsl:variable>

    <xsl:variable name="MsgBlock">

    <dp:serialize select="$encoding" omit-xml-decl="no" />

    </xsl:variable>

    <xsl:value-of select="dp:encode($MsgBlock,'base-64')"/>

    </xsl:template>

    </xsl:stylesheet>



    #DataPower
    #Support
    #SupportMigration


  • 2.  RE: Base64 encoding of MQ msg-body

    Posted 08/17/21 07:57 AM

    Hi,

    try to change the match condition, for example:

    <?xml version="1.0"?>

    <xsl:stylesheet version="1.0"

    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

    xmlns:env="http://www.w3.org/2003/05/soap-envelope"

    xmlns:dp="http://www.datapower.com/extensions"

    xmlns:dpconfig="http://www.datapower.com/param/config"

    xmlns:date="http://exslt.org/dates-and-times"

    extension-element-prefixes="dp date"

    exclude-result-prefixes="dp dpconfig date env">

    <xsl:output method="text"/>

    <xsl:template match="//*[local-name()='Body']">

    <xsl:variable name="encoding">

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

    </xsl:variable>

    <xsl:variable name="MsgBlock">

    <dp:serialize select="$encoding" omit-xml-decl="no" />

    </xsl:variable>

    <xsl:value-of select="dp:encode($MsgBlock,'base-64')"/>

    </xsl:template>

    </xsl:stylesheet>

    Also, you might be better of using text as output method.

    --HP



    #DataPower
    #Support
    #SupportMigration