I try to build an xml
message to inject it in IBM MQ.
The format to be used should be RFH2
. Do you know, do you have any documentation about the format (xsd
?) of the header?
Thank you.
I try to build an xml
message to inject it in IBM MQ.
The format to be used should be RFH2
. Do you know, do you have any documentation about the format (xsd
?) of the header?
Thank you.
MQ's RFH2 is an extensible header consisting of a fixed-format binary structure followed by a variable portion with an XML-like syntax.
The structure is described (in basic terms) in the Knowledge Center here:
https://www.ibm.com/support/knowledgecenter/en/SSFKSJ_9.1.0/com.ibm.mq.ref.dev.doc/q099070_.htm
Some MQ clients (for example JMS and .NET) will automatically prefix the messages they send with an RFH2 header. If you are using one of these clients then you might not need to encode the RFH2 yourself - it will be added for you.
Do you have any more information about why the application needs an RFH2 header? The RFH2 is often used to carry message properties so you will need to ensure that you encoded these correctly if you are building your own RFH2.
If the application is using the MQ JMS or .NET client then it will be expecting the RFH2 header in the message to be formatted as described in the following topic:
https://www.ibm.com/support/knowledgecenter/en/SSFKSJ_9.1.0/com.ibm.mq.dev.doc/q032000_.htm
You may find the following utility program (rfhutil) helpful in understanding the RFH2 header and debugging your application:
https://github.com/ibm-messaging/mq-rfhutil
Note that the variable portion of the RFH2 header uses an XML-like syntax but does not support or understand all the features of XML, so you should not attempt to include your XML payload in the variable portion of the RFH2 header.... Instead the XML document should follow the RFH2 in the message.
One last point to note is that MQ can perform codepage conversions based on the format and CCSID of the message, but this is rarely what you want with an XML document (which typically describes the character encoding of the document it's own declaration like this: <?xml version="1.0" encoding="UTF-8" standalone="no" ?>
. I would therefore recommend that you set the Format field in the RFH2 to "MQFMT_NONE" so that the XML document is treated as binary data and not converted unnecessarily when the message is received by the MQ client.