Yossi Dahan [BizTalk]


Wednesday, June 28, 2006

Xml declaration gotcha

This is one of those things that you spend an hour finding out and another half a day banging your head againts the wall and wishing all sorts of things to people you've never actually met (and are probably very nice).

I've been running a simple biztalk test orchestration that, as with most test processes, starts through a message arriving at a folder.

My message was generated by an application written by another department.
As soon as a message is dropped in the file drop it's being picked up by Biztalk as expected, which reacts with an immediate failure in the receive pipeline (I've used standard XmlReceive) and with an error message in the event log -

There was a failure executing the receive pipeline:
Microsoft.BizTalk.DefaultPipelines, Version=, Culture=neutral,
PublicKeyToken=31bf3856ad364e35" Source: "XML disassembler" Receive Port:
"***********" URI: "**********" Reason: Length cannot be less than
Parameter name: length

It took me a while to figure this out, but the bottom line is -

The problem was in the document's xml declaration. the application used single quotes around the attributes -

<?xml version='1.0' encoding='utf-8' ?>

- which is perfectly legal as far as I understand according to the w3c definition here .

Apparently BizTalk does not like that.
Changing the xml declaration to use double quotes -

<?xml version="1.0" encoding="utf-8" ?>

- solved the problem, which was easy enough to fix but I wish we didn't need to...

If this is a valid xml declaration I wish BizTalk would support that, if it's not - I'd love to hear from someone.


  • Hey Yossi - I had similiar issues with the same thing.

    I noticed - if you remove the 'encoding' attribute entirely - all is good.



    By Anonymous Anonymous, at 06/07/2006, 04:27  

  • Thanks Mike,

    That makes sense, as the problem is with the quotes, if you don't provide the encoding attribute you don't use quotes and you will not have that problem.

    This is ok when your document is utf-8 or utf-16 encoded, but if you're using any other encoding you have to provide that attribute.

    By Blogger Yossi Dahan, at 06/07/2006, 08:24  

Post a comment

<< Home