asking correct packager

316 views
Skip to first unread message

adhi nugroho

unread,
Sep 15, 2015, 7:07:45 AM9/15/15
to jPOS Users
hello,

i have a message like this

0200623A400108C180000605350138000009011209450656381209450901090260120300800000006563815007110200900100800000012534316522301360



and what i expected is like this

   
    Bit-2 = 053501
   
Bit-3 = 380000
   
Bit-7 = 0901120945
   
Bit-11 = 065638
   
Bit-12 = 120945
   
Bit-13 = 0901
   
Bit-15 = 0902
   
Bit-18 = 6012
   
Bit-32 = 008
   
Bit-37 = 000000065638
   
Bit-41 = 15007110
   
Bit-42 = 200900100800000
   
Bit-48 = 534316522301
   
Bit-49 = 360



and this is some snipped code to test and packager

    
String inHex = "0200623A400108C180000605350138000009011209450656381209450901090260120300800000006563815007110200900100800000012534316522301360";

       
GenericPackager pkgr;
       
ISOMsg m = new ISOMsg();

       
try {
            pkgr
= new GenericPackager("...base1.xml");
           
Logger l = new Logger();
            l
.addListener(new SimpleLogListener());
            pkgr
.setLogger(l, "");
            m
.setPackager(pkgr);
            m
.unpack(ISOUtil.hex2byte(inHex));
         
//   m.dump(System.out, "");

       
}

       
catch (ISOException ex) {

            ex
.printStackTrace();
            m
.dump(System.out, "");

       
}

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE isopackager PUBLIC
        "-//jPOS/jPOS Generic Packager DTD 1.0//EN"
        "http://jpos.org/dtd/generic-packager-1.0.dtd">


<!-- VISA's Base1 field descriptions for GenericPackager -->

<isopackager>
 
<isofield
     
id="0"
     
length="4"
     
name="MESSAGE TYPE INDICATOR"
     
pad="true"
     
class="org.jpos.iso.IFB_NUMERIC"/>
 
<isofield
     
id="1"
     
length="16"
     
name="BIT MAP"
     
class="org.jpos.iso.IFB_BITMAP"/>
 
<isofield
     
id="2"
     
length="19"
     
name="PAN - PRIMARY ACCOUNT NUMBER"
     
pad="true"
     
class="org.jpos.iso.IFB_LLNUM"/>
 
<isofield
     
id="3"
     
length="6"
     
name="PROCESSING CODE"
     
pad="true"
     
class="org.jpos.iso.IFB_NUMERIC"/>
 
<isofield
     
id="4"
     
length="12"
     
name="AMOUNT, TRANSACTION"
     
pad="true"
     
class="org.jpos.iso.IFB_NUMERIC"/>
 
<isofield
     
id="7"
     
length="10"
     
name="TRANSMISSION DATE AND TIME"
     
pad="true"
     
class="org.jpos.iso.IFB_NUMERIC"/>
 
<isofield
     
id="11"
     
length="6"
     
name="SYSTEM TRACE AUDIT NUMBER"
     
pad="true"
     
class="org.jpos.iso.IFB_NUMERIC"/>
 
<isofield
     
id="12"
     
length="6"
     
name="TIME, LOCAL TRANSACTION"
     
pad="true"
     
class="org.jpos.iso.IFB_NUMERIC"/>
 
<isofield
     
id="13"
     
length="4"
     
name="DATE, LOCAL TRANSACTION"
     
pad="true"
     
class="org.jpos.iso.IFB_NUMERIC"/>
 
<isofield
     
id="15"
     
length="4"
     
name="DATE, SETTLEMENT"
     
pad="true"
     
class="org.jpos.iso.IFB_NUMERIC"/>
 
<isofield
     
id="18"
     
length="4"
     
name="MERCHANTS TYPE"
     
pad="true"
     
class="org.jpos.iso.IFB_NUMERIC"/>  
 
<isofield
     
id="32"
     
length="11"
     
name="ACQUIRING INSTITUTION IDENT CODE"
     
class="org.jpos.iso.IFB_LLNUM"/>
 
<isofield
     
id="37"
     
length="12"
     
name="RETRIEVAL REFERENCE NUMBER"
     
pad="true"
     
class="org.jpos.iso.IFB_NUMERIC"/>
 
<isofield
     
id="39"
     
length="2"
     
name="RESPONSE CODE"
     
class="org.jpos.iso.IFB_NUMERIC"/>
 
<isofield
     
id="41"
     
length="8"
     
name="CARD ACCEPTOR TERMINAL IDENTIFICACION"
     
class="org.jpos.iso.IFB_NUMERIC"/>
 
<isofield
     
id="42"
     
length="15"
     
name="CARD ACCEPTOR IDENTIFICATION CODE"
     
class="org.jpos.iso.IFB_NUMERIC"/>
 
<isofield
     
id="48"
     
length="999"
     
name="ADDITIONAL DATA - PRIVATE"
     
class="org.jpos.iso.IFB_LLLNUM"/>
 
<isofield
     
id="49"
     
length="3"
     
name="CURRENCY CODE, TRANSACTION"
     
pad="true"
     
class="org.jpos.iso.IFB_NUMERIC"/>
 
<isofield
     
id="63"
     
length="999"
     
name="ADDITIONAL DATA - PRIVATE"
     
class="org.jpos.iso.IFB_LLLNUM"/>
</isopackager>



with result and some error like this

<unpack>
    0200623A400108C180000605350138000009011209450656381209450901090260120300800000006563815007110200900100800000012534316522301360
   
<bitmap>{2, 3, 7, 11, 12, 13, 15, 18, 32, 37, 41, 42, 48, 49}</bitmap>
   
<unpack fld="2" packager="org.jpos.iso.IFB_LLNUM">
     
<value>053501</value>
   
</unpack>
   
<unpack fld="3" packager="org.jpos.iso.IFB_NUMERIC">
     
<value>380000</value>
   
</unpack>
   
<unpack fld="7" packager="org.jpos.iso.IFB_NUMERIC">
     
<value>0901120945</value>
   
</unpack>
   
<unpack fld="11" packager="org.jpos.iso.IFB_NUMERIC">
     
<value>065638</value>
   
</unpack>
   
<unpack fld="12" packager="org.jpos.iso.IFB_NUMERIC">
     
<value>120945</value>
   
</unpack>
   
<unpack fld="13" packager="org.jpos.iso.IFB_NUMERIC">
     
<value>0901</value>
   
</unpack>
   
<unpack fld="15" packager="org.jpos.iso.IFB_NUMERIC">
     
<value>0902</value>
   
</unpack>
   
<unpack fld="18" packager="org.jpos.iso.IFB_NUMERIC">
     
<value>6012</value>
   
</unpack>
   
<unpack fld="32" packager="org.jpos.iso.IFB_LLNUM">
     
<value>008</value>
   
</unpack>
   
<unpack fld="37" packager="org.jpos.iso.IFB_NUMERIC">
     
<value>000000656381</value>
   
</unpack>
   
<unpack fld="41" packager="org.jpos.iso.IFB_NUMERIC">
     
<value>50071102</value>
   
</unpack>
   
<unpack fld="42" packager="org.jpos.iso.IFB_NUMERIC">
     
<value>009001008000000</value>
   
</unpack>
    error unpacking field 48 consumed=55
   
<iso-exception>
      org.jpos.iso.IFB_LLLNUM: Problem unpacking field 48
     
<iso-exception>
        Field length 2534 too long. Max: 999
        org.jpos.iso.ISOException: Field length 2534 too long. Max: 999
    at org.jpos.iso.ISOStringFieldPackager.unpack(ISOStringFieldPackager.java:179)
    at org.jpos.iso.ISOBasePackager.unpack(ISOBasePackager.java:238)
    at org.jpos.iso.ISOMsg.unpack(ISOMsg.java:454)
    at co.id.jtg.dispenduk.test.TestMsg.main(TestMsg.java:25)
     
</iso-exception>
      org.jpos.iso.ISOException: org.jpos.iso.IFB_LLLNUM: Problem unpacking field 48 (org.jpos.iso.ISOException: Field length 2534 too long. Max: 999)
    at org.jpos.iso.ISOStringFieldPackager.unpack(ISOStringFieldPackager.java:187)
    at org.jpos.iso.ISOBasePackager.unpack(ISOBasePackager.java:238)
    at org.jpos.iso.ISOMsg.unpack(ISOMsg.java:454)
    at co.id.jtg.dispenduk.test.TestMsg.main(TestMsg.java:25)
Nested:org.jpos.iso.ISOException: Field length 2534 too long. Max: 999
    at org.jpos.iso.ISOStringFieldPackager.unpack(ISOStringFieldPackager.java:179)
    at org.jpos.iso.ISOBasePackager.unpack(ISOBasePackager.java:238)
    at org.jpos.iso.ISOMsg.unpack(ISOMsg.java:454)
    at co.id.jtg.dispenduk.test.TestMsg.main(TestMsg.java:25)
   
</iso-exception>
   
<iso-exception>
      org.jpos.iso.IFB_LLLNUM: Problem unpacking field 48 (org.jpos.iso.ISOException: Field length 2534 too long. Max: 999) unpacking field=48, consumed=55
      org.jpos.iso.ISOException: org.jpos.iso.IFB_LLLNUM: Problem unpacking field 48 (org.jpos.iso.ISOException: Field length 2534 too long. Max: 999) unpacking field=48, consumed=55
    at org.jpos.iso.ISOBasePackager.unpack(ISOBasePackager.java:268)
    at org.jpos.iso.ISOMsg.unpack(ISOMsg.java:454)
    at co.id.jtg.dispenduk.test.TestMsg.main(TestMsg.java:25)
   
</iso-exception>

as we can see that data element in bit 37 is 000000656381, different with actually i expected.

maybe somebody can help me what class i must use in my isofiled xml packager

   

chhil

unread,
Sep 15, 2015, 8:40:45 AM9/15/15
to jpos-...@googlegroups.com

​​
I am not 100% sure but this may be the problem

Hexdump of the hex2byte message

0000  02 00 62 3A 40 01 08 C1  80 00 06 05 35 01 38 00  ..b:@.......5.8.
0010  00 09 01 12 09 45 06 56  38 12 09 45 09 01 09 02  .....E.V8..E....
0020  60 12 03 00 80 00 00 00  65 63 81 50 07 11 02 00  `.......ec.P....
0030  90 01 00 80 00 00 01 25  34 31 65 22 30 13 60     .......%41e"0.`

if you notice
03 00 80 offset 0x22 - 0x24

 <isofield
      id="32"
      length="11"
      name="ACQUIRING INSTITUTION IDENT CODE"
      class="org.jpos.iso.IFB_LLNUM"/>

Indicate length is 3 and value is 008 and a nibble of value 0 left over.

03 00 80 00 00 00  65 63 81
Field 37 is 
  <isofield
      id="37"
      length="12"
      name="RETRIEVAL REFERENCE NUMBER"
     pad="true"
      class="org.jpos.iso.IFB_NUMERIC"/>

And you are expecting the nibble left over from field 32 to be used in field 37 and I dont think that will happen as we use byte boundaries.

Can anyone confirm this?

-chhil


--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage. Please support jPOS, contact: sa...@jpos.org
 
Join us in IRC at http://webchat.freenode.net/?channels=jpos
 
You received this message because you are subscribed to the "jPOS Users" group.
Please see http://jpos.org/wiki/JPOS_Mailing_List_Readme_first
To post to this group, send email to jpos-...@googlegroups.com
To unsubscribe, send email to jpos-users+...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/jpos-users
---
You received this message because you are subscribed to the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/e7076828-aca7-4205-abe5-3a7de0f2b151%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

adhi nugroho

unread,
Sep 15, 2015, 8:48:48 AM9/15/15
to jpos-...@googlegroups.com
yes chill you are correct..that is my problem. i dont know why it can be happen...


For more options, visit https://groups.google.com/d/optout.



--
adhi

adhi nugroho

unread,
Sep 15, 2015, 5:52:52 PM9/15/15
to jpos-...@googlegroups.com
So what packager i must use? I've just try every packager but is not work, 
--
Sent from Gmail Mobile for Iphone

galih.l...@gmail.com

unread,
Sep 15, 2015, 7:55:33 PM9/15/15
to jpos-...@googlegroups.com
have you try ISO87APackager ? or its the iso87ascii.xml if you look in the jpos.jar in the packager folder.
 

adhi nugroho

unread,
Sep 15, 2015, 9:39:00 PM9/15/15
to jpos-...@googlegroups.com
yes  already test with it..still error like this

<log realm="" at="Wed Sep 16 08:21:40.500 ICT 2015" lifespan="325ms">
 
<unpack>
    0200623A400108C180000605350138000009011209450656381209450901090260120300800000006563815007110200900100800000012534316522301360
   
<bitmap>{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 34, 36, 37, 38, 39, 40, 41, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 66, 67, 68, 69, 70, 71, 73, 74, 75, 76, 77, 78, 79, 80, 81, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 149, 150, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192}</bitmap>
    error unpacking field 2 consumed=52
   
<iso-exception>
      org.jpos.iso.IFA_LLNUM: Problem unpacking field 2
     
<nested-exception>
      java.lang.NegativeArraySizeException
    at org.jpos.iso.AsciiInterpreter.uninterpret(AsciiInterpreter.java:50)
    at org.jpos.iso.ISOStringFieldPackager.unpack(ISOStringFieldPackager.java:182)

    at org.jpos.iso.ISOBasePackager.unpack(ISOBasePackager.java:238)
    at org.jpos.iso.ISOMsg.unpack(ISOMsg.java:454)
    at co.id.jtg.dispenduk.test.TestMsg.main(TestMsg.java:28)
     
</nested-exception>
      org.jpos.iso.ISOException: org.jpos.iso.IFA_LLNUM: Problem unpacking field 2 (java.lang.NegativeArraySizeException)

    at org.jpos.iso.ISOStringFieldPackager.unpack(ISOStringFieldPackager.java:187)
    at org.jpos.iso.ISOBasePackager.unpack(ISOBasePackager.java:238)
    at org.jpos.iso.ISOMsg.unpack(ISOMsg.java:454)
    at co.id.jtg.dispenduk.test.TestMsg.main(TestMsg.java:28)
Nested:java.lang.NegativeArraySizeException
    at org.jpos.iso.AsciiInterpreter.uninterpret(AsciiInterpreter.java:50)
    at org.jpos.iso.ISOStringFieldPackager.unpack(ISOStringFieldPackager.java:182)

    at org.jpos.iso.ISOBasePackager.unpack(ISOBasePackager.java:238)
    at org.jpos.iso.ISOMsg.unpack(ISOMsg.java:454)
    at co.id.jtg.dispenduk.test.TestMsg.main(TestMsg.java:28)
   
</iso-exception>
   
<iso-exception>
      org.jpos.iso.IFA_LLNUM: Problem unpacking field 2 (java.lang.NegativeArraySizeException) unpacking field=2, consumed=52
      org.jpos.iso.ISOException: org.jpos.iso.IFA_LLNUM: Problem unpacking field 2 (java.lang.NegativeArraySizeException) unpacking field=2, consumed=52

    at org.jpos.iso.ISOBasePackager.unpack(ISOBasePackager.java:268)
    at org.jpos.iso.ISOMsg.unpack(ISOMsg.java:454)
    at co.id.jtg.dispenduk.test.TestMsg.main(TestMsg.java:28)
   
</iso-exception>


For more options, visit https://groups.google.com/d/optout.



--
adhi

galih.l...@gmail.com

unread,
Sep 15, 2015, 10:45:59 PM9/15/15
to jpos-...@googlegroups.com
here is my code, and there is no error 

    public static void main(String[] args) throws IOException, ISOException {
        String msg = "0200623A400108C180000605350138000009011209450656381209450901090260120300800000006563815007110200900100800000012534316522301360";

        ISOMsg isoMsg = new ISOMsg();

        isoMsg.setPackager(new ISO87APackager());
        isoMsg.unpack(msg.getBytes());

        printISOMessage(isoMsg);
        System.out.println(ISOUtil.hexdump(msg.getBytes()));
        System.out.println("Req ["+new String(isoMsg.pack()) + "]");

    }

    public static void printISOMessage(ISOMsg isoMsg) {
        try {
            System.out.printf("MTI = %s%n", isoMsg.getMTI());
            for (int i = 1; i <= isoMsg.getMaxField(); i++) {
                if (isoMsg.hasField(i)) {
                    System.out.printf("Field (%s) = %s%n", i, isoMsg.getString(i));
                }
            }
        } catch (ISOException e) {
            e.printStackTrace();
        }
    }

hope this will help you

adhi nugroho

unread,
Sep 15, 2015, 11:28:36 PM9/15/15
to jpos-...@googlegroups.com
thank you very much galih..now its works perfecly,

<isomsg>
  <!-- org.jpos.iso.packager.GenericPackager[..\iso87ascii.xml] -->
  <field id="0" value="0200"/>
  <field id="2" value="053501"/>
  <field id="3" value="380000"/>
  <field id="7" value="0901120945"/>
  <field id="11" value="065638"/>
  <field id="12" value="120945"/>
  <field id="13" value="0901"/>
  <field id="15" value="0902"/>
  <field id="18" value="6012"/>
  <field id="32" value="008"/>
  <field id="37" value="000000065638"/>
  <field id="41" value="15007110"/>
  <field id="42" value="200900100800000"/>
  <field id="48" value="534316522301"/>
  <field id="49" value="360"/>
</isomsg>



For more options, visit https://groups.google.com/d/optout.



--
adhi

Mark Salter

unread,
Sep 18, 2015, 3:15:18 AM9/18/15
to jpos-...@googlegroups.com
On 16/09/15 04:28, adhi nugroho wrote:
> thank you very much galih..now its works perfecly,
What did you correct on your side then adhi?

--
Mark

adhi nugroho

unread,
Sep 18, 2015, 3:33:12 AM9/18/15
to jpos-...@googlegroups.com
hai mark...as suggestion from galih i just modified my test class and pick iso87ascii.xml file from jpos.jar  like this


String inHex = "0200623A400108C180000605350138000009011209450656381209450901090260120300800000006563815007110200900100800000012534316522301360";
       

        GenericPackager pkgr;
        ISOMsg m = new ISOMsg();

        try {
            pkgr = new GenericPackager("..\\iso87ascii.xml");

         
         
            Logger l = new Logger();
            l.addListener(new SimpleLogListener());
            pkgr.setLogger(l, "");
            m.setPackager( pkgr);
            m.unpack(inHex.getBytes());

            m.dump(System.out, "");

        }

        catch (ISOException ex) {

            ex.printStackTrace();
            m.dump(System.out, "");

        }
--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage.  Please support jPOS, contact: sa...@jpos.org

Join us in IRC at http://webchat.freenode.net/?channels=jpos

You received this message because you are subscribed to the  "jPOS Users" group.
Please see http://jpos.org/wiki/JPOS_Mailing_List_Readme_first
To post to this group, send email to jpos-...@googlegroups.com
To unsubscribe, send email to jpos-users+...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/jpos-users
---
You received this message because you are subscribed to the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
adhi
Reply all
Reply to author
Forward
0 new messages