Thoughts on Systems Integration using Microsoft Technologies

“use of unconstructed message ‘<MessageName>'” error

A quick search of the web suggests that this is a common error and a source of confusion and frustration!

You try to build your orchestration and the build fails with the highlighted error below, for example:

CompilerError

In my case, I’m trying to assign a value to a message but the compiler won’t let me: instead, a copy of the original message needs to be made and then the value can be assigned to the copy.

This is a core feature of BizTalk and demonstrates a tenet of the framework: received messages are immutable (can’t be changed).  What this means is that a full message audit trail is maintained which is critical when your application is “in the field” and a BizTalk admin needs to trace message processing through BizTalk using perhaps the BizTalk Admin Console.

So, for example, in the case of the orchestration below, I have an assign message shape (indicated with a red square) where I am incorrectly attempting to assign a value to the original message rather than a copy of it:

ProcessExpenseOrch

In order to fix this, I need to make a couple of changes to the assign message shape:

  1. Modify the “Messages Constructed” property from the original message to a different message of the same type
  2. Change the message assignment: instead of assigning a value directly to the original message, I instead “clone” the original message and assign to this copy of the original message
So in the expression editor, this:
BTExpEdError
Becomes this:
BTExpEd

Finally, I change the last Send shape to ensure that the message copy is sent rather than the original message.

(Incidentally, a big clue that a new message needs to be created as part of the assignment is that the message assignment shape comes with a construct message shape).

In conclusion, this post demonstrates a core feature of BizTalk: message immutability.  This is a foundational principle of BizTalk as a framework and as demonstrated, is enforced by the compiler.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s