Show Table of Contents
2.29. Processing a D03B UN/EDIFACT Message Interchange
- To process a D03B UN/EDIFACT message interchange, follow the example below:
Reading: // Create an instance of the EJC generated factory class... cache this and reuse !!! D03BInterchangeFactory factory = D03BInterchangeFactory.getInstance(); // Deserialize the UN/EDIFACT interchange stream to Java... UNEdifactInterchange interchange = factory.fromUNEdifact(ediInStream); // Need to test which interchange syntax version. Supports v4.1 at the moment... if(interchange instanceof UNEdifactInterchange41) { UNEdifactInterchange41 interchange41 = (UNEdifactInterchange41) interchange; for(UNEdifactMessage41 message : interchange41.getMessages()) { // Process the messages... Object messageObj = message.getMessage(); if(messageObj instanceof Invoic) { // It's an INVOIC message.... Invoic invoic = (Invoic) messageObj; ItemDescription itemDescription = invoic.getItemDescription(); // etc etc.... } else if(messageObj instanceof Cuscar) { // It's a CUSCAR message... } else if(etc etc etc...) { // etc etc etc... } } } Writing: factory.toUNEdifact(interchange, ediOutStream); - Use Maven to add the ability to process a D03B message interchange by adding the binding dependency for that directory (you can also use pre-generated UN/EDIFACT Java object models distributed via the Maven
SNAPSHOTandCentralrepositories):<dependency> <groupId>org.milyn.edi.unedifact</groupId> <artifactId>d03b-binding</artifactId> <version>v1.4</version> </dependency>

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.