prowide-iso20022 icon indicating copy to clipboard operation
prowide-iso20022 copied to clipboard

Parsing issue with MX message of type admi.007.001.01

Open hamri opened this issue 3 years ago • 8 comments

Hello,

We are facing a problem while parsing an MX message of type admi.007.001.01 using SRU2020-9.1.5 version. Upgrading to SRU2021-9.2.5 version doesn't resolve the issue.

This is an example of an admi.007.001.01 message:

<?xml version="1.0" encoding="ISO-8859-1"?>
<Body>
    <AppHdr xmlns="urn:iso:std:iso:20022:tech:xsd:head.001.001.01">
        <Fr>
            <FIId>
                <FinInstnId>
                    <BICFI>XXXXXXXXXXX</BICFI>
                </FinInstnId>
            </FIId>
        </Fr>
        <To>
            <FIId>
                <FinInstnId>
                    <BICFI>XXXXXXXXXXX</BICFI>
                </FinInstnId>
            </FIId>
        </To>
        <BizMsgIdr>XXXXXXX</BizMsgIdr>
        <MsgDefIdr>admi.007.001.01</MsgDefIdr>
        <CreDt>2022-01-11T15:02:09Z</CreDt>
    </AppHdr>
    <Document xmlns="urn:iso:std:iso:20022:tech:xsd:admi.007.001.01">
        <RctAck>
            <MsgId>
                <MsgId>XXXXXXX</MsgId>
            </MsgId>
            <Rpt>
                <RltdRef>
                    <Ref>XXXXXX</Ref>
                </RltdRef>
                <ReqHdlg>
                    <StsCd>ACKT</StsCd>
                    <Desc>CR50</Desc>
                </ReqHdlg>
            </Rpt>
            <SplmtryData>
                <Envlp>
                    <FromBOData>TOTO</FromBOData>
                </Envlp>
            </SplmtryData>
        </RctAck>
    </Document>
</Body>

Could you please help us to fix the issue?

Thanks,

hamri avatar Jan 12 '22 10:01 hamri

There is an issue parsing the unknown "Any" element at the supplementary data: FromBOData

zubri avatar Jan 13 '22 19:01 zubri

Hello,

Any news about this issue ?

Thanks for your help,

hamri avatar Feb 22 '22 14:02 hamri

Hi, it's still pending and not easy to fix. You are welcome to propose a solution via PR.

zubri avatar Feb 23 '22 18:02 zubri

I've been exploring this issue.

The actual error comes from the custom NamespaceAndElementFilter. In particular, the startPrefixMapping method causes the negative index in the internal UnmarshallingContext implementation. By removing that the exception is not thrown, however the Any element is not parsed into a generic Element as expected.

Test cases and sandbox code has been pushed to: https://github.com/prowide/prowide-iso20022/pull/48

Anyone with the same or similar issue is welcome to explore alternatives for a fix in the NamespaceAndElementFilter or MxReadImpl classes, which are the relevant ones for this.

zubri avatar May 25 '22 16:05 zubri

Hello, I want to retrieve the data from splmtryData while parsing the XML. AbstractMX parse = AbstractMX. Parse (new File (xmlFilePath), new MxId("urn:iso:std:iso:20022:tech:xsd:pacs.008.001.10")); "splmtryData": [ { "plcAndNm": "core:FIToFICstmrCdtTrf/core:CdtTrfTxInf/core:PmtId", "envlp": {} } ] Is there a solution, please? , i get it null

dhouhadaoud avatar May 27 '24 07:05 dhouhadaoud

This seems to be quite a large limitation for this library, especially since the library actually supports a bunch of the xml elements that could be in the splmtryData which can't really be used, ie. (https://github.com/prowide/prowide-iso20022/tree/develop/model-supl-types/src/generated/java/com/prowidesoftware/swift/model/mx/dic). By the time the message has been read, we can't even get access to the xml string at that point to do it manually. I'm curious if the are any workarounds other than parsing everything before the message itself is parsed? This approach doesn't work with frameworks like JMS, etc.

jrogers avatar Jun 10 '24 20:06 jrogers

Indeed it is a known limitation.

There is an open PR to handle the Any element.

https://github.com/prowide/prowide-iso20022/pull/48

The idea is to return the supplementary data content and any other using Any in the schema as a generic DOM Element. I did not had the time myself the time to explore this further but the feature is on the wish list.

zubri avatar Jun 10 '24 20:06 zubri

Hmm that doesn't seem to work though if the supplementary data is under a different namespace though I don't think? Like in this example message - https://github.com/prowide/prowide-iso20022/blob/7cc0e5923471ddfae6c13da801187c517e94bb33/iso20022-core/src/test/java/com/prowidesoftware/swift/model/mx/SupplementaryDataUtilsTest.java#L180

jrogers avatar Jun 10 '24 23:06 jrogers