Java => EDI X12 270

92 views
Skip to first unread message

Prashant Khandagale

unread,
Jan 8, 2025, 2:49:52 AMJan 8
to Smooks Users
Hi Everyone, 
I am new to smooks and java...I am just doing a POC to transform java objects to EDI X12 270 Request.

I am using an example(edi-to-java-to-edi) from github. Somehow i am getting an error for EDISegment as "Cannot resolve symbol ibmEdiFmt:EDISegment". 

ASi am new to java..can anyone help me with this issus why it is happening.
also
Is it possible to transform java objects to EDI X12 270 format?

Thanks
Prashant

Claude Mamo

unread,
Jan 8, 2025, 4:52:15 AMJan 8
to smook...@googlegroups.com
Welcome to the Smooks community Prashant.

I am using an example(edi-to-java-to-edi) from github. Somehow i am getting an error for EDISegment as "Cannot resolve symbol ibmEdiFmt:EDISegment".

How are you running the example? I didn't have problems running it when I followed the instructions in the README.md.

Is it possible to transform java objects to EDI X12 270 format?

It is definitely possible as long as you don't mind writing your own DFDL schema, which edi:unparser references. The DFDL schema you author can be very simple or very complex, depending on your requirements. The Smooks docs was recently updated to include guidance about DFDL: https://www.smooks.org/documentation/#dfdl_guidance

I believe some members in the community are using Smooks for X12 integration so perhaps they can share their insights.

Claude

--
You received this message because you are subscribed to the Google Groups "Smooks Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to smooks-user...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/smooks-user/6bea365a-d53f-4118-b69f-0078bfbbcd8en%40googlegroups.com.

Prashant Khandagale

unread,
Jan 8, 2025, 5:15:31 AMJan 8
to Smooks Users
Hi Cloude,

Thank you for welcoming me into your community.

I am using IntelliJ IDEA for running/debugging purpose. 

Thanks 
Prashant

Claude Mamo

unread,
Jan 8, 2025, 5:23:34 AMJan 8
to smook...@googlegroups.com
Can't say why it won't run from IntelliJ but, assuming you have Maven installed, you should be able to run it with "mvn clean package exec:exec"

Prashant Khandagale

unread,
Jan 8, 2025, 5:34:38 AMJan 8
to Smooks Users
something might have happened in installation process....because same code is running on my friends machine.

Thanks Cloude

Prashant Khandagale

unread,
Jan 9, 2025, 5:21:48 AMJan 9
to Smooks Users
All My team members facing the same issues

Cannot resolve directoy EDIFact_Common and cannot resolve IBM_EDI_Format.dfdl.xsd

Anything we need to change...we are using the same examples as it is on github.. Still the issue

Claude Mamo

unread,
Jan 9, 2025, 5:30:39 AMJan 9
to smook...@googlegroups.com
Could you expand on this? Are you running it as per the instructions in the README (i.e., mvn clean install exec:exec)?

Prashant Khandagale

unread,
Jan 9, 2025, 5:49:44 AMJan 9
to Smooks Users
Yes, I am using the same...but still the errors.... i am not sure where  IBM_EDI_Format.dfdl.xsd   this file is located....but whatever i am using from that showing me error cannot resolve edisegments, edisegmentsequenceformat everything.

Claude Mamo

unread,
Jan 9, 2025, 6:11:40 AMJan 9
to smook...@googlegroups.com
I couldn't reproduce it on my machine. Make sure you are on Java 17 and that the smooks-examples repo is checked out on latest release tag (i.e., https://github.com/smooks/smooks-examples/tree/v5). If all else fails, please create a bug report.

Claude

Leonardo Amezquita

unread,
Jan 9, 2025, 7:51:55 AMJan 9
to smook...@googlegroups.com
Hellow, Prashant

Its possible that you need to describe this value in the configuration file are you have this line?

<xsd:import namespace="http://www.ibm.com/dfdl/EDI/Format"
schemaLocation="/EDIFACT-Common/IBM_EDI_Format.dfdl.xsd"/>

Prashant Khandagale

unread,
Jan 17, 2025, 2:05:34 AMJan 17
to Smooks Users

HI everyone,
I am using XML to EDI and I did DFDL mapping as well but facing one issue. I am using below xml 
<Root> <HL> <HL1>01</HL1> </HL> <NM> <NM01>001</NM01> </NM> <ISA> <ISA01>00</ISA01> </ISA> <GS> <GS01>HS</GS01> </GS> <HL> <HL1>02</HL1> </HL> <NM> <NM01>002</NM01> </NM> </Root>
In above xml HL and NM tags can occur multiple times(unbounded) and their order is not fixed. I tried using sequenceKind as Unordered but still it is not working.
Any suggestions for the same would be really helpful. 
Thanks
Prashant

