The part ‘part’ of message contains zero bytes of data – BizTalk Error

Problem:

While adding a “Start Orchestration” shape in an already developed & deployed BizTalk orchestration, I started getting error message “part ‘part’ of message <MessageName> contains zero bytes of data” whenever orchestration hit that start shape during execution

This resulted in exception thrown by start shape and as a result neither inner orchestration was executing successfully nor parent orchestration.

Scenario Details:

We had to add Start Orchestration shape in a BizTalk orchestration as part of some modifications to the process. Start orchestration shape was invoking another orchestration and had multiple input parameters (one message type parameter and others variable parameters)

The parent orchestration (being modified) was running fine previously but since the start orchestration shape was added, the parent orchestration broke at start shape and started throwing above mentioned error

Solution:

Upon detailed debugging & troubleshooting we observed a line of code in parent orchestration that was initializing a schema message with a an XmlDocument type using “new” keyword inside message assignment shape. For example:

Message1 = new System.XmlDocument();

Where Message1 was actually a schema based message (i.e. Type set to a referenced schema).

Initializing a message type with “new System.XmlDocument()” was the actual culprit in our case. So when we removed above mentioned line of code and initialized Message1 using Transform shape in the orchestration then the error message part contains zero bytes of data got fixed immediately.

Conclusion:

If you are getting error “part ‘part’ of message <MessageName> contains zero bytes of data” in BizTalk orchestration then go through whole orchestration code and try to find out how the message (whose name is being mentioned in error message) was initialized in that orchestration?

If anywhere in that orchestration it is initialized using “new XmlDocument()” then replace that type of initialization with proper message initialization using either Transform shape or Message Assignment shape.

Leave a comment