HI Guys,
Let’s see all the stuff required for Developing and Testing Maps which are having more than a Single Schema in either Source or Destination or Both.
So we are going to see all the below scenarios.
- Single Source – Single Destination
- Multiple Source – Single Destination
- Single Source – Multiple Destination
- Multiple Source – Multiple Destination
Development
Developing a Map using a Single Source and Single Destination schema should be a straight forward thing which you all should know. So I am not going to discuss on the first point.
Now, if we want to add one more Source or Destination schema to an existing Map, you will be upset to know the fact that none of the existing versions of Biztalk support this featureL. And you will be surprised to know that this can be achieved using an Orchestration !!.
Yes, it’s true.
Steps for creating a Map with Multiple Source/ Destination schemas:
- Create a dummy orchestration. ( This is not required once we are done with map creation)
- Insert a Transform shape.
- Create 4 messages (2 for source and 2 for destination) and assign the message type property to the required schema.
- Assign the 2 source schema messages to the list of Input messages for the shape.
- Similarly assign the 2 destination schema messages to the list of Output messages for the shape.(You can either double click the Transform shape to assign these or you can assign using the properties window )
- Now when you click OK , the map will be launched. (If you select the Check box available at the bottom)
- It will look like below.
Hurrah! You are done with creating a map with Multiple Source and Multiple Destination schemas.
If you observe the newly created map, the schemas are not placed directly under the Root level. They are placed as Message parts. Yes, we achieve this Multiple Schemas concept using Message Parts.
Now you can go ahead and do the required mapping as how you will be doing in the case of Single Source – Single Destination Maps.
Testing
Testing is not as easy as development in this case. Its little tricky.
- Single Source – Single Destination: You should know this. We use Map Properties window for the unit testing of the map.
- Multiple Source – Single Destination: To test this you need a message which will have both the input schemas. But the fact is as we don’t have the details in a Single message, we have gone for Multiple Source. So now our aim is to construct a Single Message which will include both schemas. We can create the input message manually. But that will give scope for many manual errors and the message may not get validated by the map because of namespace issues. So it’s always better to get the input message constructed by Biztalk itself.
Let’s see how we going to construct.
We have to create a map which is inverse of the above map. So it will have Single Source and Multiple Destination schemas. Now keep the TestMapInput property of the map to “GenerateInstance” and test the map. The output of the map is nothing but the required input xml format for the Multiple Source – Single Destination map! Isn’t it cool?
Your sample should look like this if you have 2 schemas in the dummy destination map.
(Few changes need to be done to this xml which are explained below)
- Single Source – Multiple Destination : Shouldn’t be having any questions on this .
- Multiple Source – Multiple Destination: Hope you should be having answer for this by this time. Just create dummy maps which will have the multiple source and multiple destination schemas as part of their destination schemas and generate the output instance for these dummy maps. You are done there…
Converting the generated output xml to the required input xml format:
Modify the generated output file as below.
<ns0:Root xmlns:ns0=”http://schemas.microsoft.com/BizTalk/2003/aggschema”
xmlns:ns1=”http://MultipleSourceAndDestinationSchemas.Schema1″
xmlns:ns2=”http://MultipleSourceAndDestinationSchemas.Schema2″>
<InputMessagePart_0>
<ns1:Schema1>
<Record1></Record1>
</ns1:Schema1>
</InputMessagePart_0>
<InputMessagePart_1>
<ns2:Schema2>
<Record2></Record2>
</ns2:Schema2>
</InputMessagePart_1>
</ns0:Root>
You have to replace the “OutputMessagePart” with “Input MessagePart”(See the highlighted ones in the above sample). Now this is your correct input xml which you can use to test the original map.
If you observe Biztalk places different namespaces for each of the schema utilized in the map. When we try to construct this input manually we may end up in creating errors because of this. So it’s advisable to create the input through biztalk.