Topic
9 replies Latest Post - ‏2014-07-01T11:42:00Z by UlrikAndersen
Dave1963
Dave1963
23 Posts
ACCEPTED ANSWER

Pinned topic url-open() to MQ not creating RFH2 header

‏2011-08-09T04:07:50Z |
I have a style sheet that uses url-open() to put a message onto an MQ queue. The message is meant to have a MQRFH2 header with some user data. The message arrives on MQ OK, but the RFH2 header is missing. I set the MQMD header with a <Format> of MQRFH2, this works OK, browsing the output message on MQ shows this header value set.

My stylesheet below.... Would appreciate any advice on what I am doing wrong....


<xsl:template match=
"/"> <xsl:variable name=
"Constants" select=
"document('local:///Constants.xml')"/> <xsl:variable name=
"queueManagerName" select=
"normalize-space($Constants/Constants/MQInwardsServer/QueueManagerName)"/> <xsl:variable name=
"queueName" select=
"normalize-space($Constants/Constants/MQInwardsServer/QueueName)"/> <!-- Build the RFH2 header --> <xsl:variable name=
"rfh2Header"> <MQRFH2> <StrucId>RFH</StrucId> <Version>2</Version> <NameValueData> <NameValue> <usr> .....My user data goes here ..... </usr> </NameValue> </NameValueData> </MQRFH2> </xsl:variable> <!-- Build MQMD header --> <xsl:variable name=
"mqmdHeader"> <MQMD> <Format>MQRFH2</Format> </MQMD> </xsl:variable> <!-- Serialise RFH2 header --> <xsl:variable name=
"rfh2Serialised"> <dp:serialize select=
"$rfh2Header" omit-xml-decl=
"yes"/> </xsl:variable> <!-- Serialise MQMD header --> <xsl:variable name=
"mqmdSerialised"> <dp:serialize select=
"$mqmdHeader" omit-xml-decl=
"yes"/> </xsl:variable> <!-- Prepare the 

final header 

