Posted: Thu Oct 14, 2010 12:53 pm Post subject: reading mqrfh2 header values and set into DataPower
Apprentice
Joined: 01 Sep 2010 Posts: 39
Hi,
In one of the scenario i have to read mqrfh2 header and take the value of of one the name value pair of usr folder and need to set in the context variables.
I have an mpg defined as MQ FSH and backend also mq. The client drops the msg with rfh2 header. My MQ FSH read the msg and parses the rfh2 header and takes the 'transId' of the usr folder and sets it in the context.
The configuration i have done in the MQ FSH is
Quote:
I have turned on Parse Header to on
Exclude Message Headers -- MQRFH and MQRFH2
content type-- MQRFH2
xpath-- /*[local-name()='MQRFH2']/*[local-name()='NameValueData']/*[local-name()='NameValue']/*[local-name()='usr']/*[local-name()='TransId']
In my processing rule, i have written the xsl, which will take this transId and sets into context variable.
Code:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:dp="http://www.datapower.com/extensions"
xmlns:date="http://exslt.org/dates-and-times"
xmlns:exsl="http://exslt.org/common"
xmlns:dpfunc="http://www.datapower.com/extensions/functions"
xmlns:dpconfig="http://www.datapower.com/param/config"
extension-element-prefixes="dp date exsl dpfunc dpconfig"
exclude-result-prefixes="dp date exsl dpfunc dpconfig">
<xsl:template match="/">
<!-- get the MQRFH2 header from the request message -->
<xsl:variable name="entries"
select="dp:request-header(’MQRFH2’)" />
<!-- parse into a usable nodeset -->
<xsl:variable name="header" select="dp:parse($entries)" />
<!-- store the desired values in a variable available for later -->
<xsl:variable name="transId" select="$header//NameValueData/NameValue/usr/TransId" />
<xsl:variable name="Format" select="$header//Format" />
<dp:set-variable name="'var://context/txn/msg-transid'"
value="$transId" />
</xsl:template>
</xsl:stylesheet>
I am getting error at dp:parse($entries).
var://local/_extension/error string 'dp:parse() error: Incomplete markup or missing document element at offset 0 of *dp:parse*'
this is fixing my issue. This xpath expression is setting the TransId value in the service variablevar://service/original-content-type
i am justing reading this one and set it into the context variable.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum