Is there any good X12 parser in Java? [closed]
Asked Answered
P

5

7

Is there any good X12 parser in Java which can process Walmart 810 specification?

EDI example:

ISA*00*          *00*          *16*102096559TEST  *14*PARTNERTEST    *071214*1406*U*00040*810000263*1*T*>
  GS*IN*102096559TEST*PARTNER*20071214*1406*810000263*X*004010
    ST*810*0001
      BIG*20050205*6463367*20050202*3376103367
      REF*IA*123456170*X5T
      REF*DP*00017
      REF*MR*0020
      N1*SU*SUPPLIER NAME
      N1*ST*WAL-MART 100*UL*0078742000992
        N3*406 SOUTH WALTON BLVD
        N4*BENTONVILLE*AR*72712 
      ITD*05*15*****45
      DTM*011*20050205
      FOB*CC
      IT1**1080*EA*3.61**IN*001719653*UP*022108955228*UK*            00221089552284       
        PID*F****ITEM DESCRIPTION
        SAC*A*I410***2350*******02
      TDS*387530
      CAD*T***RDWT*ROADWAY**BM*123456789
      ISS*1080*EA*100*LB
      CTT*1
    SE*19*0001
  GE*1*810000263
IEA*1*810000263
Pompidou answered 18/6, 2012 at 6:38 Comment(4)
Your question asks about EDIFACT, but your example is not EDIFACT - it is ANSI X12. Look at BOTS on SourceForge. Or look at a commercial translation product. Aren't you sending the 810 to Walmart? Seems to me you are GENERATING X12 (unless you work for Walmart or a "factor" agency and are getting carbon copied on the data), not parsing. You would parse the 997 coming back in.Doxia
@ Andrew you are correct. This is ANSI X12, not EDIFACTPompidou
I have implemented EDI to XML using java. Refer here: enter link description hereLothair
Check here: enter link description here#2794762Lothair
L
7

Try this, edireader

The parser differentiates between ANSI X.12 and EDIFACT EDI standards by inspection and uses a factory pattern to construct an appropriate parser subclass.

The parser can be embedded within your Java application in the same way as you would an XML parser, avoiding the file-based and proprietary interfaces often used with conventional EDI translators.

Leslileslie answered 18/6, 2012 at 6:47 Comment(1)
I am getting Recoverable syntax exception: com.berryworks.edireader.error.TransactionCountException - Transaction count error in GE segment. Expected 1 instead of 164 at segment 317, field 2 error when processing EDIPompidou
B
3

Try using Smooks. From the page:

Smooks is an extensible framework for building applications for processing XML and non XML data (CSV, EDI, Java, etc) using Java.

Breastplate answered 18/6, 2012 at 6:43 Comment(3)
I've also used it and it was pretty solid. I found the documentation a bit lacking but that was years ago. It might have changed.Bolometer
is it possible to process REF*IA*123456170*X5T REF*DP*00017 like elements in Smooks?Pompidou
Smooks doesn't support X12 and the project seems to be dead (the last change to the Git repo is from 2011).Alex
A
0

If you are open to a commercial product, have a look at the Oakland Data Transformer. It's written in Java, has an Eclipse-based designer, and a Java API or integration with Apache Camel, Mule ESB, and OSGi Blueprint. You can easily graphically map it to XML, database, Java objects or other things.

You will need to contact Oakland Software when you download it to get the specifications for the X12 4010 810 which is what you are using.

Avila answered 24/6, 2012 at 3:25 Comment(0)
T
0

you could try bots: http://bots.sourceforge.net it is not java, but python. it is not a 'library' but an application. handles x12 OK, incl 810. You can translate it to the format you need (xml, csv, flat file)

Tenorio answered 12/7, 2012 at 14:46 Comment(0)
C
0

We can use apache camel, camel is very easy and extensible solution of this,

This will give a json objects, afterthat we can parse the json objects then get the values.

XmlJsonDataFormat xmlJsonFormat = new XmlJsonDataFormat();
        xmlJsonFormat.setEncoding("UTF-8");
        xmlJsonFormat.setForceTopLevelObject(true);
        xmlJsonFormat.setTrimSpaces(true);
        xmlJsonFormat.setRootName("newRoot");
        xmlJsonFormat.setSkipNamespaces(true);
        xmlJsonFormat.setRemoveNamespacePrefixes(true);
    //  xmlJsonFormat.setExpandableProperties(Arrays.asList("d", "e"));

          from("file:sftpdata/x12files")
            .log("Before unmarshal with SmooksDataFormat:").log("${body}")
            .unmarshal(new SmooksDataFormat("smooks-config1.xml"))
            .log("After unmarshal with SmooksDataFormat:").log("${body}")
           .marshal(xmlJsonFormat)
             .log("After marshalling with Json library:").log("${body}")
             .process(new X12Processor()).log("X12 file processed")
            .to("mock:result");
Cookshop answered 15/7, 2016 at 6:15 Comment(1)
WHY would you use json when you could unmarshall directly into POJO? Why not use the JAXB pojo directly rather than convert the JAXB result to json object and then convert that back to POJO ??? The length people go to avoid using simply JAXB is baffling.Brittan

© 2022 - 2024 — McMap. All rights reserved.