Creating Multiple Input Maps for BizTalk Server 2004

When you create a new map in BizTalk Server 2004 through the Add New Item menu in Visual Studio .NET 2003, you are presented with a 3 pane window. On the left side is a link that says "Open Source Schema". Clicking on this link will open the Select Artifact dialog box containing any schemas found that are referenced in your project (or other referenced assemblies). You select the source schema, select the destination schema and then start the process of creating the schema links. However, the Select Artifact dialog will only let you choose 1 source schema. What if you wanted to actually select 2 or more source schemas in order to create a document merge type of map? Well, that's exactly what this post is about. Read on...

NOTE: I'm a tutorial type of person. A hands on, learn by doing type of person. As you read along, feel free to actually perform these steps.

The 1st prerequisite step is to create an empty BizTalk Server project (obviously).

The 2nd prerequisite step is to design your schemas (or at least have them referenced in your project if they've already been generated). For the sake of keeping this post small, I will forego the procedure of schema generation and will use 3 canned schemas that you can download by following these links:

https://codepunk.members.winisp.net/blogfiles/MultiInputMap/ProductInformation.xsd <- Source schema #1
https://codepunk.members.winisp.net/blogfiles/MultiInputMap/CustomerInformation.xsd <- Source schema #2
https://codepunk.members.winisp.net/blogfiles/MultiInputMap/CustomerProductQuery.xsd <- Destination Schema

At this point, you should have a BizTalk Server Project with the 3 imported schemas. Now normally you would click on Project, Add New Item to create a map but remember, you can only specify a single source schema. Follow these steps to create a multiple input map:

Create an Orchestration
  1. Click on Project, Add New Item from the main menu.
  2. Select BizTalk Orchestration from the list of Templates and click Open.NOTE: You will more than likely just delete this orchestration later, so there's no need to get fancy on the name.
Creating the Messages
  1. Click View, Other Windows, Orchestration View from the main menu to open the Orchestration Viewer.
  2. Right click the Messages node and select New Message.
  3. In the Properties window, in the Identifier property, type ProductInformationMessage.
  4. In the Message Type drop down list, expand Schemas and select MutliInputMap.ProductInformation.
  5. Repeat steps 2-4 for the other 2 schemas (MultiInputMap.CustomerInformation and MutliInputMap.CustomerProductQuery naming them CustomerInformationMessage and CustomerProductQueryMessage respectively).
Creating the Multiple Input Map
  1. From the Toolbox, drag and drop a Transform shape onto the orchestration design surface.
  2. Double click the inner Transform shape (named Transform_1) to open the Transform Configuration dialog box.
  3. In the Transform Configuration dialog, make sure the New Map radio button option is selected.
  4. In the Name field, type MultiInputMap.CustomerProductMergeMap.
  5. Select the Source node from the left pane tree control.
  6. In the right pane, click the label that says "Click here to add a new row" and select ProductInformationMessage from the drop down list.
  7. In the right pane, click the label that says "Click here to add a new row" and select CustomerInformationMessage from the drop down list.
  8. Select the Destination node from the left pane tree control.
  9. In the right pane, click the label that says "Click here to add a new row" and select CustomerProductQueryMessage from the drop down list.
  10. Make sure the When I click OK, launch the BizTalk Mapper checkbox is checked.

Your Transform Configuration dialog should look similar to the following figure:

At this point you have created a map which accepts 2 source documents and generates a single destination document. When BizTalk Mapper opens you'll notice that each source schema is contained within an InputMessagePart_0 or InputMessagePart_1 element. You can then create the BizTalk map links just as you normally would.

Important: You can now delete the orchestration that you created for this little exercise. However, when you use the map in your project later you have to make sure that the source schemas are in the correct order. In other words, when you double click the Transform shape and select Existing Map, each row that corresponds to one of the source schemas must be in the same order as when you created the map in the first place. In the above example, if I were to first select CustomerInformationMessage followed by ProductInformationMessage as the 2 source schemas in my Transform shape, your map will not work as you expect it to.

So there you have it, the procedures to create multiple input maps in BizTalk Server 2004. It's a simple process but in my opinion is a really nice know-how to have on your mental utility belt. Let me know if you found this little nugget useful.