Read EDI X12 Documents in Mulesoft
X12 EDI Connector lets you convert X12 messages to and from DataWeave-compatible representations using lists and maps.
Prerequisites:
The user should be familiar with X12 Document format, Mule, Anypoint Connectors, Anypoint Studio, Mule flows, and Mule Global Elements.
1.EDI Read:
In this example we’ll try to read a 945.edi file using File Read connector and log the resultant payload
Below is how the 945.edi document looks like:
Below is how the flow is designed in Anypoint
1.1 Configure EDI Read connector as show below:
Figure:1
General Tab:
Add schema definition (for example /x12/004010/945.esl) as shown in figure 1
Schema Definition path:
Soon after adding x12 read connecto into flow ,we see x12 dependency being added to explorer under respective project
X12 EDI –>x12-schemas-<version>.jar –> <Select x12 version>(in this case it’s 004010) →<select transaction type>(in this case 945)
right click then select “Copy Qualified Name”
Identity Tab:
Figure:2
Mule ID Qualifier: ISA05/ISA07
Mule interchange ID:ISA06/ISA08
Partner ID Qualifier:ISA05/ISA07
Partner Interchange ID:ISA06/ISA08
Result(Debugging Mode) :
We can see Error listed is null array[] .This indicates that input data is successfully read using x12 Read connector
Figure:3
The above example uses the standard EDI X12 schema. We can use Overlay Schema If we need to override the standard schema based on business requirements. Reach out to the 79Consulting team to find out how.