Wednesday, December 8, 2010

BizTalk Mapping with Multiple Source and Destination Schemas

If you are already familiar with the BizTalk Mapper tool within Visual Studio, you probably already know that it is easy to create a .btm map file in the BizTalk project, select a single source schema and a single destination schema, and then create your map graphically. However, what if you have multiple schemas that you want to aggregate them into a single destination schema, or better yet, into multiple destination schemas. It is not obvious how you can accomplish this in the mapping tool since it doesn’t seem to allow you to select more than one schemas, either source or destination, when you create the map. Actually, this can be accomplished with the help of an helper orchestration.

Here are the steps as an example:

  1. Create 4 schemas, name them source1, source2, destination1 and destination2 respectively.
  2. Instead of creating a map file (.btm) directly, create a new orchestration (.odx) file. This will be your helper orchestration and you can discard it after you are done.
  3. Inside the helper orchestration, create 4 messages, assigning them with the 4 schemas you create in step 1 respectively.
  4. Grab an Transform shape and throw it onto the orchestration designer surface.
  5. Double-click on the Transform shape, now you are in the Transformation Configuration dialog box.
  6. Make sure “New Map” checkbox is selected, then type in the map name you’d like.
  7. Add source1 and source2 messages as the Source of the Transformation.
  8. Then add destination1 and destination2 messages as the Destination of the Transformation.
  9. Make sure “When I click OK, launch the BizTalk Mapper” checkbox is selected.
  10. Hit OK. A new map will be created for you with Source1 and Source2 as source schemas under a single root record, and destination1 and destination2 as destination schemas under a single root record as well. Now you can go ahead design this map to your heart’s content.
  11. Optionally, again, you can delete the helper orchestration.

Unfortunately there is still no direct way to create this kind of maps in BizTalk Mapper. But with the help of an orchestration Transformation shape you can accomplish this as a work-around.



No comments: