Receiving Messages With Multiple Schemas in a Single Orchestration

In this article, I will cover how to receive two messages with different schemas in a single orchestration in order to process them instead of creating separate orchestrations for each message with identical business logic. For the solution, I will use the Listen shape along with two Receive shapes each of them listening for different messages.

Introduction

In this article, I will cover how to receive two messages with different schema in a single orchestration in order to process them instead of creating separate orchestrations for each message with identical business logic. For the solution, I will use the Listen shape along with two Receive shapes each of them listening for different messages.

Getting started with the solution

First of all, open Visual Studio .NET and create a solution and an Empty BizTalk Server project (see Figure 1).

image1.gif

Figure 1

Now let's create two different schemas for the messages, for example, schemas representing similar business entities such as customers but with different semantic representation. The first schema represents documents from one ERP system (see Figure 2).

image2.gif

Figure 2

The second schema represents documents from other ERP system, and it differs semantically from the first one in that the full name of customer is in one data item (full name) instead of two data items (first name and last name) (see Figure 3).

image3.gif

Figure 3

Now let's add an orchestration artifact into the project and define the underlying business logic (see Figure 4).

image4.gif

Figure 4

Drag and drop a Listen shape from the Toolbox onto the design surface in the orchestration and set a descriptive name. Then add two Receive shapes within the Listen shape. Set the Activate property to true and rename both Receive shapes. And finally, add two Send shapes and rename them. The final orchestration resembles the Figure 5.

image5.gif

Figure 5

Create two message variables in the orchestration by right-clicking the Messages node, and selecting New Message on the Orchestration View window. Rename them appropriately as msgCustomerERP1 and msgCustomerERP2. Set the type to previously define schemas (see Figure 6 and Figure 7).

image6.gif

Figure 6

image7.gif

Figure 7

Set the Message property of the Receive_ERP1 and Send_ERP1 to msgCustomerERP1 and the Message property of the Receive_ERP2 and Send_ERP2 to msgCustomerERP2.

Finally, add and configure two ports for the Receive shapes and two ports for the Send ports. Then connect each shape for the underlying port (see Figure 8).

image8.gif

Figure 8

Now you can assign a key name file to the project (see Figure 9), set an application name (see Figure 10), and deploy it to the server in order to be tested.

image9.gif

Figure 9

image10.gif

Figure 10

Conclusion

In this article, I covered how to receive two messages with different schemas in a single orchestration. Now you can apply this solution to your own business scenario.