Validating Messages using Pipelines in BizTalk Server

Introduction

BizTalk Server provides an XML Validator pipeline component to validate XML messages against the associated schema. If the messages are not in XML format, then these messages must be converted to XML to be validated. In this article, I will cover a simple recipe to create a custom pipeline in order to validate incoming and outgoing messages in BizTalk Server because XML Receive receive pipeline and XMLTransmit send pipeline shipped with BizTalk Server will only check if the XML document are well-defined only.

Getting started with the solution

The first step is to open Visual Studio .NET and create an empty BizTalk project. Then define a schema used to validate the incoming messages (see Figure 1).

image1.gif

Figure 1

Right-click on the project and select Add | Add New Item. Then select a receive pipeline and enter a name for it (see Figure 2).

image2.gif

Figure 2

Now drag and drop the XML Validator component from the Toolbox to the Drop Here location under the Validate stage (see Figure 3).

image3.gif

Figure 3

Now go to the Properties windows by pressing the F4 key. Select the ellipsis next to the Document Schemas property to launch the Schema Collection Property Editor dialog box and then add the previously defined Customer_Schema schema to the Added Schemas list (see Figure 4).

image4.gif

Figure 4

Now let's configure the receive and send ports as well as configure the receive port to validate the incoming messages using the previously developed pipeline.Open the BizTalk Server Administration console and navigate to the newly deployed application. Right-click on the Receive Ports node and select One-way Receive Port.

image5.gif

Figure 5

Go to the Receive Locations definitions and add a new location and configure the transport protocol. Finally set the Validate_CustomerSch_RecPipeline as the receive pipeline of this location (see Figure 6).

image6.gif

Figure 6

Now let's add a new send port. Right-click on the Send Ports node and select New | Static One-way Send Port (see Figure 7).

image7.gif

Figure 7

Configure the transport protocol as well as set the default XMLTransmit pipeline as the pipeline of this port (see Figure 8).

image8.gif

Figure 8

And subscribe to all the messages that come from the previously defined Receive Port named ReceivePort (see Figure 9).

image9.gif

Figure 9

Now start both ports and test the solution.

Conclusion

In this article, I covered how to validate messages using pipelines in BizTalk Server.


Similar Articles