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:
http://codepunk.members.winisp.net/blogfiles/MultiInputMap/ProductInformation.xsd <- Source schema #1
http://codepunk.members.winisp.net/blogfiles/MultiInputMap/CustomerInformation.xsd <- Source schema #2
http://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|
|Creating the Messages|
|Creating the Multiple Input Map|
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.