Common errors in processing EDI documents using BizTalk Server 2013

Following are some errors I encountered while setting up an EDI in BizTalk Server 2013. These are quite common errors but I thought to write a post showing the exact reason of the problem which may help someone configuring EDI.

I will try to keep update this article the more errors I come across so it will be used as a reference.

ERROR 1: Agreement Resolution based on the context properties for x12 Protocol has failed

Resolution:

In order to resolve this error check the Identifiers values in parties agreement and when sending an EDI document specify the exact values that have been set for ISA6 and ISA8 in the identifiers tab of the Source Party agreement. These values should match the value of an EDI document for the same ISA6 and ISA6 properties.



In the above screen shot ISA6 and ISA8 values are PartyA and PartyB and the Sender and Receiver qualifiers are ZZ-Mutually Defined (X12)

So the EDI document header should be something like below

ISA^00^ ^00^ ^ZZ^PartyA ^ZZ^PartyB

 

 

 

ERROR 2: Delimiters are not unique, field and segment separator are the same. The sequence number of the suspended message is 1.

Resolution:

EDI document is fixed length format. This error comes up when the values length exceeded or does not meet the fixed length format. When structuring EDI document its better to define the values properly otherwise sometimes it becomes hard to rectify this type of error.

Step by Step guide of setting up an EDI in BizTalk Server 2013

What is an EDI

EDI – Electronic Data Interchange is an electronic communication medium that is use to exchange documents between different trading partners. EDI have specific text file format followed with specific version and document Id. For example, the Warehouse shipping order document is termed as 940 EDI document.

Why do company prefer EDI to exchange documents?

There are many benefits. Computer to computer exchange is much less expensive, cost is a primary reason, as it’s a standard every business understands and parse the documents easily.

Role of BizTalk Server

BizTalk server is a powerful server side product developed by Microsoft that is used for integrating distributed systems or applications. It acts as a middle hub where the businesses can submit documents and the destination client can get it in his specific format. It works on the publisher/subscriber model in which the client can subscribe to the incoming messages and the publisher publishes it to that port. On the other hand if you need to tweak some attributes of the document or to transform the inputted document into the client’s specific format can be done using mapping or pipeline.

Scenario

In this article I will give the complete step by step in sending 940 EDI document and converting it to the client’s specific XML format, and placing it to the destination folder.

  1. Open Visual Studio 2012. (With BizTalk 2013 you can create BizTalk projects using VS 2012)
  2. Create a new empty BizTalk project

     

     

  3. Specify name and click OK.
  4. As we have to process EDI 940 document we need to add its schema
  5. Right click the project and add existing schema from C:\Program Files (x86)\Microsoft BizTalk Server 2013\XSD_Schema\EDI

     

     

  6. Now create another schema which you wanted to send to the destination client.

     

     

  7. Now add some child elements into the schema as shown below

     

     

  8. Now add a map to provide mapping between the 940 schema file to our custom created schema file.

     

  9. Once this is added, we can see screen like this

     

     

  10. Now click on the Open Source schema and select 940 schema document

     

     

  11. Now click on the Open destination schema and select client specific one we recently created

     

  12. For demo only, I am mapping ST01 with OrderNo and ST02 with CompanyCode

     

 

  1. Save the project and build it.
  2. Before deploying sign the assembly from project properties signing tab

     

  3. Go to the deployment tab and select Restart host Instances to True and specify the Application Name

     

  4. Rebuild and deploy the solution, you will see the application added under the Applications
  5. Go to the BizTalk administrative console and you can see the application added in the Applications tab
  6. Now create a receive port where you will submit the EDI 940 text file.

    Right click the Receive Ports and click add New -> One way receive port

     

     

  7. In order to process EDI document we have add a reference to BizTalk EDI Application
  8. Right click the application and click properties
  9. Go to the references tab
  10. Add application reference as BizTalk EDI Application

     

     

  11. Click on the Receive Locations and add new receive location by hitting the New button
  12. Specify Receive location name as RecieveLocation
  13. Select Type as File as we will be putting the EDI txt file on particular folder
  14. Click configure to select the path and other attributes
  15. Specify the receive folder and select file mask as *.txt
  16. I have specified C:\demo\in as folder path where I will put EDI txt files

     

  17. Now add a send port where the file after processing by BizTalk will be send.

     

     

  18. In the SendPort window select TYPE as file and configure the path where the document will be placed after processing from BizTalk. I have selected file extension as .xml as I will be sending the custom formatter xml on the folder.
  19. Select send pipeline as XMLTransmit
  20. Add Outbound Maps and select the map you have created above.

     

  21. Specify Filter to process only those messages that have specific attributes.
  22. Here I will select BTS.RecievePortName = “RecievePort”

     

  23. Click Ok

     

     

Running Solution

Now when you place the EDI text file at C:\Demo\In folder it will be picked, transformed into client specific xml format and placed it into the C:\Demo\out folder by BizTalk Server.

Output file format looks like below

<?xml version=”1.0″ encoding=”utf-8″?><ns0:DemoData xmlns:ns0=”http://DemoPrj.clientspecific”><OrderNo>94A</OrderNo><CompanyCode>0001</CompanyCode></ns0:DemoData&gt;

 

Hope this helps to those who are new to BizTalk and EDI implementations.