Delen via


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.

Comments

  • Anonymous
    September 19, 2005
    Solves a problem for me of how to merge data that you could not otherwise introduce here. It is just a shame that you cannot just add multiple schemas to the left pane of a map in a dedicated map module without the kludge of going round the houses.

    As you say, add it to the mental toolkit. Thanks for the tip.

  • Anonymous
    December 08, 2005
    I tried this but it doesn't work. I was expecting that all of hte data that that I map from ProductInformationMessage and CustomerInformationMessage will be mapped out in destination schema CustomerPropertyQuery Message.However, I only get the CustomerInformation message in the final message.

  • Anonymous
    December 14, 2005

    I am getting the same problem. The document in the first message part is not being mapped. It is as though no document was supplied to the map.

  • Anonymous
    August 09, 2006
    Hi

    This informaiton is very useful in my case. I am very happy to say that my problem is solved by this information.

    ~Ambar

  • Anonymous
    April 01, 2007
    Thanks for the information. It was very useful.

  • Anonymous
    December 20, 2007
    Only works for new maps. What about adding a schema to an existing map?

  • Anonymous
    February 12, 2009
    PingBack from http://debelog.wordpress.com/2009/02/13/creating-multiple-input-maps-for-biztalk-server/

  • Anonymous
    June 09, 2009
    PingBack from http://quickdietsite.info/story.php?id=4087