for use in url-open() --> <xsl:variable name=
"finalHeader"> <header name=
"MQMD"> <xsl:value-of select=
"$mqmdSerialised"/> </header> <header name=
"MQRFH2"> <xsl:value-of select=
"$rfh2Serialised"/> </header> </xsl:variable> <!-- Build the dpmq call --> <xsl:variable name=
"mqURL">dpmq:
//<xsl:value-of select="$queueManagerName"/>/?RequestQueue=<xsl:value-of select="$queueName"/></xsl:variable> <!-- Send the message via MQ --> <xsl:variable name=
"urlOpenResult"> <dp:url-open target=
"{$mqURL}"  http-headers=
"$finalHeader" response=
"responsecode-ignore"> <xsl:value-of select=
"."/> </dp:url-open> </xsl:variable> </xsl:template>
Updated on 2013-03-04T18:52:49Z at 2013-03-04T18:52:49Z by Kedar_Pulaparthi
  • Liv2luv
    Liv2luv
    573 Posts
    ACCEPTED ANSWER

    Re: url-open() to MQ not creating RFH2 header

    ‏2011-08-09T18:22:48Z  in response to Dave1963
    First:

    <MQMD>
       <!-- not MQRFH2 -->
       <Format>MQHRF2</Format>
    </MQMD>

    Second, after serializing the MQMD and RFH2 headers, try setting the header values as below. I am not sure if http-headers attribute of url-open would do the needed in this case :

    <dp:set-request-header name="'MQMD'" value="$mqmdHeader"/>
    <dp:set-request-header name="'MQRFH2'" value="$rfh2Header"/>

    Thanks.
    • Dave1963
      Dave1963
      23 Posts
      ACCEPTED ANSWER

      Re: url-open() to MQ not creating RFH2 header

      ‏2011-08-09T23:33:49Z  in response to Liv2luv
      Thankyou Liv2Luv,....

      It was the MQMD <Format>, I replaced with MQHRF2 and it works fine. I didn't need to use the dp:set-request-header.
      • Liv2luv
        Liv2luv
        573 Posts
        ACCEPTED ANSWER

        Re: url-open() to MQ not creating RFH2 header

        ‏2011-08-09T23:47:48Z  in response to Dave1963
        > I didn't need to use the dp:set-request-header.

        Thank you for letting us know.
  • SystemAdmin
    SystemAdmin
    6772 Posts
    ACCEPTED ANSWER

    Re: url-open() to MQ not creating RFH2 header

    ‏2012-04-11T22:23:22Z  in response to Dave1963
    Hello,
    similar to this i need MQPD header along with MQMD i made similar changes but it was not showing MQPD on the queue.
    below is my xsl
    
    <!-- Build the MQPD header --> <xsl:variable name=
    "mqpdHeader"> <MQPD> <StrucId>PD</StrucId> <Version>2</Version> <Property name=
    "CorrelationID" type=
    "String"><xsl:value-of select=
    "@id" /></Property> </MQPD> </xsl:variable> <!-- Build MQMD header --> <xsl:variable name=
    "mqmdHeader"> <MQMD> <Format>MQPD</Format> </MQMD> </xsl:variable> <!-- Serialise MQPD header --> <xsl:variable name=
    "mqpdSerialised"> <dp:serialize select=
    "$mqpdHeader" omit-xml-decl=
    "yes"/> </xsl:variable> <!-- Serialise MQMD header --> <xsl:variable name=
    "mqmdSerialised"> <dp:serialize select=
    "$mqmdHeader" omit-xml-decl=
    "yes"/> </xsl:variable> <!-- Prepare the 
    
    final header 
    
    for use in url-open() --> <xsl:variable name=
    "finalHeader"> <header name=
    "MQMD"> <xsl:value-of select=
    "$mqmdSerialised"/> </header> <header name=
    "MQPD"> <xsl:value-of select=
    "$mqpdSerialised"/> </header> </xsl:variable>   <xsl:variable name=
    "callud"> <dp:url-open target=
    "{$destinationurl}" response=
    "responsecode-ignore" http-headers=
    "$finalHeader"> <xsl:copy-of select=
    "$inputMessage" /> </dp:url-open> </xsl:variable>
    


    appreciate any kind of inputs
    • msiebler
      msiebler
      140 Posts
      ACCEPTED ANSWER

      Re: url-open() to MQ not creating RFH2 header

      ‏2012-04-11T23:59:13Z  in response to SystemAdmin
      To be honest I am not familiar w/ the MQPD format. I tried searching for that on the MQ IC but dind't find it; do you have a pointer? Thanks
      • swlinn
        swlinn
        1344 Posts
        ACCEPTED ANSWER

        Re: url-open() to MQ not creating RFH2 header

        ‏2012-04-15T17:22:13Z  in response to msiebler
        Don't you mean the MQMP header??

        Regards,
        Steve
  • Kedar_Pulaparthi
    Kedar_Pulaparthi
    3 Posts
    ACCEPTED ANSWER

    Re: url-open() to MQ not creating RFH2 header

    ‏2013-03-04T18:52:49Z  in response to Dave1963
    Thanks Dave1963 for the post. I was also looking for similar kind of functionality
    • abi_wipro
      abi_wipro
      72 Posts
      ACCEPTED ANSWER

      Re: url-open() to MQ not creating RFH2 header

      ‏2014-07-01T09:48:28Z  in response to Kedar_Pulaparthi

      Hi

      I am facing the same issue, I am trying to log a message to Queue, along with custom MQRFH2 Header through URL-OPEN. I followed this post. I am seeing MQRFH2 headers in my probe, but not seeing the same in my queue.  I have attached teh XSL I am using. I also tried with setting

      <dp:set-request-header name="'MQMD'" value="$mqmdHeader"/>
      <dp:set-request-header name="'MQRFH2'" value="$rfh2Header"/>. But In botht he approach I am seeing headers in Probe, but is not getting written to Queue.

      Please help on this.

      Attachments

      • UlrikAndersen
        UlrikAndersen
        174 Posts
        ACCEPTED ANSWER

        Re: url-open() to MQ not creating RFH2 header

        ‏2014-07-01T11:42:00Z  in response to abi_wipro

        Format in MQMD header must be MQHRF2 - NOT MQRFH2