-2

After packing my data and while trying to send to JPOS channel (server), i do receive the below error.

Length = 0030 Byte length(b): 48 :: Incoming data HEX(d): 3830300238000000C2820000303030303130303732323137313934363030303030363030303231383030303631373139 org.jpos.iso.IFA_LLNUM: Problem unpacking field 33 (java.lang.ArrayIndexOutOfBoundsException: 48) unpacking field=33, consumed=42 org.jpos.iso.ISOException: org.jpos.iso.IFA_LLNUM: Problem unpacking field 33 (java.lang.ArrayIndexOutOfBoundsException: 48) unpacking field=33, consumed=42 at org.jpos.iso.ISOBasePackager.unpack(ISOBasePackager.java:273) at org.jpos.iso.ISOMsg.unpack(ISOMsg.java:416) at org.jpos.iso.BaseChannel.unpack(BaseChannel.java:903) at org.jpos.iso.BaseChannel.receive(BaseChannel.java:671) at org.jpos.iso.ISOServer$Session.run(ISOServer.java:130) at org.jpos.util.ThreadPool$PooledThread.run(ThreadPool.java:71) --- data --- 0000 38 30 30 02 38 00 00 00 C2 82 00 00 30 30 30 30 800.8.......0000 0010 31 30 30 37 32 32 31 37 31 39 34 36 30 30 30 30 1007221719460000 0020 30 36 30 30 30 32 31 38 30 30 30 36 31 37 31 39 0600021800061719

org.jpos.iso.IFA_LLNUM: Problem unpacking field 33 (java.lang.ArrayIndexOutOfBoundsException: 48) unpacking field=33, consumed=42 org.jpos.iso.ISOException: org.jpos.iso.IFA_LLNUM: Problem unpacking field 33 (java.lang.ArrayIndexOutOfBoundsException: 48) unpacking field=33, consumed=42 at org.jpos.iso.ISOBasePackager.unpack(ISOBasePackager.java:273) at org.jpos.iso.ISOMsg.unpack(ISOMsg.java:416) at org.jpos.iso.BaseChannel.unpack(BaseChannel.java:903) at org.jpos.iso.BaseChannel.receive(BaseChannel.java:671) at org.jpos.iso.ISOServer$Session.run(ISOServer.java:130) at org.jpos.util.ThreadPool$PooledThread.run(ThreadPool.java:71)

And, i am using the below java class to transport my packed data.

public static String networkTransport(String isoMessage) throws UnknownHostException, IOException {
        Socket connection = new Socket("192.168.3.118", 1010);
        BufferedOutputStream bos = new BufferedOutputStream(connection.getOutputStream());

        OutputStreamWriter osw = new OutputStreamWriter(bos);
        int len = isoMessage.length(); // get the length of the data
        // SInce your packager name says Postilion, I think this will work.
        osw.write(len >> 8); // send the length bytes in 2 bytes. this is the byte 1
       // osw.write(len);// send the length bytes in 2 bytes. this is the byte 2

        osw.write(isoMessage);
        osw.flush();

        byte[] arrOutut = new byte[4096];
        int count = connection.getInputStream().read(arrOutut, 0, 4096);

        String clientRequest = "";
        for (int outputCount = 0; outputCount < count; outputCount++) {
            char response = (char) arrOutut[outputCount];
            clientRequest = clientRequest + response;
        }

        connection.close();

        return clientRequest;
    }

The challenge i am currently facing is how I can have a smooth flow with my JPOS channel. All suggestions are highly welcomed.

Israel Meshileya
  • 293
  • 4
  • 18
  • 2
    Your issue is not related to iso8583 messages packing. It is purely development issue potentially related to the external libraries, when unexpected/unsupported data packing/parsing processed. Due to your error logs It can be EMV data packing issue when instead TLV data used some unexpected garbage data. – iso8583.info support Jul 27 '16 at 08:26
  • 1
    thanks so much for your response. but, what i am yet to really understand is that. I see what is been packed in my Android Studio console. but, at the other receiving end, it only connects...without showing what has already been packed...before actually returning the null error. – Israel Meshileya Jul 27 '16 at 08:58
  • 2
    as @iso8583.infosupport said it should be a programming error. But have you double checked that the exception is encountered in ISO data element 55 or whether it is from some other data element ? Is it possible to log the elements one by one as they are processed to see at what stage it fails precisely. – Adarsh Nanu Jul 28 '16 at 05:07
  • 1
    What i noticed is that, my packager packages all the required fields, but on getting to the one which isn't necessary to be packaged...it returns null....Does it mean i have to send everything required in my isoPackager. cos, i have a structured design for my isoField which is in this format /* 01 SALE */ { F02_PAN, F03_PROC, F04_AMOUNT, F11_STAN, F14_EXP, F22_POSE, F23, F25_POCC, F26_CAPTURE, F35_TRACK2, F36_TRACK3, F38_AUTH, F39_RSP, F41_TID, F42_ACCID, F49_CURRENCY, F52_PIN, F53_SCI, F55_ICC, F60, F64_MAC }, – Israel Meshileya Jul 29 '16 at 13:46
  • In the request can you see how you are populating the below DE36 Track 3 - This is outdated. -- DE38 Authnum and DE39 Response Code - these are normally available in advise request and financial authorization response. Not in authorization request. -- DE52 PIN Block - Is it a PIN based transaction and you have a PIN Block-- F64 MAC - Have you calculated the MAC -- – Adarsh Nanu Jul 29 '16 at 16:35
  • 2
    FYI, In n ISO8583 interface you define the bitmaps(which specify what is mandatory, optional, not required) and field by field specifications. All mandatory fields are to be populated, otherwise messages get rejected from percipient end with format error. Whereever it is not mandatory the bit should be made optional. – Adarsh Nanu Jul 29 '16 at 16:36
  • thanks so much for your comment @libadarsh.so.1.0.1 i really appreciate. what i will also like to ask is this. I am using a pure JAVA class packager to package my message, but there is a demo server to test what i am packaging. although, in my log console, i can see the things i package and the things been unpackaged, but on my server, i can only see length = 3038. NOTE: JPOS is been used in writing this demo server. what i will now like to ask is, must i use JPOS to do the packaging and unpacking???...for me to see it in this demo server – Israel Meshileya Aug 08 '16 at 09:04
  • is the issue resolved. and if yes can you pls post the issue and mark it closed. – Adarsh Nanu Aug 08 '16 at 09:07
  • i do not know how to do that @libadarsh...will be so glad if you can put me through. – Israel Meshileya Aug 08 '16 at 09:09
  • @IsraelMeshileya can you post the log of data elements you pack. – Adarsh Nanu Aug 08 '16 at 18:12
  • @libadarsh.so.1.0.1 I have posted the log up there...but, at the JPOS server side, i am always seeing length = 3038... – Israel Meshileya Aug 09 '16 at 08:30
  • @IsraelMeshileya is it possible that you can disable bit 55 and give a try – Adarsh Nanu Aug 09 '16 at 08:35
  • but, i am only sending field 7, 11, 12, 13 and 41.....trying to test my echo message.. – Israel Meshileya Aug 09 '16 at 08:41
  • @IsraelMeshileya can you print and see the he dump of bit map – Adarsh Nanu Aug 10 '16 at 18:07
  • @IsraelMeshileya make sure you have not turned on any bit by accident and coincidentally its data not available ? and btw do you have data and member definitions for ISOPacker? verify the bitmap definition for the type size and encoding of data – Adarsh Nanu Aug 10 '16 at 18:25
  • Thanks for your time @libadarsh.so.1.0.1 what i am currently expressing is updated in my question...i still do not understand where i am getting it wrong. – Israel Meshileya Aug 11 '16 at 08:58

3 Answers3

3

Belew is how I would split your data.

383030                          //echo message type as you said 0800. 
                                But where is the starting 0 (0x30) ? 
0238000000C28200                //bitmap 8 bytes -  packed BCD
00303030303130303732323137313934363030303030363030303231383030303631373139 - data

Below are the bits you have turned on. Can you verify whether you have all the field data for the below turned on bits ? I don't understand why you need DE55 in an echo message.

0   0000
2   0010 7
3   0011 11, 12
8   1000 13
0   0000
0   0000
0   0000
0   0000
0   0000
0   0000
C   1100 41, 42
2   0011 47, 48
8   1000 49
2   0011 55, 56  
0   0000 
0   0000

On an assumption, I would split your data like below:

00 30 30 30 30 31 30 30 37 32   -   transmission date mmddhhmmss 
32 31 37 31 39                  -   trace number
34 36 30 30 30 30               -   local time
30 36 30 30                     -   local date
30 32 31 38 30 30 30 36         -   terminal id
31 37 31 39                     -   this is all the remaining data for bits 42, 47, 48, 49,
                                    55 and 56. 

So getting a null pointer is quite obvious.

Laurel
  • 5,965
  • 14
  • 31
  • 57
Adarsh Nanu
  • 2,133
  • 1
  • 13
  • 18
  • 1
    Since I am not using jpos to pack and unpack my data....but..I am connecting to a jpos server...what do you suggest I do??? – Israel Meshileya Aug 12 '16 at 08:17
  • 1
    irrespective of what server is running on the other end or what method you are using to pack and unpack message, in iso8583 thumb rule is that both sides should be in agreement on the bits optional, required and not required and if present what their data types and length. by splitting your message I mean to day that in bitmap you have specified for eg. data element 55. but you don't have the data. in the message data I have split for you, are you able to split and show me field by field in order. that will explain you the issue. – Adarsh Nanu Aug 12 '16 at 08:27
  • 1
    isofields.put("7", "0722171946"); isofields.put("11", "000218"); isofields.put("12", "171946"); isofields.put("13", "0722"); isofields.put("41", "27002368"); isofields.put("47", "442"); are the data i am sending..to carrying out my echo message. – Israel Meshileya Aug 12 '16 at 09:09
  • 1
    is 47 the last element you are packing? – Adarsh Nanu Aug 12 '16 at 09:19
  • then how is 49,55,56 added in bitmap. are you hard coding the bitmap which is used for auth message? – Adarsh Nanu Aug 12 '16 at 09:26
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/120782/discussion-between-israel-meshileya-and-libadarsh-so-1-0-1). – Israel Meshileya Aug 12 '16 at 09:32
  • @libadarsh...won't mind chatting you up in the room i created....I will so much appreciate your presence there. – Israel Meshileya Aug 12 '16 at 10:00
2

I was able to resolve this issue, while making use of the JPOS library, but had to strimline it to using just the things i will be needing at my own end.

If you may want to use this method on your android device, these are the folders i actually used

  1. Channel
  2. Filter
  3. Gui
  4. Header
  5. Packager
  6. Validator and the whole java class here

or better still, use all the files and folders here

Israel Meshileya
  • 293
  • 4
  • 18
0

In packaging data for jpos server you have to check two details:

1) jpos server channel type (leading or trailing data)

2) jpos server packager

Please note that jpos server is not expecting raw stream data from clients. On jpos.org site you can find very good written jpos manual.

Amit Vujic
  • 1,632
  • 1
  • 24
  • 32