This project has moved. For the latest updates, please go here.

Parse non-EDIFACT message in EDIFACT envelope?

Jun 9, 2013 at 4:48 PM
Hi

I need to parse EDIFACT envelopes to extract (non-EDIFACT) CARGO-IMP messages which are sent within them (and also construct envelopes for messages I construct elsewhere).

The input would be a file containing EDIFACT UNA,UNB,UNH and UNT,UNZ, and I'd need to extract what's between the UNH and UNT (which is not formatted by EDIFACT standards) and pass it as-is to some other parser.

Can EDIFabric help me with that, or does it require the entire file to be a proper EDIFACT interchange?

Thanks
Yitzchok
Coordinator
Oct 14, 2013 at 9:41 AM
Hi,

This is probably very much outdated, but Codeplex has stopped sending me notification when a new thread is posted - so apologies.
Regarding your question - the parser will assume this is an edifact message and will try to convert it, there is no way out of the box, to just parse the envelope.

However, if you look at InterchangeDirector class where the decomposition of raw edi messages happens, you can create your own InterchangeEdiBuilder. It will borrow the same implementation for the envelope, which works out the grouping etc. and in CreateMessage method, you can hook up your custom parser to deal with CARGO-IMP format. I think this will work very well and will be quite flexible.

You can even rework the identification step (GetInterchangeContext) and pass in the new format (CARGO-IMP) as origin, which will invoke the new parser routine. This way you'll be able to support both edifact and CARGO-IMP side by side.

Let me know if this have worked for you.

Regards,
Kamen
Oct 14, 2013 at 10:39 AM
Since the major complexity in the parsing for me would be with the CargoIMP messages, and aParse provided grammars for CargoIMP, I went with aParse and wrote the necessary grammars for the EDIFACT envelope in ABNF.

Thanks anyway!
Yitzchok
Coordinator
Oct 14, 2013 at 11:23 AM
I'm glad you found a solution. Never heard of CargoIMP before, good to know there is a parser for that as well.

Regards,
Kamen
Oct 14, 2013 at 5:14 PM
Yitzchok,
I was looking at possibly modifying edifabric for CargoImp, but since there are no XSD's like the ones provided for Edifact and X12, it made it hard to implement.

Our need for CargoIMP was to file EDI data to EU Customs for ICS. I had looked at aParse but it was in early beta and didn't see how to easily write ABNF. The company ended up using Champ which is part if SITA since I can FTP XML to them and they then convert it to CargoIMP to sent to the airline carriers.

Glad you hear your success with aParse,. Adding ABNF might be I nice addition to EdiFabric, but since my need for CargoImp is solved, I'm only using EdiFabric for normal X12 210\214... transactions which it does easily.

Regards,
Mike