use of unconstructed message error in Construct Message in Orchestration Biztalk

Monday, July 25, 2011

I have a message in my orchestration of type MessageEnvelope (a simple schema in my project)
I have a simple orchestration with a construct message shape.  This construct message constructs this message.
Inside this shape is a Message Assignment shape which contains the following code:
messageEnvelope.Action = "";
messageEnvelope.MsgType = "Test";
messageEnvelope.SystemID = "System A";
messageEnvelope.BodyXML = "Some test text";
Each of these is a Distinguished Field on the message type schema.  All elements of this schema are distinguished and assigned in the above.
Compiling the project gives an "use of unconstructed message" for each assignment statement above and also a "message has not been initialized in construct statement" error.
 Can anyone point out why BizTalk cannot initialize and construct this message?


Just setting distinguished fields actually doesn't construct the message.  The primary ways that a message is constructed are:
  • received by receive shape
  • transform
  • message assignment (MyMessage1 = MyMessage2), when the messages are of the same schema type
  • XmlDocument (e.g. create an XmlDocument variable, load it up, set it equal to a "message")
  • custom code
Maybe in your case you can just use the message that starts your orchestration as part of a map to create the MessageEnvelope.

1 comment:

  1. Note: For a .Net Class Message Create variable of that Message Type and initialize it with that message to get rid of UnConstructed Message Error.


Post Your Comment...