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
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.
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.
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.
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.
- Open Visual Studio 2012. (With BizTalk 2013 you can create BizTalk projects using VS 2012)
Create a new empty BizTalk project
- Specify name and click OK.
- As we have to process EDI 940 document we need to add its schema
Right click the project and add existing schema from C:\Program Files (x86)\Microsoft BizTalk Server 2013\XSD_Schema\EDI
Now create another schema which you wanted to send to the destination client.
Now add some child elements into the schema as shown below
Now add a map to provide mapping between the 940 schema file to our custom created schema file.
Once this is added, we can see screen like this
Now click on the Open Source schema and select 940 schema document
Now click on the Open destination schema and select client specific one we recently created
For demo only, I am mapping ST01 with OrderNo and ST02 with CompanyCode
- Save the project and build it.
Before deploying sign the assembly from project properties signing tab
Go to the deployment tab and select Restart host Instances to True and specify the Application Name
- Rebuild and deploy the solution, you will see the application added under the Applications
- Go to the BizTalk administrative console and you can see the application added in the Applications tab
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
- In order to process EDI document we have add a reference to BizTalk EDI Application
- Right click the application and click properties
- Go to the references tab
Add application reference as BizTalk EDI Application
- Click on the Receive Locations and add new receive location by hitting the New button
- Specify Receive location name as RecieveLocation
- Select Type as File as we will be putting the EDI txt file on particular folder
- Click configure to select the path and other attributes
- Specify the receive folder and select file mask as *.txt
I have specified C:\demo\in as folder path where I will put EDI txt files
Now add a send port where the file after processing by BizTalk will be send.
- 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.
- Select send pipeline as XMLTransmit
Add Outbound Maps and select the map you have created above.
- Specify Filter to process only those messages that have specific attributes.
Here I will select BTS.RecievePortName = “RecievePort”
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>
Hope this helps to those who are new to BizTalk and EDI implementations.