IBM Support

DataPower does not inject MQMD.CorrelId in fault message in error rule when request MQMD.CorrelId contains non-zero values for the traffic pattern of MQ-to-HTTP

Technote (troubleshooting)


Problem(Abstract)

When the traffic flow contains MQ-to-HTTP, DataPower injects request.MQMD.MsgId to response.MQMD.CorrelId for the front MQ client. However, when request.MQMD.CorrelId contains non-zero values (The standard is to contain 48 zeros) , DataPower does not inject request.MQMD.MsgId to response.MQMD.CorrelId in the error rule. Rather, it preserves the request.MQMD.CorrelId value in the fault.MQMD.CorrelId field in the error rule.

Symptom

The response.MQMD.CorrelId will contain request.MQMD.CorrelId which may cause the consuming application to fail processing the reply message from DataPower.


Resolving the problem

When the traffic pattern contains MQ-ro-HTTP, DataPower automatically injects request.MQMD.MsgId to response.MQMD.CorrelId to make the message a valid response for the response rule. However, if the client application provides non-zero values in the request.MQMD.CorrelId, DataPower will preserve that value in the MQMD.CorrelId for the error rule when sending custom fault message to the client. This is working as designed.

If the consuming application needs the value of request.MQMD.Msgid to satisfy the condition such as response.MQMD.CorrelId = request.MQMD.Msgid, custom stylesheet can be used in the error rule to achieve this.

The following code snippets show how to inject request.MQMD.MsgId to MQMD.CorrelId of the fault message to the client:


<?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"
extension-element-prefixes="dp"
exclude-result-prefixes="dp" version="1.0">

<xsl:output method="xml"/>
<xsl:template match="/">

<xsl:variable name="entries" select="dp:request-header('MQMD')"/>
<xsl:variable name="mqmd-headers" select="dp:parse($entries)"/>
<xsl:variable name="CorrelId-RQ" select="$mqmd-headers//CorrelId"/>
<xsl:variable name="MsgId-RQ" select="$mqmd-headers//MsgId"/>

<xsl:message dp:priority="debug">
<xsl:value-of select="concat('The Request MQMD : ', $entries)"/>
</xsl:message>

<xsl:variable name="current-headers" select="$mqmd-headers"/>
<xsl:variable name="MQMDStr">
<MQMD>
<xsl:for-each select="$current-headers/MQMD/*[local-name()]">
<xsl:variable name="header-name" select="local-name()"/>
<xsl:choose>
<xsl:when test="((normalize-space($header-name) = 'CorrelId') and
($CorrelId-RQ != '000000000000000000000000000000000000000000000000'))">
<xsl:element name="CorrelId">
<xsl:value-of select="$MsgId-RQ"/>
</xsl:element>
</xsl:when>
<xsl:otherwise>
<xsl:element name="{$header-name}">
<xsl:value-of select="."/>
</xsl:element>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</MQMD>
</xsl:variable>
<xsl:variable name="MQMDStr2">
<dp:serialize select="$MQMDStr" omit-xml-decl="yes"/>
</xsl:variable>
<dp:set-response-header name="'MQMD'" value="$MQMDStr2"/>
</xsl:template>
</xsl:stylesheet>


Document information

More support for: WebSphere DataPower Integration Appliance XI52

Software version: 4.0.2, 5.0.0, 6.0.0, 6.0.0.1, 6.0.1

Operating system(s): Firmware

Software edition: All Editions

Reference #: 1659381

Modified date: 03 March 2014