0

I am using JPOS to pack and unpack ISO message the packing of the message is just good and when I get the following reply

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

When I try to unpack it I get the following error:

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)
Onel Sarmiento
  • 1,608
  • 3
  • 20
  • 46
jabsy
  • 19
  • 1
  • 7
  • i am not soo good in JPOS, but i will try to help, what packager are you using? – Yazan Nov 05 '14 at 09:17
  • is it `ISO93APackager`, you are using ISO 8583-2:1993 version? – Yazan Nov 05 '14 at 09:23
  • I am using ISO 8583:1987 packager. This is what I got from the iso87ascii.xml. – jabsy Nov 05 '14 at 11:23
  • i used that packager, but, the error was `unpacking field=102` however, if i delete the first char from left, i start getting success unpack, and keep deleting , all is success but with different dump msg, so try it, and if you can post the original message here too, i will post an answer to make it clear. – Yazan Nov 05 '14 at 13:52
  • Yazan that is the original reply from the socket – jabsy Nov 06 '14 at 05:50
  • I got the solution here https://github.com/jpos/jPOS/blob/master/jpos/src/dist/cfg/packager/test-generic-validating-packager.xml. It was a packager issue. Thanks – jabsy Nov 06 '14 at 06:39
  • so you was using the wrong packager? – Yazan Nov 06 '14 at 07:16

2 Answers2

0

this is the code i used

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();
}

if you start removing first chars, you will start getting results, as following:

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";

Output:

<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>

if you remove the '2' from begin of str:

<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>

and so on...

if you remove the whole 1210E, you will get

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

which i find logic, as it have iso39 (response)

i am not sure if this is for a help, but it could give you a clue,

Yazan
  • 6,074
  • 1
  • 19
  • 33
  • Yazan thanks. but the string starts with 1210-MTI this the reply that comes from the server socket so using it as it is is better. – jabsy Nov 06 '14 at 05:34
0

I got the solution here https://github.com/jpos/jPOS/blob/master/jpos/src/dist/cfg/packager/test-generic-validating-packager.xml it was a packager issue. I have used the packager and it works correctly. If the packager on the server side is different from the client side, then an error is likely to occur.

jabsy
  • 19
  • 1
  • 7