A little over a year ago I posted
an entry about a new feature included in the MSMQ Send Adapter in BizTalk 2006
which provided a way to send messages through MSMQ from BizTalk to legacy applications
that required the message contents to be formatted using the ActiveXFormatter, or
that simply used the old COM-based MSMQ API.
However, I didn’t mentioned anything about how to enable the opposite scenario: How
to receive and parse a text message in BizTalk 2006 coming from one of those legacy
applications. Someone recently asked about this on the BizTalk Newsgroup and, as It
turns out, BizTalk Server 2002 happens to fall in this category as well.
Fortunately, this scenario is a lot simpler, if we assume that the contents of the
message will be plain text (say, some string content or XML). The ActiveX message
serialization rules dictate that a message with a BodyType of String will simply be
serialized on the wire as a set of bytes encoded using UCS-2 (UTF-16LE), without a
Byte Order Mark (BOM).
BizTalk can parse UTF-16 contents without problems, but without a BOM, the standard
disassemblers can’t figure out the encoding of the message on it’s own.
Fortunately, most of the time you can work around this by setting the message Charset
before parsing (for example using my own FixEncoding pipeline
component).
