Entry
Getting error "Use of Unconstructed Message"?
Apr 6th, 2005 22:48
Balaji Ramachandran, http://biztalk-training.com/Default.aspx?tabid=57
You are trying are receiving one type of message (such as apples) and
trying to send another type of message (such as oranges).
Where is Biztalk supposed to come up with the "orange" XML layout ? Out
of thin air?
You must use a Construct Message shape that specifies "orange" as your
output message. The construct message shape can use either of two sub-
shapes:
1) Transform - You an use a map to map "apples" to "oranges".
2) Message Assignment - Define a variable (in Orchestration View)
called myDoc and make it of type System.Xml.XmlDocument.
You can use something like the following to manually build
your "oranges" xml layout.
//create a variable called myDoc as type System.Xml.XmlDocument
myDoc = new System.Xml.XmlDocument();
myDoc.XmlLoad ("put your xml here - yourroot
ns='http://yourproj:namespace' etc...");
// msgOrange is your orchestration "orange" message
msgOrange = myDoc;
I'm trying to come up with more ideas on how to build an output message
without using a map/transformation.
Here's a good summary of the four ways you can build the message (from
a post to the Microsoft Community News Groups):
1) Use LoadXml to create an instance of OutMessage (with the xml
hardcoded within the expression shape)
2) Use a Transform shape rather than a MessageAssign shape and create a
Map to get my populated instance of OutMessage.
3) Use code to return an instance of OutMessage based on a "template
instance" held on disk somewhere
4) Use a .NET class to represent OutMessage
Others and myself have suggested that Microsoft create a XMLDocument
method called something like GenerateEmptyInstanceFromSchema so you
could say:
msgOrange = myDoc.GenerateEmptyInstanceFromSchema("Apple.xsd");