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.
Here we are going
to see all the below scenarios:
1.
Single Source – Single Destination
2.
Multiple Source – Single Destination
3.
Single Source – Multiple Destination
4.
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 confused
to know the fact that none of the existing versions of BizTalk support this feature.
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:
1.
Create a dummy orchestration. ( This is not required once we are
done with map creation)
2.
Insert a Transform shape.
3.
Create 4 messages (2 for source and 2 for destination) and
assign the message type property to the required schema.
4.
Assign the 2 source schema messages to the list of Input
messages for the shape.
5.
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 )
6.
Now when you click OK, the map will be launched. (If you select
the Check box available at the bottom)
7.
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 little bit
tricky.
1. Single Source – Single Destination: You should know
this. We use Map Properties window for the unit testing of the map.
2. Multiple Sources – 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 are
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 two schemas in the dummy destination map.
(Few changes need to be done to this
xml which are explained below)
3. Single Source – Multiple Destinations:
Shouldn’t be having any questions on this.
4. Multiple Sources – Multiple Destinations:
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”
<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 schema
closely, 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. So it’s advisable to create the input through BizTalk.
No comments:
Post a Comment