Standardizing Incoming Messages Using Inbound Maps Tab on Receive Port Properties in BizTalk Server

Introduction

Sometimes we need to develop integration applications which receive documents with different schemas arriving from external entities, and it's required to transform each format to a common (canonical) internal schema using port maps on the receive ports in BizTalk Server. In this article, I will cover the techniques associated to port maps on the receive ports by developing a sample application which receives two documents with information about customers, one document whose format is flat-file based and another one with an external XML schema different than the required canonical internal XML schema.

Getting started with the solution

First, we need to open Visual Studio .NET and create an Empty BizTalk Server Project (see Figure 1).

1.gif
 
Figure 1

Now let's create the schema for each incoming document. The first document is a comma-separated flat file with information about customer following the format: customer_id, customer fullname and customer address (see Listing 1).

1, JC Olamendy, 10 Address1
2, Maribel Perez, 10 Address1
3, John Doe, 20 Address2

Listing 1

Now let's create a BizTalk Flat File Schema using the Flat-File Schema Wizard (see Figure 2).

2.gif

Figure 2

When the Wizard is open, then select the instance file (see Listing 1) and enter Customers value as the Record name (see Figure 3) and click on the Next button.

3.gif

Figure 3

Then select all the document data (see Figure 4) and click on the Next button.

4.gif

Figure 4

Select the option By Delimiter symbol and click on the Next button (see Figure 5).

5.gif

Figure 5

Click on the Next button on the Delimited Record page. In the Child Elements page, set the first row, by entering the Customer value in the Element Name column, setting the column Element type as Repeating record, and finally ignoring the remaining rows (see Figure 6). Click on the Next button.

6.gif

Figure 6

Then click on the Next button on the Schema View, Select Document Data and Select Record Format pages. In the Delimited Record page, set a comma value for the Child delimiter field (see Figure 7). Click on the Next button.

7.gif

Figure 7

In the Child Elements page, set the value as shown in Figure 8. Click on the Next button.

8.gif

Figure 8

In the Schema View page, click on the Finish button, and we have the flat file schema created.

Now let's add a schema for the documents of the second external application (see Figure 9 and Figure 10).

9.gif

Figure 9

10.gif

Figure 10

Now let's add the canonical XML schema representing the internal documents (see Figure 11 and Figure 12).

11.gif

Figure 11

12.gif

Figure 12

Now let's add the mapping for each incoming document schema and the canonical internal document schema.

Let's add the map to transform the customer flat file document into the canonical document (see Figure 13).

13.gif

Figure 13

Open the flat file schema in the left pane and the canonical schema in the destination schema. Then drag and drop the fields from left page onto the right pane (see Figure 14).

14.gif

Figure 14

Now let's add the second mapping, in this case, to transform the second customer document schema into the canonical document schema (see Figure 15).

15.gif

Figure 15

Open the second customer schema in the left pane and the canonical schema in the destination schema. Then drag and drop the fields from left page onto the right pane. In the case of the full name field, drag and drop a String Concatenate functoid onto the surface and configure it as Figure 16.

16.gif

Figure 16

The final map resembles as the Figure 17.

17.gif

Figure 17

Finally, let's add a Receive Pipeline artifact to process the flat-file document (see Figure 18).

18.gif

Figure 18

Then add a Flat File dissasembler component into the pipeline and configure the Document schema property to the customer flat file (see Figure 19).

19.gif

Figure 19

Now let's build and deploy the solution.

After the solution is deployed in the server, now we need to configure the receive ports and its underlying receive locations as well as the send ports. Open the BizTalk Server 2006 Administration Console and navigate to the applications.

In order to create the receive port, navigate to the Receive Ports node, right-click and select New | One-way Receive Port option.

Set a name for this Receive Port (see Figure 20).

20.gif

Figure 20

In the Receive Locations tab, add new one and configure the transport protocol as file-based as well as Receive Pipeline as the custom FlatFile_ReceivePipeline (see Figure 21).

21.gif

Figure 21

Then add another receive location (see Figure 22).

22.gif

Figure 22

Now let's navigate to Inbound mappings tab in the Receive Port properties and add the two mappings to the list of inbound mappings (see Figure 23).

23.gif

Figure 23

Now go to the Receive Locations node and enable each created receive location (see Figure 24).

24.gif

Figure 24

Now let's create a send port to process the incoming messages, and just drop them into an output directory. Go to the Send Ports node, right-click and select New | Static One-way Send Port option. The configure the Send Port as shown in Figure 25.

25.gif

Figure 25

Now let's add a subscription to the receive port by navigating to the Filters tab, and setting up a new filter BTS.ReceivePortName equal to ReceivePort value (see Figure 26).

26.gif

Figure 26

After you have create the send port, right-click over it and select the Start option (see Figure 27).

27.gif

Figure 27

Conclusion

In this article, I covered how to configure multiple inbound maps on the receive ports in order to transform incoming documents with different formats into a canonical internal schema.


Similar Articles