2

Is there any Good EDI parser API in Java? I know this is already asked here, and I have gone through it.

I have an ANSI X12 EDI file. It is an 846 Inventory Inquiry document:

ISA*00*          *00*          *01*038211983      *ZZ*JWN-DSD        *130715*1540*U*00401*000015956*0*P*}
GS*IB*038211983*JWN-DSD*20130715*1540*15956*X*004010VICS
ST*846*159560001
BIA*00*MM*9480*20130715
REF*IA*103799
LIN**UP*887873083091
QTY*33*12*EA
LIN**UP*887873083107
QTY*33*13*EA
LIN**UP*887873083114
QTY*33*10*EA
LIN**UP*887873083121
QTY*33*6*EA
LIN**UP*887873083138
QTY*33*0*EA
SCH*0*EA***018*20391231

// Many lines this

LIN**UP*886732476371
QTY*33*0*EA
SCH*0*EA***018*20391231
LIN**UP*886732476388
QTY*33*0*EA
SCH*0*EA***018*20391231
SE*3283*159560001
GE*1*15956
IEA*1*000015956

From the link I mentioned above, I added edireader jar to my Java program. When I given the above file, the output XML was like this

<ediroot xmlns="http://www.berryworkssoftware.com/2008/edireader">
<interchange Standard="ANSI X.12" Date="130715" Time="1540" StandardsId="U" Version="00401" Control="000015956">
<sender>
<address Id="038211983 " Qual="01"/>
</sender>
<receiver>
<address Id="JWN-DSD " Qual="ZZ"/>
</receiver>
<group GroupType="IB" ApplSender="038211983" ApplReceiver="JWN-DSD" Date="20130715" Time="1540" Control="15956" StandardCode="X" StandardVersion="004010VICS">
<transaction DocType="846" Control="159560001">
<segment Id="BIA">
<element Id="BIA01">00</element>
<element Id="BIA02">MM</element>
<element Id="BIA03">9480</element>
<element Id="BIA04">20130715</element>
</segment>
<segment Id="REF">
<element Id="REF01">IA</element>
<element Id="REF02">103799</element>
</segment>
<segment Id="LIN">
<element Id="LIN02">UP</element>
<element Id="LIN03">887873083091</element>
</segment>
<segment Id="QTY">
<element Id="QTY01">33</element>
<element Id="QTY02">12</element>
<element Id="QTY03">EA</element>
</segment>
<segment Id="LIN">
<element Id="LIN02">UP</element>
<element Id="LIN03">887873083107</element>
</segment>
<segment Id="QTY">
<element Id="QTY01">33</element>
<element Id="QTY02">13</element>
<element Id="QTY03">EA</element>
</segment>
<segment Id="LIN">
<element Id="LIN02">UP</element>
<element Id="LIN03">887873083114</element>
</segment>
<segment Id="QTY">
<element Id="QTY01">33</element>
<element Id="QTY02">10</element>
<element Id="QTY03">EA</element>
</segment>
<segment Id="LIN">
<element Id="LIN02">UP</element>
<element Id="LIN03">887873083121</element>
</segment>
<segment Id="QTY">
<element Id="QTY01">33</element>
<element Id="QTY02">6</element>
<element Id="QTY03">EA</element>
</segment>
<segment Id="LIN">
<element Id="LIN02">UP</element>
<element Id="LIN03">887873083138</element>
</segment>
<segment Id="QTY">
<element Id="QTY01">33</element>
<element Id="QTY02">0</element>
<element Id="QTY03">EA</element>
</segment>
<segment Id="SCH">
<element Id="SCH01">0</element>
<element Id="SCH02">EA</element>
<element Id="SCH05">018</element>
<element Id="SCH06">20391231</element>

//Many lines

</segment>
</transaction>
</group>
</interchange>
</ediroot>

Don't know its correct or not. But the problem is edireader is not in maven. So we have to manually add. So in future if new version of EDI comes, it will not work with same edireader.

Smooks is not able to read X12 I think. I don't find it useful. And it needs to have some configuration file for reading file. So for each type for x12 file I will need different configuration

So is there any good Java EDI X12 Parser API?

Community
  • 1
  • 1
Coder
  • 6,948
  • 13
  • 56
  • 86
  • Your sample file is X12. It is an Inventory Inquiry/Advice document. Smooks' problem is that in the sample, it is neither X12 or EDIFACT, but a proprietary flat file. I don't expect anyone to make heads / tails of that. Why don't you look into something like MapForce (http://www.altova.com/mapforce.html)? Everyone here always wants to reinvent the wheel and doesn't bring anything new to the paradigm. EDI to XML translation has been beaten to death. – Andrew Jul 19 '13 at 18:37
  • How can I use it? Where can I download the API for that? I find only the trial version – Coder Jul 20 '13 at 04:08
  • MapForce is commercial software. You generate a map using their mapping utility, and it spits out Java code to embed in your application. I think you are using the term API incorrectly and just need to write your own text parser. This, of course, has its own set of problems - 997 generation, scalability, handling different delimiter sets. Which is why all of these standalone EDI translators exist. Yet people are forced to reinvent thirty year old wheels. – Andrew Jul 21 '13 at 20:48
  • So what if I have different edi files of same `inventory` type? Will the auto generated Java code be able to read all those files? or will it read only the File that we uploaded first time? – Coder Jul 22 '13 at 11:39
  • 846 documents could (and probably will) vary be trading partner. You could certainly make a generic map in the mapping tool to handle conditions based on partner, or you could create a map per partner to handle each specific document. In any EDI environment, that's a choice we usually have to make. There are trade-offs. To build a generic map to handle all partner requirements increases complexity of the map. To have a map per partner will increase your codebase. – Andrew Jul 22 '13 at 13:24
  • Also - this is why i recommend using commercial mapping/integration software that solves the problem of determining which partner sent data and what map to use and whether or not to generate a FA. Look at (http://liaison.com/products/transform/delta) to compare what your research with MapForce shows you. – Andrew Jul 22 '13 at 13:28
  • For Java, you may have some luck with the BOTS EDI system: https://github.com/bots-edi Main repo is here: https://github.com/bots-edi/bots – Michael Chrisco Feb 15 '19 at 20:37

0 Answers0