Sometimes, when you’re out of luck, you need to use the old Base Java API for WebSphere MQ. That is, not JMS. And you might need to create, or even worse, read a RFH2 header. If this is you, you probably loath the mess that is the RFH2 header structure. It’s a mix of a leading binary structure, followed by zero or more almost-XML structures. I have yet to see a complete specification.
So, what’s a poor hacker to do. I’ve written up a utility class for creating and parsing RFH2 headers as part of the wmq-util library that I’m doing at work. The aim is simple: make it easy to use RFH2 headers without any risk of screwing up. Enjoy and report back bugs and suggestions.