javaiso8583jpos

How to make a Custom Channel for BASE24Channel JPOS - ISO8583


allow me to ask my issues about iso8583 with Java, so i'm having a trouble while generating ISO8583 Message with a new system with JPOS Java (the system that i'm developing), so i'm trying to match the generated iso8583 message by the old system and when i tried to compare the iso8583 message that generated by a new system with a network sniffer tool (wireshark) , it doesn't match the message.

Old System Hex Dump

00000000  65                                                 e
00000001  49 53 4f 30 30 36 30 30  30 30 36 30 30 38 30 30   ISO00600 00600800
00000011  38 32 32 30 30 30 30 30  30 30 30 30 30 30 30 30   82200000 00000000
00000021  30 34 30 30 30 30 30 30  30 30 30 30 30 30 30 30   04000000 00000000
00000031  30 34 31 38 30 37 34 32  31 37 30 30 30 30 30 31   04180742 17000001
00000041  30 30 31 03                                        001.

New System Hex Dump

00000000  49 53 4f 30 30 36 30 30  30 30 31 30 30 38 30 30   ISO00600 00100800
00000010  38 32 32 30 30 30 30 30  30 30 30 30 30 30 30 30   82200000 00000000
00000020  30 34 30 30 30 30 30 30  30 30 30 30 30 30 30 30   04000000 00000000
00000030  30 34 31 38 31 30 30 31  33 39 31 37 30 31 33 39   04181001 39170139
00000040  31 36 31 03                                        161.

As we can see, i'm trying to do a 0800 message to the same ISO Server but i have different result of byte message, also i tried to use another channel seems like BASE24Channel from JPOS lib has the closest match, but it's still missing the first byte (before the ISO Header part), can anyone help me? i supposed i need to develop a custom channel class? correct me if im wrong, and Thank you for the help :D


Solution

  • I haven't time to test this, but to get you the idea, you would need to extend BCDChannel to read and send the message length in BCD. And add some code to generate and consume the extra byte (0x03), like this:

    public class MyCustomChannel extends BCDChannel {
        protected void sendMessageTrailler(ISOMsg m, int len) throws IOException {
            serverOut.write(0x03); //write the extra trailer byte (0x03)
        }
        protected void getMessageTrailer() throws IOException {
            serverIn.read(); //read the extra trailer byte (0x03).
        }
    }
    
    

    Then configure your channel XML to use your custom class.

    You may need to override the sendMessageLength and getMessageLength also if you need to add or subtract 2.