0

JPOS用来打包和解包ISO消息,消息的打包很好,当我收到以下回复时

1210E030000002000020000000000400002807110457626000026000000052220140909134530000001812UU2411906554003TCB48520141026|20141026|D|UG|142465.75|Interest Paid||20991780.75^20140930|20140930|D|UG|164383.55|Interest Paid||20849315^20140831|20140831|D|UG|169863.00|Interest Paid||20684931.45^20140731|20140731|D|UG|169863.00|Interest Paid||20515068.45^20140630|20140630|D|UG|164383.55|Interest Paid||20345205.45^20140531|20140531|D|UG|169863.00|Interest Paid||20180821.9^20140430|20140430|D|UG|10958.90|Interest Paid||20010958.9^20140429|20140429|D|UG|20000000.00|Deposit Created||20000000.00

当我尝试解压缩它时,我收到以下错误:

error unpacking field 123
org.jpos.iso.ISOException: org.jpos.iso.IFA_LLLCHAR: Problem unpacking field 123 (java.lang.ArrayIndexOutOfBoundsException: 592)
    at org.jpos.iso.ISOStringFieldPackager.unpack(ISOStringFieldPackager.java:178)
org.jpos.iso.ISOException: org.jpos.iso.IFA_LLLCHAR: Problem unpacking field 123 (java.lang.ArrayIndexOutOfBoundsException: 592)
    at org.jpos.iso.ISOBasePackager.unpack(ISOBasePackager.java:233)
4

2 回答 2

0

这是我使用的代码

ISOMsg msg = new ISOMsg();

try {
    msg.setPackager(new GenericPackager("iso87ascii.xml"));
    msg.unpack(str.getBytes("UTF8"));

    msg.dump(System.out, "");
} catch (ISOException e) {
    e.printStackTrace();
} catch (UnsupportedEncodingException e) {
    e.printStackTrace();
}

如果您开始删除第一个字符,您将开始获得结果,如下所示:

str="210E030000002000020000000000400002807110457626000026000000052220140909134530000001812UU2411906554003TCB48520141026|20141026|D|UG|142465.75|Interest Paid||20991780.75^20140930|20140930|D|UG|164383.55|Interest Paid||20849315^20140831|20140831|D|UG|169863.00|Interest Paid||20684931.45^20140731|20140731|D|UG|169863.00|Interest Paid||20515068.45^20140630|20140630|D|UG|164383.55|Interest Paid||20345205.45^20140531|20140531|D|UG|169863.00|Interest Paid||20180821.9^20140430|20140430|D|UG|10958.90|Interest Paid||20010958.9^20140429|20140429|D|UG|20000000.00|Deposit Created||20000000.00";

输出:

<isomsg>
  <!-- org.jpos.iso.packager.GenericPackager[iso87ascii.xml] -->
  <field id="0" value="210E"/>
  <field id="7" value="0000000040"/>
  <field id="8" value="00028071"/>
  <field id="35" value="4576260000"/>
  <field id="55" value="00000052220140909134530000001812UU2411906554003TCB48520141026|20141026|D|UG|142465.75|Interest Paid||20991780.75^20140930|20140930|D|UG|164383.55|Interest Paid||20849315^20140831|20140831|D|UG|169863.00|Interest Paid||20684931.45^20140731|20140731|D|UG|169863."/>
</isomsg>

如果您从 str 的开头删除“2”:

<isomsg>
  <!-- org.jpos.iso.packager.GenericPackager[iso87ascii.xml] -->
  <field id="0" value="10E0"/>
  <field id="3" value="000000"/>
  <field id="4" value="040000280711"/>
  <field id="31" value="045762600"/>
  <field id="51" value="002"/>
</isomsg>

等等...

如果你删除整个1210E,你会得到

<isomsg>
  <!-- org.jpos.iso.packager.GenericPackager[iso87ascii.xml] -->
  <field id="0" value="0300"/>
  <field id="19" value="000"/>
  <field id="39" value="04"/>
</isomsg>

我发现逻辑,因为它有iso39(响应)

我不确定这是否是为了帮助,但它可以给你一个线索,

于 2014-11-05T13:58:07.697 回答
0

我在这里得到了解决方案https://github.com/jpos/jPOS/blob/master/jpos/src/dist/cfg/packager/test-generic-validating-packager.xml这是一个打包程序问题。我已经使用了打包程序,它可以正常工作。如果服务器端的打包器与客户端不同,那么很可能会发生错误。

于 2014-11-06T06:42:16.507 回答