edifact-to-xml - Assertion failed: Unsupported syntax version

141 views
Skip to first unread message

Benjamin A.

unread,
Oct 13, 2022, 9:21:54 AM10/13/22
to Smooks Users
Hi Smooks Users,

I start with Smooks.

I base myself on version 2.0.0-RC1

I have exceptions for converting edifacts to XML, more specifically INVOIC, IFCSUM or DESADV type messages.
I started from the PAXLST example (edifact-to-xml) which works very well.

For my tests, I adapted:


* the pom.xml on changing the classifier reference of the  cartridges.edi dependency

<dependency>
            <groupId>org.smooks.cartridges.edi</groupId>
            <artifactId>edifact-schemas</artifactId>
            <version>${smooks.version}</version>
            <classifier>d13a</classifier>
        </dependency>


* the "smooks-config" with a change of reference for the messageType

  <edifact:parser schemaURI="/d13a/EDIFACT-Messages.dfdl.xsd">
        <edifact:messageTypes>
            <edifact:messageType>IFCSUM</edifact:messageType>
        </edifact:messageTypes>
    </edifact:parser>

* my input.edi :

UNB+UNOC:1+808634141:22+798 867 297:22+200522:0934+16107D11'UNH+16107D11001+IFCSUM:D:13A:UN:GTF511'BGM+307+0041431354+9'DTM+137:202005220934:203'CNT+10:4'RFF+AFB:0041431354'NAD+MS+80863414100143:05:107++PLF'NAD+MR+79886729700029:05:107++TRANSPORTS TIMON'TDT+20++3'RFF+ADD:123654'CNI+1+:9+1,5'DTM+398:202005250900:203'DTM+2:202005261500:203'CNT+7:10000:KGM'CNT+56:20'CNT+57:5:MTR'CNT+16:20'FTX+DEL+++RDV LIVRAISON A CONFIRMER+FR'FTX+AAA+++CHARPENTES METALLIQUES+FR'TOD+6+PP'RFF+UCN:1420042432'RFF+AAS:87965417'RFF+DQ:BL0399'RFF+AAO:CDE 542624 du 20/05/2020'NAD+CN+++CHARPENTES METALLIQUES+363 AVENUE PIERRE GRAND+CAVAILLON++84300+FR'LOC+172+43.823069+5.044133'COM+?+33490786666:TE'NAD+SF+++CM SAS+15 CHEMIN DES ERABLES+TALUYERS++69440+FR'LOC+172+45.636980+4.732733'COM+?+33478483504:TE'GID+1+20:EP'CNI+2+:9+1,3'DTM+398:202005250900:203'DTM+2:202005261330:203'CNT+7:3000:KGM'CNT+56:7'FTX+DEL+++LIVRAISON PAR LE COTE+FR'FTX+AAA+++POUDRE ET PIECES METALLIQUES+FR'TOD+6+PP'RFF+UCN:1420042433'RFF+AAS:87965418'RFF+DQ:BL0378'RFF+AAO:CHARLY 5332'NAD+CN+++ATELIER MECANIQUE POLE METAL+QUARTIER ST ESTEVE – ROUTE DE MAURAN+BERREL?'ETANG++13130+FR'LOC+172+43.504478+5.148656'CTA+IC+:CHARLY'COM+?+33442853599:TE'NAD+SF+++CM SAS+15 CHEMIN DES ERABLES+TALUYERS++69440+FR'LOC+172+45.636980+4.732733'COM+?+33478483504:TE'GID+1+4:44'GID+2+3:JB'CNI+3+:9+2,4'DTM+398+202005251330202005251530:719'DTM+2:202005261000:203'CNT+7:5000:KGM'CNT+56:10'FTX+AAA+++PEINTURER+FR'TOD+6+PP'RFF+UCN:1410042389'RFF+AAS:85965310'RFF+AAO:PO236987'NAD+SF+++VENISSIEUX PEINTURE+9 AVENUE PIERRE SEMARD+VENISSIEUX++69200+FR'LOC+172+45.708563+4.877358'COM+?+33967516726:TE'NAD+CN+++SCANN PEINTURE+7 AVENUE DE ROME+VITROLLES++13127+FR'LOC+172+43.430373+5.255122'COM+?+33442890977:TE'GID+1+10:08'DGS+ADR+3:F1+1263++1++3++1+D/E'FTX+AAD++PEINTURE'FTX+PKG++3A1:BIDON METALLIQUE'MEA+AAE+AAX+LTR:1800'MEA+AAE+AAB+KGM:2860'EQN+30'CNI+4+:9+5,6'DTM+398+202006251700:203'DTM+2:202005262200:203'CNT+7:6000:KGM'CNT+57:8:MTR'CNT+56:400'FTX+TRA+++ENLEVEMENT AVEC HAYON OU MOFFETT+FR'FTX+DEL+++LIVRAISON AVEC HAYON OU MOFFETT+FR'FTX+AAA+++PIECES METALLIQUES+FR'TOD+6+PP'RFF+UCN:1410042395'RFF+AAS:68965526'RFF+AAO:R-57745001'TDT+20++3+137:::HAYON OU MOFFETT'TSR+G50::319+1'TSR+G50::319+13'NAD+SF+++CHARPENTES METALLIQUES+363 AVENUE PIERRE GRAND+CAVAILLON++84300+FR'LOC+172+43.823069+5.044133'COM+?+33490786666:TE'NAD+CN+++GTI+2 AVENUE GRUNER+ST ETIENNE++42000+FR'LOC+172+45.636805+4.732752'COM+?+33427405632:TE'GID+1+400:CT'UNT+98+16107D11001'UNZ+1+16107D11'

