Search code examples
javaandroidisoemviso8583

Having issues with my ISO8583 packager while connecting to jpos channel


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.


Solution

  • 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