'How to set the usr folder contents in JMeter for MQ testing

I am working on MQ testing with xml payloads in JMeter. In my scenario, i need to process the xml payload along with usr content details to MQ server.

I have tried to send that request details in request header using "SampleResult.setRequestHeaders("QueryName=GetPortfolio")" but it's not coming in MQ.

Functional team is using below xml payload to process the message in RFH utility, its automatically picking in rfh util under Usr field tab.

May i know how to set the usr field and replicate the same in JMeter. Currently i am getting user query is not updated properly error in database.

In below example, usr Queryname field is getting updated in Usr tab.

<usr>
<QueryName>XXXXX</QueryName>
</usr>
<p:Query
    xmlns:p="XXXXXXXX"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://XXXXXXXXlXXXXXXXX ">
  <p:QueryHeader>
    <p:QueryName>XXX</p:QueryName>
    <p:SystemName Country="XX">XXX</p:SystemName>
    <p:QueryCriteria type="ClientID">p:QueryCriteria</p:QueryCriteria>
    <p:XMLVersion>1.0</p:XMLVersion>
    <p:Language>p:Language</p:Language>
    <p:Extension/>
  </p:QueryHeader>
  <p:QueryBody>
    <p:IBAN>p:IBAN</p:IBAN>
  </p:QueryBody>
  <p:Extension/>
</p:Query>


Solution 1:[1]

I think you need to amend your code to use MQHeader class, something like:

MQMessage sendmsg = new MQMessage();
sendmsg.setStringProperty("QueryName", "GetPortfolio");

More information:

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Dmitri T