This gives me the following exception:

Exception in thread "main" org.smooks.api.SmooksException: Failed to filter source
    at org.smooks.engine.delivery.sax.ng.SaxNgFilter.doFilter(SaxNgFilter.java:122)
    at org.smooks.engine.delivery.sax.ng.SaxNgFilter.doFilter(SaxNgFilter.java:94)
    at org.smooks.Smooks._filter(Smooks.java:547)
    at org.smooks.Smooks.filterSource(Smooks.java:505)
    at org.smooks.Smooks.filterSource(Smooks.java:479)
    at edifact.POCEdifactIFCSUM.runSmooksTransformEDIFACT(POCEdifactIFCSUM.java:66)
    at edifact.POCEdifactIFCSUM.main(POCEdifactIFCSUM.java:99)
Caused by: org.smooks.api.SmooksException: Parse Error: Assertion failed: Unsupported syntax version
Schema context: UNB Location line 41 column 18 in file:/tmp/5120750065515301876/EDIFACT-Interchange-6654ae4a-a2c2-3a29-af11-a4162566510f-.dfdl.xsd
Data location was preceding byte 60
    at org.smooks.cartridges.dfdl.parser.DfdlParser.parse(DfdlParser.java:179)
    at org.smooks.engine.delivery.sax.ng.SaxNgParser.parse(SaxNgParser.java:86)
    at org.smooks.engine.delivery.sax.ng.SaxNgFilter.doFilter(SaxNgFilter.java:110)
    ... 6 more
Caused by: Parse Error: Assertion failed: Unsupported syntax version
Schema context: UNB Location line 41 column 18 in file:/tmp/5120750065515301876/EDIFACT-Interchange-6654ae4a-a2c2-3a29-af11-a4162566510f-.dfdl.xsd
Data location was preceding byte 60

Thank you for feedback !
Best regards.

Benjamin

Benjamin A.

unread,
Oct 14, 2022, 4:29:17 AM10/14/22
to Smooks Users
Hi,

The exception did not speak to me but I continued my investigation
I modified the syntext value of my edi sample.

UNB+UNOC:1+808634141 [...]   -> UNB+UNOC:3+808634141 [...]

and the parsing worked ..

Benjamin

Benjamin A.

unread,
Oct 14, 2022, 4:33:57 AM10/14/22
to Smooks Users
... But with a XML section <D13A:BadMessage> </D13A:BadMessage>...

So, my edi is partially decoded.

I continue my investigations ..

Claude

unread,
Oct 29, 2022, 2:52:15 AM10/29/22
to Smooks Users
Regarding the first error, the DFDL schemas generated for EDIFACT support syntax versions 3 and 4. You'd need to to tweak the schemas or generate your own if you want to support other syntax versions. The BadMessage element you're getting now indicates that the document doesn't meet the expected structure or data types as defined in the DFDL schema. I'm working on adding validation error messages but what I suggest for now is to validate the EDIFACT document with an external tool to understand what went wrong.

Claude
Reply all
Reply to author
Forward
0 new messages