Invalid message length *08

52 views
Skip to first unread message

Hamza Azam

unread,
Mar 1, 2022, 6:26:16 AM3/1/22
to jPOS Users
Hi, 

I am sending this message to the ISOServer but I am getting invalid message length error. 

Message Sent: 
00000000 00 2A 30 38 30 30 82 20 01 00 00 00 00 00 04 00   .*0800. ........
00000010 00 00 00 00 00 00 30 33 30 31 31 35 34 36 31 39   ......0301154619
00000020 31 38 34 39 39 36 54 41 50 30 30 31                         184996TAP001

TYPE: 0800
DE   7     DATE10: 0301161741 -> '0301161741'
DE  11    NUMERIC: 424589 -> '424589'
DE  24    NUMERIC: TAP -> 'TAP'
DE  70    NUMERIC: 001 -> '001'

Recieving this error Jpos server: 
I am using ASCII Channel

<log realm="simulator_10000.server.session/10.0.70.34:45718" at="2022-03-01T16:17:41.707">
  <session-start/>
</log>
<log realm="channel/10.0.70.34:45718" at="2022-03-01T16:17:41.709" lifespan="2ms">
  <receive>
    <iso-exception>
      Invalid message length *08
      org.jpos.iso.ISOException: Invalid message length *08
        at org.jpos.iso.channel.ASCIIChannel.getMessageLength(ASCIIChannel.java:118)
        at org.jpos.iso.BaseChannel.receive(BaseChannel.java:712)
        at org.jpos.iso.ISOServer$Session.run(ISOServer.java:344)
        at org.jpos.util.ThreadPool$PooledThread.run(ThreadPool.java:76)
    </iso-exception>
  </receive>
</log>

murtuza chhil

unread,
Mar 1, 2022, 9:08:46 PM3/1/22
to jPOS Users
You are using the wrong channel.
How did you decide on using ASCIIChannel?
ASCIIChannel uses the first 4 bytes and makes it a string and does a Integer.parseInt on it and it obviously fails.

You can see the code here....
https://github.com/jpos/jPOS/blob/master/jpos/src/main/java/org/jpos/iso/channel/ASCIIChannel.java#L113

Use NACChannel, it uses the first 2 bytes and interprets the length to be 42 and will at least read the whole message.

Next this message data is unpacked using the packager you have configured, if its configured correctly you will get a ISOMsg.

-chhil

Reply all
Reply to author
Forward
0 new messages