Click here to Skip to main content
14,741,708 members
Articles » Platforms, Frameworks & Libraries » .NET Framework » How To
Posted 6 Mar 2015


1 bookmarked

BizTalk Mapping - Map Multiple Schemas to a Single Output Schema

Rate me:
Please Sign up or sign in to vote.
4.50/5 (2 votes)
6 Mar 2015CPOL
Map fields from multiple schemas to fields of a single output schema


Creating a many-to-one mapping in BizTalk 2010 is not straightforward. Such a map cannot be created simply by using menu options 'Add->New Item->Map'. But the work around to this problem is creating a many to one map using an orchestration.


This section covers the details of the project 'BizTalk_2_to_1_Mapping' attached with this tip.

A small insurance company offers only one type of insurance.

The output is required to be combined data of customer and his/her insurance details.

The interest rates will vary depending on whether it is a single or bulk customer. The premium to be paid will depend on unit premium and the premium payment term.

There are 2 input schemas. First is CustomerDetails.xml.

Image 1

Second is InsuranceDetails.xml.

Image 2

Output is formatted using the schema CustomerInsuranceDetails.xml.

Image 3

Since we cannot create many-to-one map directly, add new orchestration. The incoming messages have to be related in some way, so that they are consumed by the correct instance of the orchestration. In this situation, we are using a correlation on property 'BTS.ReceivePortName', hypothesis being only one file of each file will come per day. Note that both the messages are received on the same logical port.

But, in actual scenarios, you should use some kind of promoted property, unique to both the messages, to create correlation between the messages.

Image 4

Double click the Transform shape to edit it. Choose 'New Map' option. In the Source message selection drop-downs, select the messages referencing CustomerDetail and InsuranceDetail schemas. In output message selection drop-down, select the message referencing to the CustomerInsuranceDetails schema. Creating map from orchestration's Transform shape allows you to select multiple input schemas.

Image 5

On clicking OK, the mapper will come up, with the newly created map, without any links. Add functoids and links to implement required mapping logic.

Image 6

Testing the Application

  1. Sign the assembly / assemblies
  2. Build and deploy the solution from Visual Studio
  3. Configure on BizTalk Management console. Create One receive port, with 2 receive locations. Create a send port. Configure the orchestration for host, and ports. Start the application, restart the host.
  4. Generate XML instances of customer and insurance schemas, and put in corresponding locations. Check the output.

Additions Required

This is only a reference article. In actual developments environments, you should consider adding exception handling, logging, schema verification, time-out, etc.


  1. It is a best practice to maintain separate projects for orchestrations, maps, schemas, pipelines, etc. under a solution. In such scenario, the map created using orchestration will be created in the project for orchestrations, and the namespace will also be the same as that for orchestrations. So, remember to move the map to the mapping project and update the namespace accordingly. In the attached code, this step was not needed as there is a single project for sake of simplicity.
  2. If the input schemas are changed (so that the xpath expressions for links in the map will be affected) after map/transform creation, the map will not be loaded properly. In such case, instead of creating the whole map all over again, open the map in some text/code editor, and find and fix the affected xpath expressions for the links. Do not forget to create backup, as minor mistakes can render the transform useless.

Reloading the schema does not work here, as you can reload only one schema.


  • 6th March, 2015: Initial version


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

No Biography provided

Comments and Discussions

Questionattachment not visible Pin
Member 974516312-Aug-16 1:03
MemberMember 974516312-Aug-16 1:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.