Search code examples
c#translationedialtovaedifact

EDIFACT to DB Objects or DB


I'm looking for a tool that provides both C# API that we can use in code and a Script to transform an EDIFACT File (ISO 9735) to XML or other formats such as CSV. We are building a system that will help us to translate EDIFACT data that we get from Client and save in DB or DB objects.

Question: 1. Can you please recommend any cost effective Tool we can use that will help us to translate EDIFACT (ISO 9735) Data to Other formats such as XML or CSV or DB objects etc. I need both C# API and SCRIPT.

  1. Is there any open source API available to do this Job ? A sample EDIFACT file Data is provided below.

Thanks, Partha

FAD+114:526411642:4::TKFAD:1:1+20141220:070825037+1+20141220:070825037'VAI+S:KK+CH:75799099'MGA+S:SSSS+1+1+20141220'OFI+S:SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS+CH:804522+C+175+20150821++3044848+211444238+1+1+100+100+2+CH:804522+++2015:08:21+T1:333'FMB+S:SSSSSSSSSSSSSSSS+8++4+1++3+20141220+++TKN:4+++2+501'FMU+S:K+1'VAK+S:KKSSSS+TKN:4+PANERA C 175 AUG15+Option on equity+Call August 175'VAL+S:KKSS+TKN:1+OCC/O PANERA 08 2015 C 175+OCC/O PANERA 08 2015 C 175'VAL+S:KKSS+TKN:2+OCC/O PANERA 08 2015 C 175+OCC/O PANERA 08 2015 C 175'VAL+S:KKSS+TKN:3+OCC/O PANERA 08 2015 C 175+OCC/O PANERA 08 2015 C 175'VAL+S:KKSS+TKN:4+OCC/O PANERA 08 2015 C 175+OCC/O PANERA 08 2015 C 175'GEI+S:KK+GK:709030'GEK+I:KKI+TKN:4+OCC'NKN+S:KSSSS+CH:75799099+20141220++2'FMG+S:KSS+TKT+Z'FMG+S:KSS+TKPRK+1'FMG+S:KSS+CFI+OCASPS+3


Solution

  • There are various C#/Java parsers on the internet to map EDIFACT to XML or vice versa. One example is https://github.com/DonZoeggerle/ediFabric. Look here for a comparison of several packages.

    Example DTM segment from an MSCONS message:

    DTM+137:200603241322:203'
    

    Corresponding XML snippet:

    <DTM_Date_Time_Period_0030>
      <Date_Time_Period>
        <Date_Time_Period_010>
          <C507_Date_Time_Period>
            <Date_Or_Time_Or_Period_Function_Code_Qualifier_010>137
            </Date_Or_Time_Or_Period_Function_Code_Qualifier_010>
            <Date_Or_Time_Or_Period_Text_020>200603241322
            </Date_Or_Time_Or_Period_Text_020>
            <Date_Or_Time_Or_Period_Format_Code_030>203
            </Date_Or_Time_Or_Period_Format_Code_030>
          </C507_Date_Time_Period>
        </Date_Time_Period_010>
      </Date_Time_Period>
    </DTM_Date_Time_Period_0030>
    

    It becomes apparent that XML might take much more space than EDIFACT.

    There seems to be no commonly accepted standard how to represent EDIFACT in XML. It is possible to map every EDIFACT segment into an XML construct. This requires to split the EDIFACT segment into data elements and data fields and translate them to XML tags and/or attributes. But this "flat" representation does not reflect the nested structure of most EDIFACT messages. Without knowing the underlying message structure, a parser cannot translate into a meaningful XML.

    The pure mapping of EDIFACT to XML is only a small fraction of the bill. Other required steps include:

    • communication between the business partners (mail, AS2, managed file transfer)
    • acknowledgements (sending/receiving EDIFACT CONTRL/APERAK messages)
    • encryption/decryption
    • signature/validation
    • administration of B2B partner data (addresses, message types, contacts, ...)
    • error handling
    • performance management
    • splitting and joining messages
    • message routing
    • spam protection
    • logging/monitoring

    This long list gives good reasons to look at commercial B2B platforms if you have more than a handful of B2B connections to be taken care of.