Click here to Skip to main content
15,886,833 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I have converted any edi file to xml using this repository edifact-reader-github-repository[^]. For an instance see in the following xml file:

This is my un/edifact file:

UNB+UNOA:1+US::US+50138::THEM+140531:0305+001934++ORDERS'
UNH+1+ORDERS:91:2:UN'
BGM+220+A761902+4:20140530:102+9'
RFF+CT:EUA01349'
RFF+AAV::C'
TXT+THIS IS WHAT AN EDI MESSAGE WOULD LOOK LIKE... '
NAD+BY++OUR NAME PLC::::+++++EW4 34J'
CTA+PD'
COM+01752 253939:TE+01752 253939:FX+0:TL'
CTA+OC+:A.SURNAME'
COM+2407:EX'
CTA+TI+:B.BROWN'
COM+0:EX'
CTA+SU'
COM+0161 4297476:TE+01752 670633:FX'
UNT+15+1'
UNZ+1+001934'


and this is my xml file that converting by edifact file:

<?xml version="1.0" encoding="UTF-8"?>
<ediroot>
    <interchange Standard="EDIFACT" SyntaxId="UNOA" SyntaxVersion="1" Date="140531" Time="0305" Control="001934" ApplRef="ORDERS" Decimal=".">
        <sender>
            <address Id="US" Qual="" Extra="US"/>
        </sender>
        <receiver>
            <address Id="50138" Qual="" Extra="THEM"/>
        </receiver>
        <group>
            <transaction Control="1" DocType="ORDERS" Version="91" Release="2" Agency="UN">
                <segment Id="BGM">
                    <element Id="BGM01">220</element>
                    <element Id="BGM02">A761902</element>
                    <element Id="BGM03" Composite="yes">
                        <subelement Sequence="1">4</subelement>
                        <subelement Sequence="2">20140530</subelement>
                        <subelement Sequence="3">102</subelement>
                    </element>
                    <element Id="BGM04">9</element>
                </segment>
                <segment Id="RFF">
                    <element Id="RFF01" Composite="yes">
                        <subelement Sequence="1">CT</subelement>
                        <subelement Sequence="2">EUA01349</subelement>
                    </element>
                </segment>
                <segment Id="RFF">
                    <element Id="RFF01" Composite="yes">
                        <subelement Sequence="1">AAV</subelement>
                        <subelement Sequence="3">C</subelement>
                    </element>
                </segment>
                <segment Id="TXT">
                    <element Id="TXT01">THIS IS WHAT AN EDI MESSAGE WOULD LOOK LIKE... </element>
                </segment>
                <segment Id="NAD">
                    <element Id="NAD01">BY</element>
                    <element Id="NAD03" Composite="yes">
                        <subelement Sequence="1">OUR NAME PLC</subelement>
                    </element>
                    <element Id="NAD08">EW4 34J</element>
                </segment>
                <segment Id="CTA">
                    <element Id="CTA01">PD</element>
                </segment>
                <segment Id="COM">
                    <element Id="COM01" Composite="yes">
                        <subelement Sequence="1">01752 253939</subelement>
                        <subelement Sequence="2">TE</subelement>
                    </element>
                    <element Id="COM02" Composite="yes">
                        <subelement Sequence="1">01752 253939</subelement>
                        <subelement Sequence="2">FX</subelement>
                    </element>
                    <element Id="COM03" Composite="yes">
                        <subelement Sequence="1">0</subelement>
                        <subelement Sequence="2">TL</subelement>
                    </element>
                </segment>
                <segment Id="CTA">
                    <element Id="CTA01">OC</element>
                    <element Id="CTA02" Composite="yes">
                        <subelement Sequence="2">A.SURNAME</subelement>
                    </element>
                </segment>
                <segment Id="COM">
                    <element Id="COM01" Composite="yes">
                        <subelement Sequence="1">2407</subelement>
                        <subelement Sequence="2">EX</subelement>
                    </element>
                </segment>
                <segment Id="CTA">
                    <element Id="CTA01">TI</element>
                    <element Id="CTA02" Composite="yes">
                        <subelement Sequence="2">B.BROWN</subelement>
                    </element>
                </segment>
                <segment Id="COM">
                    <element Id="COM01" Composite="yes">
                        <subelement Sequence="1">0</subelement>
                        <subelement Sequence="2">EX</subelement>
                    </element>
                </segment>
                <segment Id="CTA">
                    <element Id="CTA01">SU</element>
                </segment>
                <segment Id="COM">
                    <element Id="COM01" Composite="yes">
                        <subelement Sequence="1">0161 4297476</subelement>
                        <subelement Sequence="2">TE</subelement>
                    </element>
                    <element Id="COM02" Composite="yes">
                        <subelement Sequence="1">01752 670633</subelement>
                        <subelement Sequence="2">FX</subelement>
                    </element>
                </segment>
            </transaction>
        </group>
    </interchange>
</ediroot>


What I have tried:

What I want to do right now is this.I want to do this by using a library that translates any xml-i java model classes to my classes. But here's the part I'm having trouble with. Which of the variables I will create in my model class will give the data in my edifact file. I mean, I don't know which of the texts in my edifact file store what value.
Posted
Updated 5-Mar-23 4:45am

 
Share this answer
 
Comments
vor_zakon_developer 5-Mar-23 10:37am    
you can't understood me. I mean, I want to know what the data which is also edi file means.For example, name, surname, which segment does it start with? Let me create my java classes accordingly.
How about you Google for "EDIFACT documentation" and start reading.
 
Share this answer
 
Comments
vor_zakon_developer 5-Mar-23 11:45am    
sometime people always offer read documentation instead of solving a problem and I always seen such a people that I relaized that this people doesn't know anything about solving problem, that's why he/she reccomended documentation. and also edifact documentation doesn't help me it just said that this is our protocol etc. etc. seriosly what exactly relationship between documentation and my problem?
Dave Kreskowiak 5-Mar-23 11:51am    
I quote:
"How can we understand what the data in the edifact file belongs to?"

THAT'S WHAT THE DOCUMENTATION IS FOR!

Now, for creating your classes for you, how is any web service going to know what to create from a sample file you give it to use UNLESS THE SAMPLE FILES CONTAIN EVERY SINGLE OPTION FOR EVERY NODE TYPE AND ATTRIBUTE?

It can't. It can only create classes for what you give it. This is where the documentation comes in and YOU will have to modify the classes to account for the options the web service could never have known about.

THAT is why you cannot just throw a sample as a web service and expect it to return a completely useful class.
vor_zakon_developer 5-Mar-23 12:23pm    
Our un edifact message format is pnrgov it means that passenger and airlines data interchange how to know where is located passenger first name ? which segments contains its value? your documentation doesn't teach it unfortunately.
Dave Kreskowiak 5-Mar-23 12:26pm    
EDIFACT is the top of the document tree, NOT THE ENTIRE TREE.

Google for "edifact pnrgov documentation" and you'll find what you're looking for.

Stop being such an idiot and start thinking. Your project will thank you for it.
vor_zakon_developer 5-Mar-23 12:30pm    
May I know which version and message format of this edi file from our company? Can you tell me what types of messages are usually?I don't have much time to think because I don't know where to start since there is extra information in the documentation.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900