Delen via


UTF encoded message failing in Biztalk 2006

Receiving following error at the Receive Pipeline while using MSMQ adapter in Biztalk 2006: A message received by adapter "MSMQ" on receive location "xxxxxxxxxxx" with URI "xxxxxxxxxxx" is suspended. Error details: There was a failure executing the receive pipeline: "xxxxxxxxxxx"
Source: "XML Disassembler" Receive Port: "xxxxxxxxxxx" URI: "xxxxxxxxxxx" Reason: No Disassemble stage components can recognize the data.

Also, the Biztalk 2004 accepted the message and processed it with no errors. The migrated it to Biztalk 2006. The issue started occurring after migrating to Biztalk 2006. Also, the same message would work with File Adapter in Biztalk 2006.

Solution:

Found that the messages are UTF-16 encoded but do not contain BOM header. It's stated that UTF-encoded messages need to have BOM and the solution is to have UTF-encoded messages with BOM. This is a standard and this check have been added from BTS2006 onwards. So that explains why it works in BTS2004 and fails in BTS2006.

Either we has to use custom pipeline component to add BOM headers or has to modify the application to add BOM headers before sending message to Biztalk. Also, if you receive a UTF-encoded message without BOM header using a File Adapter, it will also fail. Usually what happens if we copy the message to a notepad and then save it, the encoding gets changed to ANSI, therefore it works. If it is not possible to change the application sending message, then a workaround is to create a custom pipeline component and use it in the receive pipeline to add the BOM header.

For example, starting from SDK (c:\program files\Microsoft BizTalk Server 2006\SDK\Samples\Pipelines\CustomComponent\FixMsg) sample with following suggested changes:
In the file FixMsg.cs Change: Byte[ ] prependByteData = ConverToBytes(prependData);
With: byte[] prependByteData = new byte[]{239,187, 191}; //UTF8 Byte Order Mark
In the file FixMsg.cs Change: Byte[ ] prependByteData = ConverToBytes(prependData);
With: byte[] prependByteData = new byte[] {255,254}; // UTF16 Byte Order Mark

Comments

  • Anonymous
    July 11, 2012
    Note that the Unicode specification doesn't say BOMs are required for UTF-16.  If no BOM is present, it should assume Big Endian.However, the W3C XML specification says:"Entities encoded in UTF-16 must and entities encoded in UTF-8 may begin with the Byte Order Mark"So I guess that it why Microsoft made them mandatory in BizTalk - from the XML rather than the Unicode perspective.