0

I want to convert a MT message to MX. How can we parse MT message in java ? There are many MT formats too. I have tried searching some ways for converting json to xml. But my problem is in parsing the MT message as it is not a simple json , but looks something like below. Are there any known swift libraries which can help in this conversion ? Can someone provide some link , some example to do this in java ?

MT message like below :

{1:F01ESPBESMMARMS8286723799}{2:O1030841140130CGDIPTPLBXXX12702744781401300942N}{3:{103:TGT}{113:URGT}{108:10092119}{115:094206094206PT0000000515798425}{121:180f1e65-90e0-44d5-a49a-92b55eb3025f}}{4: :20:PGE0428000000183 :23B:CRED :32A:200205EUR2451,74 :50A:/NL293456125434982 VISTUS31 :59:/CH90290000000096 BANCO CENTRAL DEL EQUADOR :71A:SHA :72:/INS/RETN -}{5:{CHK:5AE1AA935421}}

XML output looks something like below :

    <?xml version="1.0" encoding="UTF-8"?><DataPDU>
<Body>
<AppHdr xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Fr>
<FIId>
<FinInstnId>
<BICFI>CGDIPTPLXXX</BICFI>
</FinInstnId>
</FIId>
</Fr>
<To>
<FIId>
<FinInstnId>
<BICFI>ESPBESMMRMS</BICFI>
</FinInstnId>
</FIId>
</To>
<BizMsgIdr>723799</BizMsgIdr>
<MsgDefIdr>pacs.004.001.09.103</MsgDefIdr>
<Prty>N</Prty>
</AppHdr><Document>
<FIToFICstmrCdtTrf>
<GrpHdr>
<MsgId>10092119</MsgId>
<CreDtTm>2020-12-08T15:33:31</CreDtTm>
<NbOfTxs>1</NbOfTxs>
<SttlmInf>
<SttlmMtd>CLRG</SttlmMtd>
<ClrSys>
<Cd>TGT</Cd>
</ClrSys>
</SttlmInf>
</GrpHdr>
<CdtTrfTxInf>
<PmtId>
<InstrId>PGE0428000000183</InstrId>
<EndToEndId>NOTPROVIDED</EndToEndId>
<UETR>180f1e65-90e0-44d5-a49a-92b55eb3025f</UETR>
</PmtId>
<PmtTpInf>
<LclInstrm>
<Cd>CRED</Cd>
</LclInstrm>
</PmtTpInf>
<IntrBkSttlmAmt Ccy="EUR">2451.74</IntrBkSttlmAmt>
<IntrBkSttlmDt>2020-02-05</IntrBkSttlmDt>
<SttlmPrty>URGT</SttlmPrty>
<ChrgBr>SHAR</ChrgBr>
<ChrgsInf>
<Agt>
<FinInstnId>
<Nm>As per payment chain</Nm>
</FinInstnId>
</Agt>
</ChrgsInf>
<Dbtr>
<Id>
<OrgId>
<AnyBIC>VISTUS31</AnyBIC>
</OrgId>
</Id>
</Dbtr>
<DbtrAcct>
<Id>
<IBAN>NL293456125434982</IBAN>
</Id>
</DbtrAcct>
<Cdtr>
<Nm>BANCO CENTRAL DEL EQUADOR</Nm>
</Cdtr>
<CdtrAcct>
<Id>
<IBAN>CH90290000000096</IBAN>
</Id>
</CdtrAcct>
</CdtTrfTxInf>
</FIToFICstmrCdtTrf>
</Document></Body>
</DataPDU>

ce1
  • 39
  • 1
  • 7
  • Does this help? https://github.com/prowide/prowide-integrator-examples/blob/master/src/main/java/com/prowidesoftware/swift/samples/integrator/myformat/Mt2MxExample.java – pringi Feb 14 '22 at 11:15
  • I understood that it makes use of "Prowide Integrator" which is a SWIFT message library. Thanks for the info. Although still looking for other ideas. I have a question , related to this context. Lets say I am able to parse this MT and read it into some domain object. But since there are many rules for MT to MX conversion , what is the best way to convert this domain object to xml ? I looked for options like marshalling , but it involves writing a lot of classes and handling is a bit difficult. Could you suggest any other approach ? – ce1 Feb 15 '22 at 11:01
  • Very similar question from years ago: https://stackoverflow.com/questions/25192/java-swift-library Although that's old, the SWIFT FIN standards haven't changed much. If you need to parse all MT types, trying to write it yourself is a massive undertaking -- each message type has a large number of sections, many of which have multiple options and special validation rules around them. It's a huge amount of work. – Cartroo Nov 20 '22 at 01:58

0 Answers0