The video is available at http://msdn.microsoft.com/en-us/biztalk/video/gg153512.

This is the third video of the BizTalk Server 2010 EDI tutorial. In the last video, we created trading partners and business profiles. This video demonstrates how to create receive ports and send ports required for exchanging messages between the trading partners.

I am pasting the transcript of the video here to increase the search hits.

************************************************************************************************************************************

This is the third video of the BizTalk Server 2010 EDI tutorial.  In the last video, we created trading partners for Fabrikam and Contoso. We also created business profiles for Order System and Procurement System. In this presentation, we will create receive ports and send ports required for the EDI application.

Like we saw in the first video of the EDI tutorial video series, the business scenario uses three ports:

  • A receive port with an EDIReceive pipeline to receive EDI messages from Procurement System,
  • A send port with a custom send pipeline to map the message from Procurement System into a format required by Order System, and then send the EDI message to Order System, and
  • A send port with an EDISend pipeline to send an acknowledgement message back to Procurement System.

In this video, we will create these three ports.

The video contains the following procedures:

  • Create a receive port to receive purchase order message from Procurement System.
  • Create a send port to send the purchase order message to Order System.
  • Create a send port to send the acknowledgement to Procurement System.

Create a Receive Port to Receive Purchase Order Message from Procurement System

Before you start creating the ports, you must make sure you create all the ports in the EDISolution application because this is the application under which you deployed the artifacts required for the EDI application…. Let’s start with creating the receive port…. This is a one-way receive port… Name it ReceiveEDI_fromTHEM_A… Receive port is a container for receive locations. In this scenario, we only need one receive location… Name the receive location fromTHEM_4010_850… This receive location uses the File adapter…The File adapter has some properties…we need to specify a folder for the File adapter, so it knows where to poll messages. This is the folder where the Procurement System drops the request messages. The folder is C: drive….. Program Files…..Microsoft BizTalk Server 2010….. SDK….. EDI Interface Developer Tutorial….. ProcessEDI_TestLocations….. Scenario A….. fromTHEM. This folder is created when you install BizTalk Server… The file mask is TXT files because the EDI message that Procurement System drops to the file folder will be in text format…. You can set the retry count and retry interval. By default, it’s five retries with a five-minute interval.

The receive handler is BizTalkServerApplication. BizTalkServerApplication is a default host that the BizTalk Server installer creates. A host is a logical container. You assign BizTalk artifacts to a host, such as what we just did when we assigned the receive location to the host. A host has host instances. Each host instance is a BizTalk Server run-time process on BizTalk Server.

We also need to specify a receive pipeline for the receive location. A receive pipeline is for preprocessing messages, things like decoding, decryption, translation, validation, and party resolution. The request message from the Procurement System is an EDI message. So you must specify the EDIReceive pipeline for the receive location.

Save the receive port and receive location. Enable the receive location.

Create a Send Port to Send Purchase Order Message to Order System

We also need two send ports. The first send port is to send the purchase order message to Order System… Create a new static one-way send port… Name it toOrderSystem… it uses the File adapter…the folder for the File adapter to drop messages is C: drive….. Program Files…..Microsoft BizTalk Server 2010….. SDK….. EDI Interface Developer Tutorial….. ProcessEDI_TestLocations….... Scenario A….. toOrderSystem… The file name is messageid with the TXT file extension. The MessageID is a macro. You can find a list of available macros from the BizTalk help file….. You use the TXT extension because Order System expects the EDI messages in a text format….. The send handler is BizTalkServerApplication, and the send pipeline is SendOrderFilePipeline….. SendOrderFilePipeline is a custom pipeline to transform the purchase order message from Procurement System into a format expected by Order System. You deployed this pipeline to the EDISolution application when you deployed the Visual Studio project in the first video of this series…….

In real world scenarios, there could be large number of ports in a BizTalk Server application that are used to send and receive business messages. So, there has to be a mechanism to ensure that the send port transfers only the relevant messages. In this scenario, the send port you are creating should only transfer purchase order messages that come from Procurement System. To achieve this in your BizTalk Server application, you can add filters to the send port.…. Because the purchase order message from Procurement System comes through the receive port you created earlier, you can add a filter based on the name of the receive port….. The name of the receive port is promoted on the message by using message context properties…. Before we proceed with creating the send port, let us understand message context properties and how it helps route messages.

Let us assume that two separate receive ports, X and Y, receive incoming messages. After passing through the receive port, and before being published to the MessageBox database, BTS.ReceivePortName message property is promoted on both the messages. The value of the property is set to the name of the receive port through which the message is routed. The messages are then published to the MessageBox database. Now, a send port, which is only interested in the messages that come through receive port Y, can set a filter to pick only messages that have BTS.ReceivePortName context property set to Y. The relevant message is then picked up by the send port. For more information on message context properties, see http://go.microsoft.com/fwlink/?LinkId=200991.

Now, coming back to the send port configuration, you must add a filter based on the message context property for the receive port name, which is BTS.ReceivePortName….. You can do so from the Filters tab of the Send Port Properties dialog box…. In this scenario, the acknowledgement message that is published in the MessageBox database would also have the same receive port name set. So, you should add another filter to make sure the send port does not pick the acknowledgement message…. An EDI acknowledgement message has a specific message type (shown on your screen……) that is also promoted as a message context property, which is called BTS.MessageType…. So, you should add a filter to make sure the send port does “does not ” pick the messages of that type…. Also, make sure you used the AND operator for grouping both the filters…..

The send port also needs to make sure that the purchase order message coming from Procurement System is mapped to the schema of the message expected by the Order System. …..To do so, you must also add the map as part of the send port configuration.…..You can do so from the Outbound Maps tab of the Send Port Properties dialog box…… In the first video, we saw that the map, Inbound4010850_to_OrderFile, is part of the Visual Studio EDI solution and is deployed under the EDISolution application…… Save and start the send port.

Create a Send Port to Send the Acknowledgement to Procurement System

The second send port is to send the acknowledgement message back to Procurement System … create a new static one-way send port… Name it toTHEM_997… The send port uses the File adapter… the folder is C: drive….. Program Files…..Microsoft BizTalk Server 2010….. SDK….. EDI Interface Developer Tutorial….. ProcessEDI_TestLocations….... Scenario A….. toTHEM_997 … The file name is messageid with the TXT file extension … specify the send handler… Because the acknowledgement message is essentially an EDI message, select EdiSend as the send pipeline… For this send port, we need to make sure that it only picks the acknowledgement messages… To do so, we will again set a filter on the BTS.MessageType property, just like we did for the last send port we created. The only difference is that for this send port, we will set a filter such that the port “does” pick the acknowledgement message…… Save and start the send port.

This concludes the third video of the BizTalk Server 2010 EDI tutorial. In the next video, we’re going to show you how to use BizTalk Server Administration console to create the trading partner agreement between Procurement System and Order System. Thank you for watching.

************************************************************************************************************************************