Unable to unpack Hex and BCD message ISO93BPackager

183 views
Skip to first unread message

Emmanuel Mensah

unread,
Oct 15, 2020, 6:52:14 PM10/15/20
to jPOS Users
Hello jPOS Users
I have been struggling with this issue for two weeks now.
When I send an echomessage packed with ISO93BPackager to my server, I get this error at the server side.

Message from client------------
Header : 49534F383538332D31393933303031303030303030
byte DUMP : 180482200110000000000000000c000000001015104511635178831020101510100000000006000036
BitSet : {7, 11, 24, 28, 93, 94}
BitMap : 00000001000100000000000010001000000000000000000000000000000000000000000000000000000000000000011000000000000000000000000000000000
MTI = 1804
Field (7) = 1015104511
Field (11) = 635178
Field (24) = 831
Field (28) = 201015
Field (93) = 1000000000
Field (94) = 000036

At the server side----------
<unpack>
    49534F383538332D31393933303031303030303030180482200110000000000000000C0000000010152244345214580831201016060000360A1000000000
    <bitmap>{2, 5, 6, 7, 8, 11, 12, 13, 19, 20, 22, 24, 27, 28, 29, 35, 36, 39, 40, 43, 45, 46, 48, 51, 52, 56, 59, 60, 61, 64}</bitmap>
    <unpack fld="2" packager="org.jpos.iso.IFB_LLNUM">
      <value>333030313030303030301804822001100000000</value>
    </unpack>
    <unpack fld="5" packager="org.jpos.iso.IFB_NUMERIC">
      <value>0000000C0000</value>
    </unpack>
    <unpack fld="6" packager="org.jpos.iso.IFB_NUMERIC">
      <value>000010152244</value>
    </unpack>
    <unpack fld="7" packager="org.jpos.iso.IFB_NUMERIC">
      <value>3452145808</value>
    </unpack>
    <unpack fld="8" packager="org.jpos.iso.IFB_NUMERIC">
      <value>31201016</value>
    </unpack>
    <unpack fld="11" packager="org.jpos.iso.IFB_NUMERIC">
      <value>060000</value>
    </unpack>
    <unpack fld="12" packager="org.jpos.iso.IFB_NUMERIC">
      <value>360A10000000</value>
    </unpack>
    <iso-exception>
      org.jpos.iso.IFB_NUMERIC: Problem unpacking field 13
      <nested-exception>
      java.lang.ArrayIndexOutOfBoundsException: 62
        at org.jpos.iso.ISOUtil.bcd2str(ISOUtil.java:333)
        at org.jpos.iso.BCDInterpreter.uninterpret(BCDInterpreter.java:67)
        at org.jpos.iso.ISOStringFieldPackager.unpack(ISOStringFieldPackager.java:173)
        at org.jpos.iso.ISOBasePackager.unpack(ISOBasePackager.java:233)

The server receives the message with the header 49534F383538332D31393933303031303030303030180482200110000000000000000C0000000010152244345214580831201016060000360A1000000000

And its (server) trying to unpack all these fields <bitset>{2, 5, 6, 7, 8, 11, 12, 13, 19, 20, 22, 24, 27, 28, 29, 35, 36, 39, 40, 43, 45, 46, 48, 51, 52, 56, 59, 60, 61, 64}</bitset>
instead of these BitSet : {7, 11, 24, 28, 93, 94} because these the only fields present in the message.

Please your unfailing assistance.
Regards.
 

Andrés Alcarraz

unread,
Oct 15, 2020, 6:55:29 PM10/15/20
to jpos-...@googlegroups.com
Hi Emmanuel.

It seems you are passing the header to the packager. Maybe you didn't configure the header properly in the server's channel?


Andres Alcarraz | Transactility, Inc.  | Lima, Perú| e: a...@transactility.com | t: +51 914498384 | sk: alcarraz1976
El 15/10/20 a las 17:51, Emmanuel Mensah escribió:
--
--
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 view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/799c0175-fdcd-469a-9c65-b2c88babe564n%40googlegroups.com.

Emmanuel Mensah

unread,
Oct 15, 2020, 7:23:37 PM10/15/20
to jPOS Users
Thank you for your reply.
Im running qserver with this configuration--------
<server class="org.jpos.q2.iso.QServer" logger="Q2" name="EZMswitchListener">
    <attr name="port" type="java.lang.Integer">4019</attr>
    <channel name="EZMswitchListener" class="org.jpos.iso.channel.NACChannel" logger="Q2" type="server"
             realm="EZMswitchListener" packager="org.jpos.iso.packager.GenericPackager">
        <property name="packager-config" value="cfg/packager/iso93binary.xml"/>
        <property name="packager-logger" value="Q2"/>
    </channel>
    <request-listener class="com.nfs.IsoListener">
    </request-listener>
</server>

How do I configure the server's channel to accept header?

Andrés Alcarraz

unread,
Oct 15, 2020, 7:35:25 PM10/15/20
to jpos-...@googlegroups.com
Just add the header property to the channel


    <channel name="EZMswitchListener" class="org.jpos.iso.channel.NACChannel" logger="Q2" type="server"
             realm="EZMswitchListener" packager="org.jpos.iso.packager.GenericPackager" header="49534F383538332D31393933303031303030303030" >

The channel takes the header length to know how many bytes to take from the input before the actual message, and sends that header for outgoing messages if the iso message has no header set, for NAC channel which expects header in BCD every two digits is a byte and you have 21 bytes of header if I counted them correctly

Beware that your header does not look like a valid header for that channel since it's not BCD, but it may just work anyway if you don't care about the header in your server.

Hope this helps

Andres Alcarraz | Transactility, Inc.  | Lima, Perú| e: a...@transactility.com | t: +51 914498384 | sk: alcarraz1976
El 15/10/20 a las 18:23, Emmanuel Mensah escribió:

Emmanuel Mensah

unread,
Oct 15, 2020, 8:14:40 PM10/15/20
to jPOS Users
Actually this is how I am adding the header from the client 
ISOMsg m = new ISOMsg();
            String header = "ISO8583-1993001000000";
            m.setHeader(header.getBytes());

ISO8583-1993 => Protocol Version Identifier 
00 => Message Source (00 for ATM,01 for POS)
10 => Version number (defaults to 10)
000 => Error in field ( defaults to 000)
00 => defaults to 00

A few pointers:
1. The message sent or received by NFS is a combination of HEX and BCD. Numeric fields are expressed in BCD e.g. the MTI (1804) and dates (200720). All fields that are in ASCII should be converted to HEX. This means the ISO Header, which is in ASCII, should be converted to 49534f383538332d31393933303231303030303030 before it is sent across the network. A sample correct echo message prepared by NFS will look like this:
49534F383538332D31393933303031303030303030180482200110000000000000000C0000000007201356047970750831200720060000360A1000000000

I picked the above from my reference document (spec document)

Emmanuel Mensah

unread,
Oct 16, 2020, 3:50:33 AM10/16/20
to jPOS Users
Thank you so much,
I did exactly what you said I added the header to the channel and now I'm able to unpack the message at the server side.

Regards

On Thursday, October 15, 2020 at 11:35:25 PM UTC a...@transactility.com wrote:
Reply all
Reply to author
Forward
0 new messages