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 Interchanges.
This article applies to BizTalk Server 2006 R2 and BizTalk Server 2009. For information on how to set up B2B messaging between two trading partners using BizTalk Server 2010, see Developing and Configuring BizTalk Server EDI Solutions.
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.
Before we start discussing how BizTalk Server supports EDI messaging, let us understand a couple of terms:
One can use BizTalk Server in either of the following ways to set up EDI messaging between trading partners:
This article covers the second scenario where both the business partners have a BizTalk Server environment.
We are now clear about home organizations and partner organizations 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:
Now that we have understood some basics of EDI messaging and how BizTalk Server supports EDI, let us understand the scenario we will use in this article to demonstrate how you can use BizTalk Server to process EDI messages.
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 setup 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. 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 acknowledgements, sending the acknowledgements to Fabrikam, etc. happen in the Contoso's BizTalk Server setup. To achieve that, Contoso's BizTalk Server setup must have:
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 message to Contoso.
In this section, we will perform the tasks required at Fabrikam to set up the scenario we discussed above.
The reason for sharing the two folders with everyone is just for ease of operation and only for the purpose of demo. That's because the acknowledgements will be copied over to these folders from a remote computer.
You must create a FILE receive port to get the X12 message into the BizTalk Server message box.
You must create a FILE send port that will subscribe to the X12 message stored in the BizTalk Server message box.
Like mentioned above, 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.
But, why do we need to add these headers when they are already present in the message that is sent to BizTalk Server? When the EdiReceive pipeline (of the ReceiveX12 receive port) processes the message, it rips of the ISA and GS headers from the message, converts it to XML, and then dumps it to the message box database. Now, when that message is picked up from the message box, before sending it to the desired party, the ISA and GS headers have to be added again to the message. In this step, we provided the information to add the ISA header. In the next steps, we provide the information to add the GS headers.
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.
You must create a FILE receive port that will route the X12 message received from Fabrikam into Contoso's BizTalk Server. The X12 message that is received at C:\Messages\ReceiveX12 is like a request message that has come in. It must be processed by Contoso's BizTalk Server to generate the acknowledgements.
You have now created a receive port with the EdiReceive pipeline that will process the X12 message. As part of that, the receive pipeline will convert the X12 message to XML, 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 and route it to designated FILE folders.
You must create a FILE send port that will subscribe to the 997 acknowledgement message stored in the BizTalk Server message box.
You must create a FILE send port that will subscribe to the TA1 acknowledgement message stored in the BizTalk Server message box.
In this section you create a party for Fabrikam in Contoso's BizTalk Server setupand then set the EDI properties on that party.
THEM
ZZ-Mutually Defined
For more information on how BizTalk Server uses these values to determine the party for incoming EDI messages, see Party Resolution, Schema Discovery, and Authorization for Received EDI Messages.
Select 850 - Purchase Order
Select http://schemas.microsoft.com/BizTalk/EDI/X12/2006
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 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~
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~
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 EDI X12 message between two trading partners using BizTalk Server.
Let us now understand how the message flow happens:
Because all these send ports are associated with the Sender party, they will use the settings specified on the party (under Party as Interchange Receiver) to create the X12 and acknowledgement message before sending them back to Fabrikam. The following illustration presents a graphical representation of the flow for ease of understanding.
You now have a elaborate two-machine setup now but we can do more. To start with, you can change the values in the EDI properties for the party and see how the output message changes accordingly. That would give you a better understanding of how this works. However, there's one scenario that you can add on to the existing setup.
In the scenario we just tested, the 997 and TA1 acknowledgements are received on a shared folder on the Fabrikam side of the setup. These acknowledgements are simply copied over to the Fabrikam side and are never processed by the BizTalk Server at Fabrikam's side. So, in effect, this will be termed as an "out of band" receipt of the acknowledgements. So, you can extend the current scenario to have both 997 and TA1 acknowledgements processed by the BizTalk Server setup at the Fabrikam side. This is how you should go about doing this:
Once you have done this, you will have a setup where every message transfer (interchange as well as acknowledgements) is processed through BizTalk Server.
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 EDI-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 on 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.
Another important place to find a huge amount of BizTalk related articles is the TechNet Wiki itself. The best entry point is BizTalk Server Resources on the TechNet Wiki. Read suggested related topics: