Getting an error while unpacking DE 12 Using Jpos 2.1.2 library

338 views
Skip to first unread message

ccav tech

unread,
May 16, 2019, 4:44:14 PM5/16/19
to jPOS Users

I am creating ISO 8583  message using JPOS 2.1.2

Below are the rules.


<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE isopackager SYSTEM "genericpackager.dtd">
<isopackager>
    <isofield id="0" length="4" name="MESSAGE TYPE INDICATOR" class="org.jpos.iso.IFA_NUMERIC"/>
    <isofield id="1" length="16" name="BIT MAP" class="org.jpos.iso.IFA_BITMAP"/>
    <isofield id="2" length="19" name="SECRET ID" class="org.jpos.iso.IFA_LLNUM"/>
    <isofield id="3" length="6" name="PROCESSING CODE" class="org.jpos.iso.IFA_NUMERIC"/>
    <isofield id="4" length="12" name="AMOUNT, TRANSACTION" class="org.jpos.iso.IFA_NUMERIC"/>
    <isofield id="5" length="12" name="AMOUNT, SETTLEMENT" class="org.jpos.iso.IFA_NUMERIC"/>
    <isofield id="6" length="12" name="AMOUNT, CARDHOLDER BILLING" class="org.jpos.iso.IFA_NUMERIC"/>
    <isofield id="7" length="10" name="TRANSMISSION DATE AND TIME" class="org.jpos.iso.IFA_NUMERIC"/>
    <isofield id="8" length="8" name="AMOUNT, CARDHOLDER BILLING FEE" class="org.jpos.iso.IFA_NUMERIC"/>
    <isofield id="9" length="8" name="CONVERSION RATE, SETTLEMENT" class="org.jpos.iso.IFA_NUMERIC"/>
    <isofield id="10" length="8" name="CONVERSION RATE, CARDHOLDER BILLING" class="org.jpos.iso.IFA_NUMERIC"/>
    <isofield id="11" length="6" name="SYSTEM TRACE AUDIT NUMBER" class="org.jpos.iso.IFA_NUMERIC"/>
    <isofield id="12" length="6" name="TIME, LOCAL TRANSACTION" class="org.jpos.iso.IFA_NUMERIC"/>
</isopackager>

While unpacking below result  on online utilty (URL : http://www.chileoffshore.com/en/iso8583/dump-iso-message) getting an error "Invalid length at position: 101449".

Result:

010072300000000000001642896976489287520200000000000050000516101449123456101449

Below is the code for generating ISO 8583 Message.

GenericPackager packager = new GenericPackager("src/main/resources/basic.xml");

        // Setting packager
        ISOMsg isoMsg = new ISOMsg();
        isoMsg.setPackager(packager);
        isoMsg.set(0, "0100");
        // Setting MTI
        // Setting processing code
        isoMsg.set(2, "4289697648928752");
        isoMsg.set(3, "020000");
        // Setting transaction amount
        isoMsg.set(4, "5000");
        // Setting transmission date and time
        isoMsg.set(7, new SimpleDateFormat("MMddHHmmss").format(new Date()));
        // Setting system trace audit number
        isoMsg.set(11, "123456");
        String time = ISODate.getTime(new Date());
        System.out.println("Time ::" + time);
        isoMsg.set(12,"101449");

//      pack the ISO 8583 Message
        byte[] bIsoMsg = isoMsg.pack();

        String isoMessage = "";
        System.out.println("  MTI : " + isoMsg.getMTI());
        logISOMsg(isoMsg);
        System.out.println("RESULT : " + new String(bIsoMsg));

Please suggest.



ccav tech

unread,
Jun 3, 2019, 2:47:31 AM6/3/19
to jPOS Users
Hi Chhil,
Below is the hexdump of ISO message.
Can you please check whether it is correct or wrong because I think the fild no 123  is not getting encoded correctly.

ISO Message:

ISOMsg isoMsg = new ISOMsg();
        isoMsg.setPackager(packager);
        isoMsg.set(0, "0100");
        isoMsg.set(2, "4289697648928752");
        isoMsg.set(3, "000000");
        isoMsg.set(4, "000000020000");

       
        isoMsg.set(7, new SimpleDateFormat("MMddHHmmss").format(new Date()));
        isoMsg.set(11, "105790");
        isoMsg.set(12, new SimpleDateFormat("HHmmss").format(new Date()));
        isoMsg.set(13, "0326");
isoMsg.set(14, "2407");
isoMsg.set(18, "5691");
isoMsg.set(22, "012");
isoMsg.set(25, "08");
isoMsg.set(32, "454899");
isoMsg.set(37, "908507105790");
isoMsg.set(41, "00050041");
isoMsg.set(42, "027174         ");
isoMsg.set(43, "COMMERCIAL8360DubaiAEAE");
        isoMsg.set(49, "784");
        isoMsg.set(123,"100030104000000");

HexDump:

0000  30 31 30 30 F2 3C 44 81  08 E0 80 00 00 00 00 00  0100.<D.........
0010  00 00 00 20 31 36 34 32  38 39 36 39 37 36 34 38  ... 164289697648
0020  39 32 38 37 35 32 30 30  30 30 30 30 30 30 30 30  9287520000000000
0030  30 30 30 32 30 30 30 30  30 36 30 33 31 32 30 37  0002000006031207
0040  31 34 31 30 35 37 39 30  31 32 30 37 31 34 30 33  1410579012071403
0050  32 36 32 34 30 37 35 36  39 31 30 31 32 30 38 30  2624075691012080
0060  36 34 35 34 38 39 39 39  30 38 35 30 37 31 30 35  6454899908507105
0070  37 39 30 30 30 30 35 30  30 34 31 30 32 37 31 37  7900005004102717
0080  34 20 20 20 20 20 20 20  20 20 43 4F 4D 4D 45 52  4         COMMER
0090  43 49 41 4C 38 33 36 30  44 75 62 61 69 41 45 41  CIAL8360DubaiAEA
00a0  45 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  E              
00b0  20 20 37 38 34 30 31 35  31 30 30 30 33 30 31 30    78401510003010
00c0  34 30 30 30 30 30 30                              4000000

--
--
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
---
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 post to this group, send email to jpos-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/8e72b884-3934-42cd-9fdf-d0d6cb8b64b5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

chhil

unread,
Jun 10, 2019, 6:45:12 AM6/10/19
to jpos-...@googlegroups.com
Your packager has field definitions from 0 to 12 and you are setting fields greater than 12.
Fix your packager to include the missing field packagers.

-chhil

ccav tech

unread,
Jun 10, 2019, 8:22:56 AM6/10/19
to jPOS Users
Hi Chill,

Below are the jpos rules.

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

<isopackager>
  <isofield
      id="0"
      length="4"
      name="MESSAGE TYPE INDICATOR"
      class="org.jpos.iso.IFA_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"

      class="org.jpos.iso.IFA_LLNUM"/>
  <isofield
      id="3"
      length="6"
      name="PROCESSING CODE"
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="4"
      length="12"
      name="AMOUNT, TRANSACTION"
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="7"
      length="10"
      name="TRANSMISSION DATE AND TIME"
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="11"
      length="6"
      name="SYSTEM TRACE AUDIT NUMBER"
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="12"
      length="6"
      name="TIME, LOCAL TRANSACTION"
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="13"
      length="4"
      name="DATE, LOCAL TRANSACTION"
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="14"
      length="4"
      name="DATE, EXPIRATION"
      class="org.jpos.iso.IFA_NUMERIC"/>
 
  <isofield
      id="18"
      length="4"
      name="MERCHANTS TYPE"
      class="org.jpos.iso.IFA_NUMERIC"/>
 
  <isofield
      id="22"
      length="3"
      name="POINT OF SERVICE ENTRY MODE"
      class="org.jpos.iso.IFA_NUMERIC"/>
 
  <isofield
      id="25"
      length="2"
      name="POINT OF SERVICE CONDITION CODE"
      class="org.jpos.iso.IFA_NUMERIC"/>
 
  <isofield
      id="32"
      length="11"
      name="ACQUIRING INSTITUTION IDENT CODE"
      class="org.jpos.iso.IFA_LLNUM"/>
 
  <isofield
      id="37"
      length="12"
      name="RETRIEVAL REFERENCE NUMBER"
      class="org.jpos.iso.IF_CHAR"/>
 
  <isofield
      id="41"
      length="8"
      name="CARD ACCEPTOR TERMINAL IDENTIFICACION"
      class="org.jpos.iso.IF_CHAR"/>
  <isofield
      id="42"
      length="15"
      name="CARD ACCEPTOR IDENTIFICATION CODE"
      class="org.jpos.iso.IF_CHAR"/>
  <isofield
      id="43"
      length="40"
      name="CARD ACCEPTOR NAME/LOCATION"
      class="org.jpos.iso.IF_CHAR"/>
 
  <isofield
      id="49"
      length="3"
      name="CURRENCY CODE, TRANSACTION"
      class="org.jpos.iso.IFA_NUMERIC"/>
 
  <isofield
      id="123"
      length="999"
      name="RESERVED PRIVATE USE"
      class="org.jpos.iso.IFA_LLLCHAR"/>
 
  <isofieldpackager
      id="127"  
      length="999999"
      name="RESERVED PRIVATE USE"
      class="org.jpos.iso.IFA_LLLLLLBINARY"
      packager="org.jpos.iso.packager.GenericSubFieldPackager">
      <isofield
          id="0"
          length="0"
          name="PLACEHOLDER"
          class="org.jpos.iso.IF_CHAR"/>
      <isofield
          id="1"
          length="8"
          name="BITMAP"
          class="org.jpos.iso.IFB_BITMAP"/>
      <isofield
          id="2"
          length="32"
          name="SWITCH KEY"
          class="org.jpos.iso.IFA_LLCHAR"/>
      <isofield
          id="3"
          length="48"
          name="ROUTING INFORMATION"
          class="org.jpos.iso.IF_CHAR"/>
      <isofield
          id="4"
          length="22"
          name="POS DATA"
          class="org.jpos.iso.IF_CHAR"/>
      <isofield
          id="5"
          length="73"
          name="SERVICE STATION DATA"
          class="org.jpos.iso.IF_CHAR"/>
      <isofield
          id="6"
          length="2"
          name="AUTHORIZATION PROFILE"

          class="org.jpos.iso.IFA_NUMERIC"/>
      <isofield
          id="7"
          length="50"
          name="CHECK DATA"
          class="org.jpos.iso.IFA_LLCHAR"/>
      <isofield
          id="8"
          length="128"
          name="RETENTION DATA"
          class="org.jpos.iso.IFA_LLLCHAR"/>
      <isofield
          id="9"
          length="255"
          name="ADDITIONAL NODE DATA"
          class="org.jpos.iso.IFA_LLLCHAR"/>
      <isofield
          id="10"
          length="3"
          name="CVV2"
          class="org.jpos.iso.IFA_NUMERIC"/>
     
  </isofieldpackager>

  </isopackager>

Can you please check whether  the field 123 is getting encoded correctly or not?

Владимир Котович

unread,
Jun 10, 2019, 8:59:35 AM6/10/19
to jPOS Users
Your DE12 (101449) is not IFA_NUMERIC encoded - probably IFB_NUMERIC. IFA_NUMERIC would look like 313031343439

четверг, 16 мая 2019 г., 23:44:14 UTC+3 пользователь ccav tech написал:

Владимир Котович

unread,
Jun 10, 2019, 9:47:10 AM6/10/19
to jPOS Users
All the fields in your message are IFB_NUMERIC. Change last 6 digits in the dump as i said before (313031343439) and your web tool will parse it )))

понедельник, 10 июня 2019 г., 15:59:35 UTC+3 пользователь Владимир Котович написал:

chhil

unread,
Jun 10, 2019, 10:36:23 AM6/10/19
to jpos-...@googlegroups.com
Hi,

I am not sure what Vladimir is trying to convey. The data is passed in as a string and the packager takes care of converting it appropriately and is visible in the hexdump.


I used your packager and code and got the hexdump from it.

import java.io.IOException;
import java.net.MalformedURLException;
import java.text.SimpleDateFormat;
import java.util.Date;

import org.jdom.JDOMException;
import org.jpos.iso.ISOException;
import org.jpos.iso.ISOMsg;
import org.jpos.iso.ISOUtil;
import org.jpos.iso.packager.GenericPackager;
import org.jpos.util.Logger;
import org.jpos.util.SimpleLogListener;

public class Test {

    public static void main(String[] args) throws ISOException, MalformedURLException, JDOMException, IOException {

        GenericPackager packager = new GenericPackager("C:\\temp\\basic.xml");
        Logger l = new Logger();
        l.addListener(new SimpleLogListener());
        packager.setLogger(l, "jsagfj");

        ISOMsg isoMsg = new ISOMsg();
        isoMsg.setPackager(packager);

        isoMsg.set(0, "0100");
        isoMsg.set(2, "4289697648928752");
        isoMsg.set(3, "000000");
        isoMsg.set(4, "000000020000");

        isoMsg.set(7, new SimpleDateFormat("MMddHHmmss").format(new Date()));
        isoMsg.set(11, "105790");
        isoMsg.set(12, new SimpleDateFormat("HHmmss").format(new Date()));
        isoMsg.set(13, "0326");
        isoMsg.set(14, "2407");
        isoMsg.set(18, "5691");
        isoMsg.set(22, "012");
        isoMsg.set(25, "08");
        isoMsg.set(32, "454899");
        isoMsg.set(37, "908507105790");
        isoMsg.set(41, "00050041");
        isoMsg.set(42, "027174         ");
        isoMsg.set(43, "COMMERCIAL8360DubaiAEAE");
        isoMsg.set(49, "784");
        isoMsg.set(123, "100030104000000");

        try {
            byte[] b = isoMsg.pack();
            isoMsg.dump(System.out, "");
            System.out.println(ISOUtil.hexdump(b));
        }
        catch (Exception e) {
            e.printStackTrace();
            isoMsg.dump(System.out, "");
        }

    }

}
The output looks like


<isomsg direction="none">
  <!-- org.jpos.iso.packager.GenericPackager[C:\temp\basic.xml] -->
  <field id="0" value="0100"/>
  <field id="2" value="4289697648928752"/>
  <field id="3" value="000000"/>
  <field id="4" value="000000020000"/>
  <field id="7" value="0610195140"/>
  <field id="11" value="105790"/>
  <field id="12" value="195140"/>
  <field id="13" value="0326"/>
  <field id="14" value="2407"/>
  <field id="18" value="5691"/>
  <field id="22" value="012"/>
  <field id="25" value="08"/>
  <field id="32" value="454899"/>
  <field id="37" value="908507105790"/>
  <field id="41" value="00050041"/>
  <field id="42" value="027174         "/>
  <field id="43" value="COMMERCIAL8360DubaiAEAE"/>
  <field id="49" value="784"/>
  <field id="123" value="100030104000000"/>
</isomsg>

And hex looks like

0000 30 31 30 30 F2 3C 44 81 08 E0 80 00 00 00 00 00 0100.<D......... 0010 00 00 00 20 31 36 34 32 38 39 36 39 37 36 34 38 ... 164289697648 0020 39 32 38 37 35 32 30 30 30 30 30 30 30 30 30 30 9287520000000000 0030 30 30 30 32 30 30 30 30 30 36 31 30 31 39 35 31 0002000006101951 0040 34 30 31 30 35 37 39 30 31 39 35 31 34 30 30 33 4010579019514003 0050 32 36 32 34 30 37 35 36 39 31 30 31 32 30 38 30 2624075691012080 0060 36 34 35 34 38 39 39 39 30 38 35 30 37 31 30 35 6454899908507105 0070 37 39 30 30 30 30 35 30 30 34 31 30 32 37 31 37 7900005004102717 0080 34 20 20 20 20 20 20 20 20 20 43 4F 4D 4D 45 52 4 COMMER 0090 43 49 41 4C 38 33 36 30 44 75 62 61 69 41 45 41 CIAL8360DubaiAEA 00a0 45 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 E 00b0 20 20 37 38 34 30 31 35 31 30 30 30 33 30 31 30 78401510003010 00c0 34 30 30 30 30 30 30 4000000

Field 123 looks alright to me. Has 015 [LLL] length preceding the data 100030104000000.

Why arent you using postpack.xml to talk to Postilion?

-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
---
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 post to this group, send email to jpos-...@googlegroups.com.

ccav tech

unread,
Jun 11, 2019, 2:52:40 AM6/11/19
to jPOS Users
Hi Chhil,
Can you help me out to understand the hex dump message as I am clear about the primary and secondary bit map values but after that I am not able to understand other data elements encoded format in the hex dump message.

How to identify the encoded data element in hex dump message so that I am able to understand the encoded data elements.



Vladimir Kotovich

unread,
Jun 11, 2019, 4:54:34 AM6/11/19
to jPOS Users
Hi guys,

I meant that the message with dump 010072300000000000001642896976489287520200000000000050000516101449123456101449 was not packed by GenericPackager with config defined above.
Most fields in this dump were packed using IFB_NUMERIC field packager. If TS changes the dump this way:
010072300000000000001642896976489287520200000000000050000516101449123456313031343439
 it will be unpacked by your web tool (http://www.chileoffshore.com/en/iso8583/dump-iso-message) properly. DE12 to be supplied by that tool should be packed by IFA_NUMERIC field packager

понедельник, 10 июня 2019 г., 17:36:23 UTC+3 пользователь chhil написал:
To unsubscribe from this group and stop receiving emails from it, send an email to jpos-...@googlegroups.com.

chhil

unread,
Jun 11, 2019, 8:47:50 AM6/11/19
to jpos-...@googlegroups.com
Hi,

You can look at the programmers guide found at http://jpos.org/doc/proguide-draft.pdf
Read Chapter 2: About IS-8583. Its the very basics of 8583 one must know before getting into constructing messages.


0000  30 31 30 30 F2 3C 44 81  08 E0 80 00 00 00 00 00  0100.<D.........
0010  00 00 00 20 31 36 34 32  38 39 36 39 37 36 34 38  ... 164289697648
0020  39 32 38 37 35 32 30 30  30 30 30 30 30 30 30 30  9287520000000000
0030  30 30 30 32 30 30 30 30  30 36 31 30 31 39 35 31  0002000006101951
0040  34 30 31 30 35 37 39 30  31 39 35 31 34 30 30 33  4010579019514003
0050  32 36 32 34 30 37 35 36  39 31 30 31 32 30 38 30  2624075691012080
0060  36 34 35 34 38 39 39 39  30 38 35 30 37 31 30 35  6454899908507105
0070  37 39 30 30 30 30 35 30  30 34 31 30 32 37 31 37  7900005004102717
0080  34 20 20 20 20 20 20 20  20 20 43 4F 4D 4D 45 52  4         COMMER
0090  43 49 41 4C 38 33 36 30  44 75 62 61 69 41 45 41  CIAL8360DubaiAEA
00a0  45 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  E               
00b0  20 20 37 38 34 30 31 35  31 30 30 30 33 30 31 30    78401510003010
00c0  34 30 30 30 30 30 30                              4000000

Look at your packager,
You start with
<isofield id="0"  length="4" name="MESSAGE TYPE INDICATOR"   class="org.jpos.iso.IFA_NUMERIC"/>
Its says first 4 are ASCII numeric.
so 30 31 30 30 are the first 4 in hex, which represent 0100.

If you dont know how to convert hex to ascii you should look it up or look at the chart at  http://www.asciitable.com/ 
Any non printable hex (e.g. 0x01,0x02 etc are displayed as a dot in the ascii equivalent side of the hexdump). 

Your next definition is
  <isofield id="1"  length="16"  name="BIT MAP"  class="org.jpos.iso.IFB_BITMAP"/>
  It say the the next field is a binary bitmap 16 wide.
  So you take the next 16 after the first 4.
  F2 3C 44 81 08 E0 80 00 00 00 00 00 00 00 00 20
  This is the bitmap and it indicates which bits are present and absent.
  For every present bit, it checks the corresponding field in the packager.

  So bitmap says field 2 is set.
  Your field 2 definitions is
   <isofield id="2" length="19" name="PAN - PRIMARY ACCOUNT NUMBER" class="org.jpos.iso.IFA_LLNUM"/>
   It knows the first 2 are length indicator and then take that many chars after it for the field.
   We start from where we left of for the bitmap.
   The next 2 are hex 31 and hex 36 which makes it 16 in ascii. So thats the length.
   The packager then takes the next 16  
   34 32 38 39 36 39 37 36 34 38 39 32 38 37 35 32 which is equivalent to 4289697648928752 and assigns it to field 2.

   So on and so forth you can parse it manually.

-chhil

ccav tech

unread,
Jun 14, 2019, 12:53:25 AM6/14/19
to jPOS Users
Thank you so much chhil.😄

ccav tech

unread,
Jun 14, 2019, 6:42:51 AM6/14/19
to jPOS Users
Hi Chhil,

I am not able to set the nested field for DE 127. I am getting null pointer exception.

Below are the rules

<?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">
<isopackager>
  <isofield
      id="0"
      length="4"
      name="MESSAGE TYPE INDICATOR"
      class="org.jpos.iso.IFA_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"
      class="org.jpos.iso.IFA_LLNUM"/>
  <isofield
      id="3"
      length="6"
      name="PROCESSING CODE"
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="4"
      length="12"
      name="AMOUNT, TRANSACTION"
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="7"
      length="10"
      name="TRANSMISSION DATE AND TIME"
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="11"
      length="6"
      name="SYSTEM TRACE AUDIT NUMBER"
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="12"
      length="6"
      name="TIME, LOCAL TRANSACTION"
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="13"
      length="4"
      name="DATE, LOCAL TRANSACTION"
      class="org.jpos.iso.IFA_NUMERIC"/>

  <isofield
      id="14"
      length="4"
      name="DATE, EXPIRATION"
      class="org.jpos.iso.IFA_NUMERIC"/>
 
  <isofield

      id="18"
      length="4"
      name="MERCHANTS TYPE"
      class="org.jpos.iso.IFA_NUMERIC"/>
 
  <isofield

      id="22"
      length="3"
      name="POINT OF SERVICE ENTRY MODE"
      class="org.jpos.iso.IFA_NUMERIC"/>
 
  <isofield
      id="25"
      length="2"
      name="POINT OF SERVICE CONDITION CODE"
      class="org.jpos.iso.IFA_NUMERIC"/>
 
  <isofield

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

      id="37"
      length="12"
      name="RETRIEVAL REFERENCE NUMBER"
      class="org.jpos.iso.IF_CHAR"/>
 
  <isofield
      id="41"
      length="8"
      name="CARD ACCEPTOR TERMINAL IDENTIFICACION"
      class="org.jpos.iso.IF_CHAR"/>
  <isofield
      id="42"
      length="15"
      name="CARD ACCEPTOR IDENTIFICATION CODE"
      class="org.jpos.iso.IF_CHAR"/>
  <isofield
      id="43"
      length="40"
      name="CARD ACCEPTOR NAME/LOCATION"
      class="org.jpos.iso.IF_CHAR"/>
 
  <isofield
      id="49"
      length="3"
      name="CURRENCY CODE, TRANSACTION"
      class="org.jpos.iso.IFA_NUMERIC"/>
 
  <isofield

      id="123"
      length="999"
      name="RESERVED PRIVATE USE"
      class="org.jpos.iso.IFA_LLLCHAR"/>
 
  <isofieldpackager
      id="127"  
      length="999999"
      name="RESERVED PRIVATE USE"
      class="org.jpos.iso.IFA_LLLLLLBINARY"
      packager="org.jpos.iso.packager.GenericSubFieldPackager">
     
     <isofield
          id="38"
          length="99"
          name="Additional POS Data Code"
          class="org.jpos.iso.IFA_LLCHAR"/>    
     
  </isofieldpackager>

  </isopackager>

Java Code:

GenericPackager packager = new GenericPackager("src/main/resources/basic.xml");

ISOMsg isoMsg = new ISOMsg();
isoMsg.setPackager(packager);
isoMsg.set(0, "0100");
isoMsg.set(2, "4289697648928752");
isoMsg.set(3, "000000");
isoMsg.set(4, "000000020000");

isoMsg.set(7, new SimpleDateFormat("MMddHHmmss").format(new Date()));
isoMsg.set(11, "105790");
isoMsg.set(12, new SimpleDateFormat("HHmmss").format(new Date()));
isoMsg.set(13, "0326");
isoMsg.set(14, "2407");
isoMsg.set(18, "5691");
isoMsg.set(22, "012");
isoMsg.set(25, "08");
isoMsg.set(32, "454899");
isoMsg.set(37, "908507105790");
isoMsg.set(41, "00050041");
isoMsg.set(42, "027174         ");
isoMsg.set(43, "COMMERCIAL8360DubaiAEAE");
isoMsg.set(49, "784");
isoMsg.set(123, "100030104000000");
isoMsg.set("127.038", "0");
/*
* isoMsg.set("127.010", "222");
*/

byte[] bIsoMsg = isoMsg.pack();

Please help me to resolve this issue.

chhil

unread,
Jun 14, 2019, 10:02:34 AM6/14/19
to jpos-...@googlegroups.com
I won't be sitting and debugging this for you every time. 
Get the source code for jpos and debug it. The least you can do is provide the exception stacktrace which should have sufficient information for someone on this group to point you in the right direction.  

-,chhil

ccav tech

unread,
Jun 17, 2019, 8:48:43 AM6/17/19
to jPOS Users
Hi Chhil,
Sorry to disturb you again below is stack trace of the exception which I got while setting sub field of de 127.

Exception in thread "main" org.jpos.iso.ISOException: error packing field 127 (org.jpos.iso.ISOException: java.lang.NullPointerException (java.lang.NullPointerException))
at org.jpos.iso.ISOBasePackager.pack(ISOBasePackager.java:184)
at org.jpos.iso.ISOMsg.pack(ISOMsg.java:456)
at com.isov2.TestISO.App.main(App.java:70)
Nested:org.jpos.iso.ISOException: java.lang.NullPointerException (java.lang.NullPointerException)
at org.jpos.iso.packager.GenericSubFieldPackager.pack(GenericSubFieldPackager.java:167)
at org.jpos.iso.ISOMsgFieldPackager.pack(ISOMsgFieldPackager.java:60)
at org.jpos.iso.ISOBasePackager.pack(ISOBasePackager.java:175)
at org.jpos.iso.ISOMsg.pack(ISOMsg.java:456)
at com.isov2.TestISO.App.main(App.java:70)
Nested:java.lang.NullPointerException
at org.jpos.iso.packager.GenericSubFieldPackager.pack(GenericSubFieldPackager.java:123)
at org.jpos.iso.ISOMsgFieldPackager.pack(ISOMsgFieldPackager.java:60)
at org.jpos.iso.ISOBasePackager.pack(ISOBasePackager.java:175)
at org.jpos.iso.ISOMsg.pack(ISOMsg.java:456)
at com.isov2.TestISO.App.main(App.java:70)

Please help.

Andy Orrock

unread,
Jun 17, 2019, 6:21:56 PM6/17/19
to jpos-...@googlegroups.com
Hi --

Not sure what you're attempting here:

  <isofieldpackager
      id="127"  
      length="999999"
      name="RESERVED PRIVATE USE"
      class="org.jpos.iso.IFA_LLLLLLBINARY"
      packager="org.jpos.iso.packager.GenericSubFieldPackager"> 

Is this an embedded bitmap inside of 127?

Noting that your primary bitmap is IFB_BITMAP.  I have an interface like that and -- when encountering an embedded bitmap -- it looks like this (sorry, my example is Hex lengths and EBCDIC which you should ignore):

    <isofieldpackager id="101" length="999" name="CARD RESULTS" class="org.jpos.iso.IFB_LLLHBINARY" emitBitmap="true" bitmapField="0" firstField="1" packager="org.jpos.iso.packager.GenericSubFieldPackager">
        <isofield id="0" length="4"  name="Bitmap"                                                                class="org.jpos.iso.IFB_BITMAP"/>
        <isofield id="1" length="19" name="PAN"                                                       pad="true"  class="org.jpos.iso.IFB_LLHECHAR"/>
        <isofield id="2" length="19" name="Truncated/Masked PAN"                                      pad="true"  class="org.jpos.iso.IFB_LLHECHAR"/>
        <isofield id="3" length="4"  name="Last four"                                                 pad="true"  class="org.jpos.iso.IFE_CHAR"/>
        <isofield id="4" length="19" name="Tokenized PAN"                                             pad="true"  class="org.jpos.iso.IFB_LLHECHAR"/>
    </isofieldpackager>

Andy

Andrés Alcarraz

unread,
Jun 17, 2019, 6:21:57 PM6/17/19
to jpos-...@googlegroups.com

Hi ccav

You are not defining the bitmap subfield  for field 127:

You need something like this:


<isofieldpackager
   id="127"  
   length="999999"
   name="RESERVED PRIVATE USE"
   class="org.jpos.iso.IFA_LLLLLLBINARY"
   packager="org.jpos.iso.packager.GenericSubFieldPackager">
<isofield
    id="0"
    length="0"
    name="Placeholder"
    class="org.jpos.iso.IF_NOP" />
<isofield
    id="1"
    length="16"
    name="Bit Map"
    class="org.jpos.iso.IFA_BITMAP" />
 
And declare all the fields previous to tye field 38 I believe, take a look at postpack.xml as an example.

Good luck
Andrés Alcarraz
Transactility, Inc.

ccav tech

unread,
Jun 18, 2019, 3:01:53 AM6/18/19
to jPOS Users
thanks Andres,its working now.

Reply all
Reply to author
Forward
0 new messages