Claude Mamo

unread,
Jan 17, 2025, 3:48:27 AMJan 17
to smook...@googlegroups.com
Daffodil should support unordered sequences. Are you getting an error? Could you post the schema?

Claude

Prashant Khandagale

unread,
Jan 17, 2025, 4:03:00 AMJan 17
to Smooks Users
HI Cloude,
I am getting below error
  expected element end event for {}Root, but received the element start event for {}HL. Unodered Sequencekind  

Attached the schema I am using for xml in above message

Thanks
PRashant
Sample.xml

Prashant Khandagale

unread,
Jan 20, 2025, 2:37:58 AMJan 20
to Smooks Users
Hi Everyone
 
Anyone know anything about this issue?

Thanks
Prashant

Leonardo Amezquita

unread,
Jan 20, 2025, 9:41:52 AMJan 20
to smook...@googlegroups.com
Hi Prashant.

I guess that you have some error in the mapping file, its possible to share that file to check cause according the message you are trying to map the xml file but the configuration don't recognize the elements in the xml and that is cause you need to modify the configuration file to accept the structure in your xml.

Regards

Prashant Khandagale

unread,
Jan 20, 2025, 10:14:56 AMJan 20
to Smooks Users
Hi ,
I am using below simple xml.  where ISA and GS will come once. but HL and NM can come multiple time and they can come in any order.

<Root>
    <ISA>
        <ISA01></ISA01>
        <ISA02></ISA02>
    </ISA>
    <GS>
        <GS01></GS01>
        <GS02></GS02>
    </GS>
    <HL>
        <HL01></HL01>
        <HL02></HL02>
    </HL>
    <NM>
        <NM01></NM01>
        <NM02></NM02>
    </NM>
    <HL>
        <HL01></HL01>
        <HL02></HL02>
    </HL>
    <NM>
        <NM01></NM01>
        <NM02></NM02>
    </NM>
</Root>

Please let me know if it is possible. I have been stuck there from last 4-5 days. 
I

Prashant Khandagale

unread,
Jan 20, 2025, 10:21:26 AMJan 20
to Smooks Users
This is xsd mapping for above xml 

 <xs:element name="Root">
        <xs:complexType>
            <xs:sequence dfdl:sequenceKind="unordered">
                <!-- ISA Element -->
                <xs:element name="ISA" type="ISAType" minOccurs="0" maxOccurs="1" dfdl:occursCountKind="implicit"/>
                <!-- GS Element -->
                <xs:element name="GS" type="GSType" minOccurs="0" maxOccurs="1" dfdl:occursCountKind="implicit"/>
                <!-- HL Element (Repeating) -->
                <xs:element name="HL" type="HLType" minOccurs="0" maxOccurs="unbounded" dfdl:occursCountKind="implicit"/>
                <!-- NM Element (Repeating) -->
                <xs:element name="NM" type="NMType" minOccurs="0" maxOccurs="unbounded" dfdl:occursCountKind="implicit"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>

    <!-- ISA Type -->
    <xs:complexType name="ISAType">
        <xs:sequence>
            <xs:element name="ISA01" type="xs:string" dfdl:length="2" dfdl:lengthKind="explicit"/>
        </xs:sequence>
    </xs:complexType>

    <!-- GS Type -->
    <xs:complexType name="GSType">
        <xs:sequence>
            <xs:element name="GS01" type="xs:string" dfdl:length="2" dfdl:lengthKind="explicit"/>
        </xs:sequence>
    </xs:complexType>

    <!-- HL Type -->
    <xs:complexType name="HLType">
        <xs:sequence>
            <xs:element name="HL1" type="xs:string" dfdl:length="2" dfdl:lengthKind="explicit"/>
        </xs:sequence>
    </xs:complexType>

    <!-- NM Type -->
    <xs:complexType name="NMType">
        <xs:sequence>
            <xs:element name="NM01" type="xs:string" dfdl:length="3" dfdl:lengthKind="explicit"/>
        </xs:sequence>
    </xs:complexType>

</xs:schema>

Mantra

unread,
Jan 20, 2025, 10:37:07 AMJan 20
to smook...@googlegroups.com
Hi Claude,

Is it the same issue to unparse where list of array elemnt trying to map with the xsd element where maxOccur is unbounded to get output as edi? Just guessing.

@Prashant, did you try to sent only one item of in the xml file and have xsd maxOccurs as 1. Make just simple xml file for test.   just to test if you still getting the same error?


Regards,
M


