Hi @Mark Taylor,
I wanted to ask about your statement above that says this:-
a) The RFH2 is not something to hold arbitrary XML - no matter how short. It is purely for holding properties.
This statement surprised me because I don't consider, as an example, items in the <psc> folder in an MQRFH2 to be message properties. In fact you are explicitly warned in IBM Docs not to set content='properties' on the <psc> folder (which would force it to be treated as message properties) because that would likely stop Message Broker from working.
In fact the whole of that page in IBM Docs reads as if you can have any folder you like, and so long as it is not a recognised folder that MQ treats as properties, and you have not set content='properties' on folder, then the contents would very much not be treated as properties.
Can you clarify this statement please?
Cheers,
Morag
------------------------------
Morag Hughson
MQ Technical Education Specialist
MQGem Software Limited
Website:
https://www.mqgem.com------------------------------
Original Message:
Sent: Thu September 12, 2024 09:02 AM
From: Mark Taylor
Subject: Adding MQRFH2 headers to MQMessage in C#
a) The RFH2 is not something to hold arbitrary XML - no matter how short. It is purely for holding properties.
b) There is very rarely any reason to construct an RFH2 in application code. Instead, use the Property APIs (setProperty in the .Net classes). Those are much simpler, and are equivalent and interchangeable. The receiving app will still see an RFH2 if it is setup that way.
------------------------------
Mark Taylor
Winchester
Original Message:
Sent: Thu September 12, 2024 03:42 AM
From: Bojan Bojan
Subject: Adding MQRFH2 headers to MQMessage in C#
Hello Francois
I am trying to enter custom short XML that I have created into HRF2 Header, I have two of those XMLs and both of them need to go into the RFH2 header.
I have tried to do that with .net code that I found on internet but I got MQRC_HEADER_ERROR exception.
I don't know what are TextMessage vs BytesMessage in Java but I guess that are the functions for creating the messages, I use queueMessage.WriteString(message); and queueMessage.WriteBytes(message); in .Net
after that I use this code to enter the RFH2 header:
queueMessage.Write(rfh2Header);
queueMessage.Format = MQC.MQFMT_RF_HEADER_2;
For creating of the "rfh2Header" value I have tried several things that I found on internet but neither worked.
If you can tell me how can I create the value of that header right with the XML that I have it would be perfect.
I am looking forward to hearing from you.
Regards
------------------------------
Bojan Bojan
Original Message:
Sent: Thu September 12, 2024 01:25 AM
From: Francois Brandelik
Subject: Adding MQRFH2 headers to MQMessage in C#
Did you look at the specific JMS properties on MQRFH2 header?
Like JMS message type (TextMessage vs BytesMessage etc...) Did you set those?
------------------------------
Francois Brandelik
Original Message:
Sent: Mon April 26, 2021 03:08 AM
From: Daniel Jonsson
Subject: Adding MQRFH2 headers to MQMessage in C#
Thanks for your reply. When we send a message using SimpleMessageProperties to our integration platform, it does not accept it giving an error that the field "JMSProperties" is missing. We have a working Java program that sets the properties directly onto a MQRFH2-header object and then writes it to the message, but I can't find a way to do that using C# .NET.
------------------------------
Daniel Jonsson
Original Message:
Sent: Thu April 22, 2021 02:41 AM
From: Shashikanth Rao Thambrahalli
Subject: Adding MQRFH2 headers to MQMessage in C#
SimpleMessageProperties sample puts the properties under RFH folder as shown in picture below. Could you please let us know reason why you think SimpleMessageProperties does not suit your requirement?
------------------------------
Shashikanth Rao Thambrahalli
IBM
Original Message:
Sent: Wed April 21, 2021 03:09 AM
From: Daniel Jonsson
Subject: Adding MQRFH2 headers to MQMessage in C#
Hello! I need to send a MQMessage in .NET C# with specific JMS-Properties in the MQRFH2-header. The properties need to end up in the <ur>-tag for the target system to be able to use them properly. Because of this we can't use neither XMS nor SimpleMessageProperties. Any help would be greatly appreciated!
------------------------------
Daniel Jonsson
------------------------------