IntroductionBizTalk 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 solutionThe 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).Figure 1Right-click on the project and select Add | Add New Item. Then select a receive pipeline and enter a name for it (see Figure 2).Figure 2Now drag and drop the XML Validator component from the Toolbox to the Drop Here location under the Validate stage (see Figure 3).Figure 3Now 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).Figure 4Now 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.Figure 5Go 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).Figure 6Now 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).Figure 7Configure the transport protocol as well as set the default XMLTransmit pipeline as the pipeline of this port (see Figure 8).Figure 8And subscribe to all the messages that come from the previously defined Receive Port named ReceivePort (see Figure 9).Figure 9Now start both ports and test the solution.ConclusionIn this article, I covered how to validate messages using pipelines in BizTalk Server.
C# Corner. All contents are copyright of their authors.