Prashant Khandagale

unread,
Jan 21, 2025, 6:04:20 AMJan 21
to Smooks Users
Hi Mantra


I tried using the simple xml with maxOccurs is 1 as the xml i shared was not working.
<root>
<A></A>
<B></B>
<C></C>
</root>

It is still giving me same error message.

Thanks
Prashant

Leonardo Amezquita

unread,
Jan 21, 2025, 12:04:43 PMJan 21
to smook...@googlegroups.com
Hi Prashant.

i guess you dont have a little part in the sequence definition. but normally you have multiple values there do you have a expected edi format i'm going to share with you the line that i didn't see in your definition and the definition that i have for an ISA.

<xsd:sequence dfdl:ref="ibmEdiFmt:EDISegmentSequenceFormat">

<xsd:element dfdl:initiator="ISA" dfdl:ref="ibmEdiFmt:EDISegmentFormat" name="ISA">
<xsd:complexType>
<xsd:sequence dfdl:ref="ibmEdiFmt:EDISegmentSequenceFormat">
<xsd:element minOccurs="0" name="ISA01__AuthorizationInformationQualifier" type="xsd:string"/>
<xsd:element minOccurs="0" name="ISA02__AuthorizationInformation" type="xsd:string"/>
<xsd:element minOccurs="0" name="ISA03__SecurityInformationQualifier" type="xsd:string"/>
<xsd:element minOccurs="0" name="ISA04__SecurityInformation" type="xsd:string"/>
<xsd:element minOccurs="0" name="ISA05__InterchangeIdQualifier" type="xsd:string"/>
<xsd:element name="ISA06__InterchangeSenderId" type="xsd:string"/>
<xsd:element minOccurs="0" name="ISA07__InterchangeIdQualifier" type="xsd:string"/>
<xsd:element minOccurs="0" name="ISA08__InterchangeReceiverId" type="xsd:string"/>
<xsd:element minOccurs="0" name="ISA09__InterchangeDate" type="xsd:string"/>
<xsd:element minOccurs="0" name="ISA10__InterchangeTime" type="xsd:string"/>
<xsd:element minOccurs="0" name="ISA11__InterchangeControlStandarsIdentifier" type="xsd:string"/>
<xsd:element minOccurs="0" name="ISA12__InterchangeControlVersionNumber" type="xsd:string"/>
<xsd:element minOccurs="0" name="ISA13__InterchangeControlNumber" type="xsd:string"/>
<xsd:element minOccurs="0" name="ISA14__AcknowledgmentRequest" type="xsd:string"/>
<xsd:element minOccurs="0" name="ISA15__UsageIndicator" type="xsd:string"/>
<xsd:element minOccurs="0" name="ISA16__ComponentElementSeparator" type="xsd:string"/>
<xsd:element minOccurs="0" name="ISA17__PaymentMethodCode" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>

Regards buddy.

Leonardo Amezquita

unread,
Jan 21, 2025, 12:09:08 PMJan 21
to smook...@googlegroups.com
hi Prashant,

I forget to say. in the definition of the first part for the element that call the complexType the way to call it is this.

<xsd:element ibmSchExtn:docRoot="true" name="Root">
<xsd:complexType>
<xsd:sequence>
<xsd:sequence>
<xsd:element minOccurs="0" ref="ISA"/>

Message has been deleted

Prashant Khandagale

unread,
Jan 22, 2025, 6:22:49 AMJan 22
to Smooks Users
Hi Leonardo,

Thank you so much for your response. 

I am attempting to use xmlns:ibmSchExtn="http://www.ibm.com/dfdl/extensions" along with ibmSchExtn:docRoot="true" in my schema, but IntelliJ IDEA does not recognize these attributes. I have added the extension link in the "Schemas and DTDs" section, but the issue persists.

I also have similar ISA, but, I am providing a simplified version for reference.

I also need details on how elements like HL and NM01 should be implemented since they can occur multiple times and appear in any sequence. I have tried defining the sequence with sequenceKind="unordered", maxOccurs="unbounded", and occursCountKind="parsed". Despite this, I encounter the following error during parsing:

Expected element end event for {}Root, but received the element start event for {}HL.

 

Could you assist in understanding:

  1. I am using IntelliJ IDEA and it is not recognizing the ibmSchExtn:docRoot="true" attribute and any steps to resolve this? or could you help with the setup details you tried? 
  2. How to correctly define and handle elements like HL and NM01 in a schema where they can occur multiple times in any sequence?

I would appreciate a detailed explanation of your approach to implementing such structures in DFDL.

Thanks
Prashant

Reply all
Reply to author
Forward
0 new messages