-1

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

mc ser
  • 43
  • 1
  • 7
  • That `e` seems to be the length, in the new dump, the length is not present, can you show the code that writes that dump? – Andrés Alcarraz Apr 18 '23 at 15:58
  • Hi @AndrésAlcarraz that is the question though, how do i generate e (first byte message) on my new system code, on my new system i'm using the default BASE24Channel by JPOS Lib [link](https://github.com/jpos/jPOS/blob/master/jpos/src/main/java/org/jpos/iso/channel/BASE24Channel.java) to generate the dump (without `e`) – mc ser Apr 19 '23 at 02:27
  • And my question to you was, how do you know which value that prefix should have, will always be an e? Depends on other factors, etc, also I mentioned the second dump doesn't show the length, and that e seems to be the length or part of it, please provide more information so we can help you. – Andrés Alcarraz Apr 19 '23 at 12:28
  • Let's say we assume that the prefix was always fixed values which is `e` or maybe a message length, how can i make my second dump to generate an `e` in front of the header? – mc ser Apr 20 '23 at 01:12
  • Add it to the message header, that as a header for the channel, but I'm 100% positive that's not what you need. Also, you continue to not completely show the dump for the new system, I don't see the length there – Andrés Alcarraz Apr 20 '23 at 02:28
  • hmm the `e` will work if i added it to header, but what if it's a length of the message? also what do you mean the completely show the dump? that's is the complete dump of the new system though, it shows no length because it is a BASE24Channel from Jpos, it got no length prefix – mc ser Apr 20 '23 at 02:37
  • That's the thing, I don't think you should in the channel header, I think it's part of the header, but you are not showing the prefix with the length for the new system dump, so, your comparation between systems seems to be wrong, tha `e` seems to be the length because the length of the old system dump is 67. If it's a length, it seems you are missing a byte from that dump, because I doubt the maximum length could be 255. – Andrés Alcarraz Apr 20 '23 at 02:48
  • Please show complete log and complete dumps, including the length part in the second dump. – Andrés Alcarraz Apr 20 '23 at 02:49
  • that's already a complete dumps tho, but let me give the pcap file to you [filelink](https://www.file.io/yWdK/download/2y5MRpNZ2M1l) – mc ser Apr 20 '23 at 02:57
  • Ohh sorry, Base24 channel does not send the length – Andrés Alcarraz Apr 20 '23 at 02:59
  • yeah, i was using the BASE24Channel by JPOS [source code lib](https://github.com/jpos/jPOS/blob/master/jpos/src/main/java/org/jpos/iso/channel/BASE24Channel.java) – mc ser Apr 20 '23 at 03:01
  • You would need to override the send message length and receive message length, if that `e` is indeed the message length, If not it goes in the header, But if you don't knoew where it belongs, I cannot tell you what's the best way to generate it and consume it – Andrés Alcarraz Apr 20 '23 at 03:05
  • That e seems to be the length in BCD, but it's off by two bytes (2 bytes short), and probably there is a previous byte which is 0 that is part of the message too – Andrés Alcarraz Apr 20 '23 at 03:08
  • Yeah thats the problem, i'm haven't got any experience about byte manipulation thing, is there any guide about how to manipulate the message? – mc ser Apr 20 '23 at 03:09
  • I could add an answer tomorrow with that. – Andrés Alcarraz Apr 20 '23 at 03:09
  • Alright thanks for the help @AndrésAlcarraz, i'll wait for your guide – mc ser Apr 20 '23 at 03:13
  • I just posted something that should do the trick :) untested but to get you going. – Andrés Alcarraz Apr 20 '23 at 03:23

1 Answers1

0

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.

Andrés Alcarraz
  • 1,570
  • 1
  • 12
  • 21