The instructions in this article are targeted for a two-machine scenario where both trading partners involved in a B2B scenario have their BizTalk Server setup. If you are looking for a single-machine scenario, see Walkthrough: Sending EDI over AS2 with an Asynchronous MDN.
Note:To view a complete list of BizTalk Server articles that are available on the TechNet wiki, see BizTalk Server Resources on the TechNet Wiki.
We in the BizTalk Server CCxG team gratefully acknowledge the contributions of the following individuals for providing their valuable inputs for setting up the end-to-end scenario used in this article:
Note: If you are a new entrant into the world of EDI messaging, you might first want to familiarize yourself with some of the terms that you will read/hear when working with EDI messages. Most of these terms are related to the structure of an EDI message, such as interchange, transaction set, etc. A good place to start reading about these terms would be EDI Messaging.
Electronic Data Interchange (EDI) is the single most commonly used means by which business trading partners exchange data electronically. EDI is largely messaging-oriented. Documents are implemented as flat files that can include batched transaction sets. Batched interchanges can contain multiple groups, each of which can contain multiple transaction sets or messages.
EDI consists of specific data interchange methods agreed upon by standards bodies. The primary EDI standards are X12 (standardized by ANSI and used primarily in North America) and EDIFACT (standardized by the United Nations and used primarily outside the U.S.). Other standards are derived from these, for example, HIPAA from X12 and KEDIFACT in Korea from EDIFACT. The standards are closely parallel in message structure and acknowledgment schemes, but have distinct differences.
The EDI standards prescribe the following:
While the EDI standards establish the rules for the structure of the document, trading partners exchanging EDI messages must agree on the specific information to be transmitted and how it should be used. For example, the partners must agree on details like:
In the context of BizTalk Server, the process of defining these parameters of EDI message exchange is achieved by creating a "party" in the BizTalk Server Administration console and then setting the parameters as properties for the party. For more information, see EDI Support in BizTalk Server.
EDI messages are distinguished from their transport. The EDI standards do not prescribe message transport, and EDI messages can be sent by a variety of different means. One such medium is using AS2.
One of the most common ways of transferring EDI messages over the Internet is EDIINT-AS2 (EDI over the Internet - Applicability Statement 2), simply called AS2. AS2 uses the HTTP POST operation to send EDI, XML, or other business data. AS2 is not restricted to sending EDI data. In response to an AS2 message, a message disposition notification (MDN) is returned as an acknowledgment, provided the sender of the AS2 messages expects an MDN. Here are some quick bytes about AS2 transport:
For more information about AS2 messages, see AS2 Messaging.
Before we start discussing how BizTalk Server supports EDI messaging over AS2, let us understand a couple of terms:
One can use BizTalk Server in either of the following ways to set up EDI/AS2 messaging between trading partners:
Note: A home organization does not have to define itself as a party.
This article covers the second scenario where both the business partners have a BizTalk Server environment.
Now that we have defined the difference between a home organization and a partner organization, and who will create a party for whom, the next thing to understand is what properties are set for a party. You can set the following properties for a party:
Note: Configuring general and EDI properties are mandatory for setting up EDI message exchange. AS2 properties are required only if the trading partners are using AS2 transport to exchange messages. Messages can also be exchanged using other means such as using a file adapter, etc.
Now that we have covered some basics of EDI messaging and how BizTalk Server supports EDI, let us go over the scenario we will use in this article to demonstrate how you can use BizTalk Server to process EDI messages over AS2.
Note: The message is neither signed nor encrypted.
ISA*00* *00* *ZZ*THEM *ZZ*US *991221*1226*U*00401*000000025*0*T*>
GS*PO*THEM*US*19991221*1226*1*X*004010
ST*850*0001
BEG*00*NE*3859199838**950727***IBM
PER*AA*Andrew Carlson*TE*(708) 555-2930
DTM*002*970523
PO1*1*93*BX*145.39**CB*KOW-20392-10
PID*F****Uninterruptible Power System
PER*AA*Camilla Anderson*TE*(708) 555-2011
PO1*2*25*EA*35.68**CB*1093-4927-001
PID*F****High Volume Printer Stand
PER*AA*Miranda Cappelan*TE*(708) 555-1111
PO1*3*4*PC*2002.91**CB*ABX-2001
PID*F****Electronics Cabinet Package (56" High)
CTT*3
SE*14*0001
GE*1*1
IEA*1*000000025
Let us now see how both the trading partners will configure this scenario in their respective BizTalk Server environments.
To set up this scenario, you must have the following:
The main requirement at the Fabrikam side would be to simply send the message to Contoso using BizTalk Server and then receive an MDN. To achieve that, Fabrikam's BizTalk Server setup must have:
Most of the tasks related to the scenario such as processing the X12 message, generating the MDN and acknowledgements, sending the MDN and acknowledgements to Fabrikam, etc. happen in the Contoso's BizTalk Server setup. To achieve that, Contoso's BizTalk Server setup must have:
Note: If you are wondering how the MDN, 997, and TA1 appear in the message box, here's some quick information. When the AS2EdiReceive pipeline processes an X12 message, it stores the X12 message in the message box as XML and in parallel also creates MDN, 997, and TA1 also stores them in the message box. We'll discuss more about this when we get to the point where we create these ports.
The following illustration depicts how the scenario is set up for Fabrikam and Contoso.
Let us now start setting up the BizTalk Server environment for Fabrikam to send the X12/AS2 message to Contoso.
In this section, we will perform the tasks required at Fabrikam to set up the scenario we discussed above.
In this step, you will create a website for Fabrikam that will receive the MDNs and EDI acknowledgements sent from Contoso. Before we start creating the website, let us understand a few concepts. BizTalk Server ships a BTSHttpReceive.dll that is used to receive messages sent to a website. To use this DLL, it should be added to the IIS as web service extension, also called Internet Server API (ISAPI) extensions. ISAPI extensions extend the ability of your website which, by default, might only serve static content to reduce cyber threats. Now coming back to our scenario, this is what we need to do:
Let's start.
You must create a FILE receive port to get the X12 message into the BizTalk Server message box.
You must create an HTTP send port that will subscribe to the X12 message stored in the BizTalk Server message box and send it over to Contoso's website using the AS2 transport.
The MDN and EDI acknowledgements from Contoso will be sent to Fabrikam using AS2 and will be received by the Fabrikam's website. We need to have these messages moved to the BizTalk Server message box so that these can be routed to file folders, etc. To enable this, we need to create a receive port that will move the messages from the website to the BizTalk Server message box.
After the MDNs and EDI acknowledgements are stored in the message box database, you can create send ports that will subscribe to these messages and route them to file folders. In this step, we create a send port for routing MDNs. In the next step, we'll create a send port for routing EDI 997 and TA1 acknowledgements.
In this step you will create a send port that will route the EDI 997 and TA1 acknowledgements to a file folder.
Like mentioned previously, in the Fabrikam's BizTalk Server setup, you must create a party for the trading partner, i.e. Contoso, and then set the EDI properties on that party.
Verify that the message type of the test message is selected, for example, PO - Purchase Order (850).
Select X - Accredited Standards Committee X12.
Verify that the EDI version has been entered, for example, 00401.
Right-click the project, point to Add, and then click Existing Item. Move to the folder that your schema is in <drive>:\Program Files\Microsoft BizTalk Server 2006\XSD_Schema\EDI, and then double-click your schema. If the EDI schemas have not been unzipped into the \XSD_Schema\EDI folders, execute the MicrosoftEdiXSDTemplates.exe file in the \XSD_Schema\EDI folder to unzip the schemas into the default folder. Important: In this article, we will use the SamplePO.txt test message. So, you must use the X12_00401_850.xsd schema that is shipped in the <drive>:\Program Files\Microsoft BizTalk Server 2006\SDK\EDI Interface Developer Tutorial\ folder. You must not use the X12 850 schema in the <drive>:\Program Files\Microsoft BizTalk Server 2006\XSD_Schema folder.
Set the assembly key file, and then build and deploy the assembly. This would deploy the assembly under the default, BizTalk Application 1, application.
Make sure that BizTalk Application 1 has a reference to BizTalk EDI Application. This is required because all the schemas, pipelines, etc., required to process an EDI message are available under the BizTalk EDI Application. This application is created when you configure EDI/AS2 as part of the BizTalk Server configuration. For instructions on adding a reference, see How to Add a Reference to the BizTalk Server EDI Application.
You are now done with setting up the BizTalk Server environment and all the other requisites at Fabrikam's end.
In this section, we will perform the tasks required at Contoso to set up the scenario we discussed above.
In this step, you will create a website for Contoso that will receive the AS2-encoded X12 message from Fabrikam. So, similar to what you did in the Fabirkam's setup, creating a website for Contoso involves the following steps:
After Fabrikam sends the AS2-encoded X12 message to Contoso's website, an HTTP receive port will move that message from the site's virtual directory into the BizTalk Server message box database. You create that HTTP receive port in this step.
You have now created a receive port with the AS2EdiReceive pipeline that will process the AS2-encoded X12 message. As part of that, the receive pipeline will convert the X12 message to XML, generate the MDN, create the 997 and TA1 acknowledgements, and dump all of these into the message box.
We will now create the send ports that will pick these messages from the message box, route the X12 to a local folder, and send the MDN and acknowledgements back to Fabrikam.
You must create a FILE send port that will subscribe to the X12 message stored in the BizTalk Server message box.
The HTTP address where the MDN is to be sent to is present in header of the AS2 message that is received. You had set this HTTP address for the Request-Deliver-Option (URL) property, in the Party as AS2 Message Receiver page, when you set the AS2 properties for the Receiver party on the Fabrikam side. Because the HTTP address is already known, you only need to configure a dynamic send port.
You must create an HTTP send port that will subscribe to the 997 and TA1 acknowledgements stored in the BizTalk Server message box. This HTTP send port will send the acknowledgements back to the Fabrikam website.
In this section you create a party for Fabrikam in Contoso's BizTalk Server setupand then set the EDI properties on that party.
Select 850 - Purchase Order
Select http://schemas.microsoft.com/BizTalk/EDI/X12/2006
Make sure that BizTalk Application 1 has a reference to BizTalk EDI Application. This is required because all the schemas, pipelines, etc. required to process an EDI message are available under the BizTalk EDI Application. This application is created when you configure EDI/AS2 as part of the BizTalk Server configuration. For instructions on adding a reference, see How to Add a Reference to the BizTalk Server EDI Application.
You are now done with setting up the BizTalk Server environment and all the other requisites at Contoso's end.
We are now done with setting up BizTalk Server for AS2-encoded EDI messaging both at Fabrikam's and Contoso's end. Let us now run a quick test to verify the setup.
ISA*00* *00* *ZZ*THEM *ZZ*US *110206*1821*U*00401*000000069*0*T*:~
GS*PO*THEM*US*20110206*182120*45*X*00401~
ST*850*0045~
BEG*00*NE*3859199838**950727***IBM~
PER*AA*Andrew Carlson*TE*(708) 555-2930~
DTM*002*970523~
PO1*1*93*BX*145.39**CB*KOW-20392-10~
PID*F****Uninterruptible Power System~
PER*AA*Camilla Anderson*TE*(708) 555-2011~
PO1*2*25*EA*35.68**CB*1093-4927-001~
PID*F****High Volume Printer Stand~
PER*AA*Miranda Cappelan*TE*(708) 555-1111~
PO1*3*4*PC*2002.91**CB*ABX-2001~
PID*F****Electronics Cabinet Package (56" High)~
CTT*3~
SE*14*0045~
GE*1*45~
IEA*1*000000069~
--_02036ECC-C5FA-44CE-99BF-5A82DE051E90_ Content-Type: text/plain Content-Transfer-Encoding: binary Content-ID: {4D043AFB-B329-4DC8-8D71-2E585D7D3189} Content-Description: plain This is the MDN from Contoso to Fabrikam --_02036ECC-C5FA-44CE-99BF-5A82DE051E90_ Content-Type: message/disposition-notification Content-Transfer-Encoding: 7bit Content-ID: {46EF777B-8E32-42AA-9515-0A874E49F932} Content-Description: body Final-Recipient: rfc822; Receiver Original-Message-ID: <FABKAM-BIZTALK_769747C3-80B9-48DD-9DDF-F0753988CA3C> Disposition: automatic-action/MDN-sent-automatically; processed --_02036ECC-C5FA-44CE-99BF-5A82DE051E90_-- Notice the highlighted text. You had entered this text for the MDN Text property on the Party As AS2 Sender page in the party properties in Contoso's BizTalk Server setup.
--_02036ECC-C5FA-44CE-99BF-5A82DE051E90_ Content-Type: text/plain Content-Transfer-Encoding: binary Content-ID: {4D043AFB-B329-4DC8-8D71-2E585D7D3189} Content-Description: plain This is the MDN from Contoso to Fabrikam --_02036ECC-C5FA-44CE-99BF-5A82DE051E90_ Content-Type: message/disposition-notification Content-Transfer-Encoding: 7bit Content-ID: {46EF777B-8E32-42AA-9515-0A874E49F932} Content-Description: body Final-Recipient: rfc822; Receiver Original-Message-ID: <FABKAM-BIZTALK_769747C3-80B9-48DD-9DDF-F0753988CA3C> Disposition: automatic-action/MDN-sent-automatically; processed --_02036ECC-C5FA-44CE-99BF-5A82DE051E90_--
Notice the highlighted text. You had entered this text for the MDN Text property on the Party As AS2 Sender page in the party properties in Contoso's BizTalk Server setup.
ISA*00* *00* *ZZ*THEM *ZZ*US *110206*1821*U*00401*000000070*0*T*:~
GS*FA*US*THEM*20110206*1821*46*X*00401~
ST*997*0046~
AK1*PO*28~
AK9*A*1*1*1~
SE*4*0046~
GE*1*46~
IEA*1*000000070~
The TA1 TA1 acknowledgement would resemble the following ISA*00* *00* *ZZ*THEM *ZZ*US *110206*1821*U*00401*000000071*0*T*:~ TA1*000000028*110206*1821*A*000~ IEA*0*000000071~ If the message contents are as you expected, you have successfully transferred an AS2-encoded X12 message between two trading partners using BizTalk Server and received MDNs as well as acknowledgements.
The TA1 TA1 acknowledgement would resemble the following
ISA*00* *00* *ZZ*THEM *ZZ*US *110206*1821*U*00401*000000071*0*T*:~
TA1*000000028*110206*1821*A*000~
IEA*0*000000071~
If the message contents are as you expected, you have successfully transferred an AS2-encoded X12 message between two trading partners using BizTalk Server and received MDNs as well as acknowledgements.
Let us now understand how the message flow happens:
The AS2 encoder now sends the message to the HTTP adapter to be sent over to the Contoso's website. The message is now transferred to Contoso but is yet to be processed by Contoso's BizTalk Server setup. That is where the message will be validated and MDN/acknowledgements will be generated. At this stage, the AS2/MDN status report should say MDN Status as MDN Expected.
The AS2 encoder now sends the message to the HTTP adapter to be sent over to the Contoso's website. The message is now transferred to Contoso but is yet to be processed by Contoso's BizTalk Server setup. That is where the message will be validated and MDN/acknowledgements will be generated.
At this stage, the AS2/MDN status report should say MDN Status as MDN Expected.
At this stage, the XML message, the 997 acknowledgement in XML, and the TA1 acknowledgement in XML, and an MDN are all stored in the BizTalk Server message box database of Contoso. This is where the interchange gets in to the BizTalk Server setup at Contoso's end.
At this stage, the AS2/MDN status report should say MDN Status as Processed. The following illustration presents a graphical representation of the flow for ease of understanding.
At this stage, the AS2/MDN status report should say MDN Status as Processed.
The following illustration presents a graphical representation of the flow for ease of understanding.
For all troubleshooting information related to EDI, see Troubleshooting EDI and AS2 Solutions.
If you want to read and print this article using Microsoft Word, you can download it from my blog post here. The document is part of the attachment EDIAS2-Send-Receive-Scenario.zip. The zip also contains the MSIs for the BizTalk Server applications for both the machines. You can importing the MSI on different machines to set up the BizTalk Server environment for Fabrikam and Contoso. Importing the MSI will create/import the ports, parties, schemas, etc. used in this scenario. For instructions about how to import an MSI, see How to Import a BizTalk Application. After importing the applications you would still need to go and create any of the file locations that will be required for the FILE ports. However, I would strongly discourage you from using the MSIs. It would be a completely different learning experience if you build your application ground-up using the instructions in this article.
Read suggested related topics: