A typical orchestration in BizTalk deals with several kinds of messages. A message in BizTalk is always strongly typed. It is usually associated to some schema defined in the project. A Receive/Send shape in an orchestration is tied to a message declared in the Orchestration View. In the case of an un-typed message, the message type is set to '
System.Xml.XmlDocument', instead of a schema type. The class "
XmlDocument" is a super class for all XML messages, and hence it can hold any type of XML message and subsequently any type of orchestration message. To summarize, an un-typed message is one whose message type is set to "
XmlDocument" in an orchestration.
Example - processing un-typed messages
Consider that we are integrating several small messages into a StoreFront application. This application deals with several kinds of messages like "Car", "Music" and "Book". These messages need to be integrated into a "StoreFront" message. So, a designed orchestration would receive several different types of messages. The orchestration in the article is shown below:
In the above orchestration, the "Send" and "Receive" shapes can handle any type of message. It is because the "Receive" shape is associated with a message which is of type "
The Decision shape separates out the different kinds of messages.
Notice the commonality in the above schemas. A quick explanation of one of the schemas is as follows:
The schema "Car.xsd" has the following properties:
RegID - The registration ID.
Make - The make of the car.
Model - The year of manufacture.
Operation - Can be either "BUY" or "SELL".
ExpectedPrice - The expected price.
InputMessage" message is specified in the Receive shape:
OutputMessage" message is specified in the Send shape:
The Message Assignment shape has the following lines of code:
BookMsg = InputMessage;
regId = BookMsg.RegID;
category = "BOOK";
operation = BookMsg.Operation;
dataItem1 = BookMsg.Author;
dataItem2 = BookMsg.Pages;
expectedPrice = BookMsg.ExpectedPrice;
xmlDocument = new System.Xml.XmlDocument();
xmlDocument.LoadXml("<ns0:StoreFront " +
OutputMessage = xmlDocument;
Line 1: The
InputMessage is assigned to
BookMsg, so as to retrieve its promoted properties.
Line 2-7: Retrieving the promoted properties of the
Line 8: Creating an instance of '
xmlDocument' and loading the XML for output.
Line 10: Assigning '
xmlDocument' variable to
OutputMessage shall be sent through the "Send" port.
Strong name and deployment!!
- Create a key file, using the "sn -k Untyped.snk", in the Visual Studio .NET command prompt.
- In the Solution Explorer, right-click on the "UntypedMessages" project properties and select "Assembly" and specify the key file name.
- In the Solution Explorer, right-click on the "UntypedMessages" project properties and select "Deploy".
Download and test the solution
- Download the zip file and extract the source code provided into any directory of your choice. Look into the folder "InputFiles" for sample input XML files. Place the input file in the receive location. Check the response in the "Out" folder based on the input message.
- In the BizTalk Explorer, right-click on the listed orchestration under the "Orchestration" folder and select "Bind...". Create a receive port and a receive location:
In the BizTalk Explorer, right-click on the listed orchestration under the "Orchestration" folder and select "Start". The orchestration icon must turn to blue.
- Always set the
Activate property to "
true" for the first Receive shape in the orchestration.
- The "Terminate" shape is required in the orchestration, without which the project will not compile, since that particular branch does not generate any outgoing message.
- A BizTalk service needs to be re-started every time a deployment is done.