Hex Issues

55 views
Skip to first unread message

Amer

unread,
Dec 17, 2006, 4:21:18 AM12/17/06
to jPOS Users
Hi all,
iam kinda new in the JPOS :) and i have a question
i have a hex channel --> ISOChannel clientSideChannel = new
HEXChannel(DONT KNOW WHAT PACKAGER TO USE);

the problem that when the POS Device send me an ISO Msg -Hex Format- i
got an Exception
it seems that iam not using the appropriate Packager, and i dont know
what package to use ! or even make my custom packager
there is no good tutorial and the source code of JPos is not commented
well :(
please help, thanx in advance

Mark Salter

unread,
Dec 17, 2006, 5:39:19 AM12/17/06
to jpos-...@googlegroups.com
Amer wrote:
> Hi all,
> iam kinda new in the JPOS :) and i have a question
> i have a hex channel --> ISOChannel clientSideChannel = new
> HEXChannel(DONT KNOW WHAT PACKAGER TO USE);
May I first point you to :-

http://catb.org/~esr/faqs/smart-questions.html

>
> the problem that when the POS Device send me an ISO Msg -Hex Format- i
> got an Exception

The link above will suggest that showing us the Exception you received
is useful detail, a mention of the hardware involved or indeed raw
message may contain enough information for some people reading this list
to make educated suggestions.

> it seems that iam not using the appropriate Packager, and i dont know
> what package to use ! or even make my custom packager
> there is no good tutorial and the source code of JPos is not commented
> well :(

There are examples. I would agree that the source is comment light, but
I have found it good enough. Due to Alejandro's (and others) efforts
most of it just works anyway 8).

> please help, thanx in advance

Have you purchased the programmers guide, I would suggest you do if you
have not.

http://jpos.org/products/proguide

It is *only* $50 and worth every 'penny'.

--
Mark

chhil

unread,
Dec 17, 2006, 8:17:26 AM12/17/06
to jpos-...@googlegroups.com
Look at your ISO9583 spec and determine the flavor see what the field definitions are and what type of packing is used. Try to see if there is a packager and channel available for it by looking at the packager definition in the xml or the packager java code.
If you find one that matches there is less work for you, if not mimic one of the packagers to match your flavor of ISO8583.
And as Mark mentions the exception , the packager/channel you are using would go a long way in determining what is wrong with your code or definitions.
 
-chhil
 

Amer

unread,
Dec 17, 2006, 9:25:01 AM12/17/06
to jPOS Users
sorry guys, iam NEW in the JPos stuff
i didnt make my self clear, and thanx for the quick response
iam new at my company and they gave me this Document:
-----------------------------------------------------------------------------------------------------------------------------
jPOS Programmer's Guide

by Alejandro P Revilla
Extensive review, and multiple corrections: Dave Bergert
Nobel Electronics LLC
Review, Feedback, Corrections: Alwyn Schoeman
Debian.org
Copyright © 2002 jPOS.org
jPOS is an ISO-8583 library/framework that can be used to implement
financial interchanges, protocol converters,
payment gateways, credit card verification clients and servers
(merchant/issuer/acquirer roles), etc.
This document describes jPOS's design, its internals and teaches you
how to get the most out of it.

-----------------------------------------------------------------------------------------------------------------------------

is it the right Document ??

and the Exception that i faced is about Unpacking field number 62
and what i did to skip the error, i add to the ISOBasePackager.java
the following statement :

if (i==62) {
continue;
}

anyway thats not for solving the error it was for just checking where
is the error
i wrote that cuz i want to just Send back to the POS Device Response
Just that for now!

anyway the Exception was like this befor putting trhe IF statement

iam using a HexChannel by the way

EXCEPTION :


error unpacking field 62
org.jpos.iso.ISOException: org.jpos.iso.IFB_LLLCHAR: Problem unpacking
field 62
(java.lang.ArrayIndexOutOfBoundsException: 69)
at
org.jpos.iso.ISOStringFieldPackager.unpack(ISOStringFieldPackager.jav
a:218)
at
org.jpos.iso.ISOBasePackager.unpack(ISOBasePackager.java:242)
at org.jpos.iso.ISOMsg.unpack(ISOMsg.java:322)
at org.jpos.iso.BaseChannel.receive(BaseChannel.java:531)
at org.jpos.iso.ISOServer$Session.run(ISOServer.java:123)
at
org.jpos.util.ThreadPool$PooledThread.run(ThreadPool.java:100)
Nested:java.lang.ArrayIndexOutOfBoundsException: 69
at
org.jpos.iso.AsciiInterpreter.uninterpret(AsciiInterpreter.java:88)
at
org.jpos.iso.ISOStringFieldPackager.unpack(ISOStringFieldPackager.jav
a:213)
at
org.jpos.iso.ISOBasePackager.unpack(ISOBasePackager.java:242)
at org.jpos.iso.ISOMsg.unpack(ISOMsg.java:322)
at org.jpos.iso.BaseChannel.receive(BaseChannel.java:531)
at org.jpos.iso.ISOServer$Session.run(ISOServer.java:123)
at
org.jpos.util.ThreadPool$PooledThread.run(ThreadPool.java:100)
<log realm="POSRealTest" at="Sun Dec 17 17:13:06 EET 2006.671">
<unpack>

02007024058000C0800419666666666F00000000000000666600032866660012022900393531
39353135313935313935313935313935313935313430300006353134393236
<bitmap>{2, 3, 4, 11, 14, 22, 24, 25, 41, 42, 49, 62}</bitmap>
<unpack fld="2" packager="org.jpos.iso.IFB_LLNUM">
<value>666666666F000000000</value>
</unpack>
<unpack fld="3" packager="org.jpos.iso.IFB_NUMERIC">
<value>000066</value>
</unpack>
<unpack fld="4" packager="org.jpos.iso.IFB_NUMERIC">
<value>660003286666</value>
</unpack>
<unpack fld="11" packager="org.jpos.iso.IFB_NUMERIC">
<value>001202</value>
</unpack>
<unpack fld="14" packager="org.jpos.iso.IFB_NUMERIC">
<value>2900</value>
</unpack>
<unpack fld="22" packager="org.jpos.iso.IFB_NUMERIC">
<value>935</value>
</unpack>
<unpack fld="24" packager="org.jpos.iso.IFB_NUMERIC">
<value>139</value>
</unpack>
<unpack fld="25" packager="org.jpos.iso.IFB_NUMERIC">
<value>35</value>
</unpack>
<unpack fld="41" packager="org.jpos.iso.IF_CHAR">
<value>15195195</value>
</unpack>
<unpack fld="42" packager="org.jpos.iso.IF_CHAR">
<value>1951951951400 ♠</value>
</unpack>
<unpack fld="49" packager="org.jpos.iso.IF_CHAR">
<value>514</value>
</unpack>
<iso-exception>
org.jpos.iso.IFB_LLLCHAR: Problem unpacking field 62
<nested-exception>
java.lang.ArrayIndexOutOfBoundsException: 69
at
org.jpos.iso.AsciiInterpreter.uninterpret(AsciiInterpreter.java:88)
at
org.jpos.iso.ISOStringFieldPackager.unpack(ISOStringFieldPackager.jav
a:213)
at
org.jpos.iso.ISOBasePackager.unpack(ISOBasePackager.java:242)
at org.jpos.iso.ISOMsg.unpack(ISOMsg.java:322)
at org.jpos.iso.BaseChannel.receive(BaseChannel.java:531)
at org.jpos.iso.ISOServer$Session.run(ISOServer.java:123)
at
org.jpos.util.ThreadPool$PooledThread.run(ThreadPool.java:100)
</nested-exception>
org.jpos.iso.ISOException: org.jpos.iso.IFB_LLLCHAR: Problem
unpacking fie
ld 62 (java.lang.ArrayIndexOutOfBoundsException: 69)
at
org.jpos.iso.ISOStringFieldPackager.unpack(ISOStringFieldPackager.jav
a:218)
at
org.jpos.iso.ISOBasePackager.unpack(ISOBasePackager.java:242)
at org.jpos.iso.ISOMsg.unpack(ISOMsg.java:322)
at org.jpos.iso.BaseChannel.receive(BaseChannel.java:531)
at org.jpos.iso.ISOServer$Session.run(ISOServer.java:123)
at
org.jpos.util.ThreadPool$PooledThread.run(ThreadPool.java:100)
Nested:java.lang.ArrayIndexOutOfBoundsException: 69
at
org.jpos.iso.AsciiInterpreter.uninterpret(AsciiInterpreter.java:88)
at
org.jpos.iso.ISOStringFieldPackager.unpack(ISOStringFieldPackager.jav
a:213)
at
org.jpos.iso.ISOBasePackager.unpack(ISOBasePackager.java:242)
at org.jpos.iso.ISOMsg.unpack(ISOMsg.java:322)
at org.jpos.iso.BaseChannel.receive(BaseChannel.java:531)
at org.jpos.iso.ISOServer$Session.run(ISOServer.java:123)
at
org.jpos.util.ThreadPool$PooledThread.run(ThreadPool.java:100)
</iso-exception>
<iso-exception>
org.jpos.iso.IFB_LLLCHAR: Problem unpacking field 62
<nested-exception>
java.lang.ArrayIndexOutOfBoundsException: 69
at
org.jpos.iso.AsciiInterpreter.uninterpret(AsciiInterpreter.java:88)
at
org.jpos.iso.ISOStringFieldPackager.unpack(ISOStringFieldPackager.jav
a:213)
at
org.jpos.iso.ISOBasePackager.unpack(ISOBasePackager.java:242)
at org.jpos.iso.ISOMsg.unpack(ISOMsg.java:322)
at org.jpos.iso.BaseChannel.receive(BaseChannel.java:531)
at org.jpos.iso.ISOServer$Session.run(ISOServer.java:123)
at
org.jpos.util.ThreadPool$PooledThread.run(ThreadPool.java:100)
</nested-exception>
org.jpos.iso.ISOException: org.jpos.iso.IFB_LLLCHAR: Problem
unpacking fie
ld 62 (java.lang.ArrayIndexOutOfBoundsException: 69)
at
org.jpos.iso.ISOStringFieldPackager.unpack(ISOStringFieldPackager.jav
a:218)
at
org.jpos.iso.ISOBasePackager.unpack(ISOBasePackager.java:242)
at org.jpos.iso.ISOMsg.unpack(ISOMsg.java:322)
at org.jpos.iso.BaseChannel.receive(BaseChannel.java:531)
at org.jpos.iso.ISOServer$Session.run(ISOServer.java:123)
at
org.jpos.util.ThreadPool$PooledThread.run(ThreadPool.java:100)
Nested:java.lang.ArrayIndexOutOfBoundsException: 69
at
org.jpos.iso.AsciiInterpreter.uninterpret(AsciiInterpreter.java:88)
at
org.jpos.iso.ISOStringFieldPackager.unpack(ISOStringFieldPackager.jav
a:213)
at
org.jpos.iso.ISOBasePackager.unpack(ISOBasePackager.java:242)
at org.jpos.iso.ISOMsg.unpack(ISOMsg.java:322)
at org.jpos.iso.BaseChannel.receive(BaseChannel.java:531)
at org.jpos.iso.ISOServer$Session.run(ISOServer.java:123)
at
org.jpos.util.ThreadPool$PooledThread.run(ThreadPool.java:100)
</iso-exception>
</unpack>
</log>
<log realm="iso-server.channel/172.20.80.230:2060" at="Sun Dec 17
17:13:06 EET 2
006.687">
<receive>
<iso-exception>
org.jpos.iso.IFB_LLLCHAR: Problem unpacking field 62
<nested-exception>
java.lang.ArrayIndexOutOfBoundsException: 69
at
org.jpos.iso.AsciiInterpreter.uninterpret(AsciiInterpreter.java:88)
at
org.jpos.iso.ISOStringFieldPackager.unpack(ISOStringFieldPackager.jav
a:213)
at
org.jpos.iso.ISOBasePackager.unpack(ISOBasePackager.java:242)
at org.jpos.iso.ISOMsg.unpack(ISOMsg.java:322)
at org.jpos.iso.BaseChannel.receive(BaseChannel.java:531)
at org.jpos.iso.ISOServer$Session.run(ISOServer.java:123)
at
org.jpos.util.ThreadPool$PooledThread.run(ThreadPool.java:100)
</nested-exception>
org.jpos.iso.ISOException: org.jpos.iso.IFB_LLLCHAR: Problem
unpacking fie
ld 62 (java.lang.ArrayIndexOutOfBoundsException: 69)
at
org.jpos.iso.ISOStringFieldPackager.unpack(ISOStringFieldPackager.jav
a:218)
at
org.jpos.iso.ISOBasePackager.unpack(ISOBasePackager.java:242)
at org.jpos.iso.ISOMsg.unpack(ISOMsg.java:322)
at org.jpos.iso.BaseChannel.receive(BaseChannel.java:531)
at org.jpos.iso.ISOServer$Session.run(ISOServer.java:123)
at
org.jpos.util.ThreadPool$PooledThread.run(ThreadPool.java:100)
Nested:java.lang.ArrayIndexOutOfBoundsException: 69
at
org.jpos.iso.AsciiInterpreter.uninterpret(AsciiInterpreter.java:88)
at
org.jpos.iso.ISOStringFieldPackager.unpack(ISOStringFieldPackager.jav
a:213)
at
org.jpos.iso.ISOBasePackager.unpack(ISOBasePackager.java:242)
at org.jpos.iso.ISOMsg.unpack(ISOMsg.java:322)
at org.jpos.iso.BaseChannel.receive(BaseChannel.java:531)
at org.jpos.iso.ISOServer$Session.run(ISOServer.java:123)
at
org.jpos.util.ThreadPool$PooledThread.run(ThreadPool.java:100)
</iso-exception>
--- header ---
0000 60 02 29 80 81 `.)..

--- data ---
0000 02 00 70 24 05 80 00 C0 80 04 19 66 66 66 66 6F
..p$.......ffffo
0010 00 00 00 00 00 00 00 66 66 00 03 28 66 66 00 12
.......ff..(ff..
0020 02 29 00 39 35 31 39 35 31 35 31 39 35 31 39 35
.).9519515195195
0030 31 39 35 31 39 35 31 39 35 31 34 30 30 00 06 35
1951951951400..5
0040 31 34 39 32 36 14926

</receive>
</log>
<log realm="iso-server.session/172.20.80.230" at="Sun Dec 17 17:13:06
EET 2006.6
87">
<session-error>
<iso-exception>
org.jpos.iso.IFB_LLLCHAR: Problem unpacking field 62
<nested-exception>
java.lang.ArrayIndexOutOfBoundsException: 69
at
org.jpos.iso.AsciiInterpreter.uninterpret(AsciiInterpreter.java:88)
at
org.jpos.iso.ISOStringFieldPackager.unpack(ISOStringFieldPackager.jav
a:213)
at
org.jpos.iso.ISOBasePackager.unpack(ISOBasePackager.java:242)
at org.jpos.iso.ISOMsg.unpack(ISOMsg.java:322)
at org.jpos.iso.BaseChannel.receive(BaseChannel.java:531)
at org.jpos.iso.ISOServer$Session.run(ISOServer.java:123)
at
org.jpos.util.ThreadPool$PooledThread.run(ThreadPool.java:100)
</nested-exception>
org.jpos.iso.ISOException: org.jpos.iso.IFB_LLLCHAR: Problem
unpacking fie
ld 62 (java.lang.ArrayIndexOutOfBoundsException: 69)
at
org.jpos.iso.ISOStringFieldPackager.unpack(ISOStringFieldPackager.jav
a:218)
at
org.jpos.iso.ISOBasePackager.unpack(ISOBasePackager.java:242)
at org.jpos.iso.ISOMsg.unpack(ISOMsg.java:322)
at org.jpos.iso.BaseChannel.receive(BaseChannel.java:531)
at org.jpos.iso.ISOServer$Session.run(ISOServer.java:123)
at
org.jpos.util.ThreadPool$PooledThread.run(ThreadPool.java:100)
Nested:java.lang.ArrayIndexOutOfBoundsException: 69
at
org.jpos.iso.AsciiInterpreter.uninterpret(AsciiInterpreter.java:88)
at
org.jpos.iso.ISOStringFieldPackager.unpack(ISOStringFieldPackager.jav
a:213)
at
org.jpos.iso.ISOBasePackager.unpack(ISOBasePackager.java:242)
at org.jpos.iso.ISOMsg.unpack(ISOMsg.java:322)
at org.jpos.iso.BaseChannel.receive(BaseChannel.java:531)
at org.jpos.iso.ISOServer$Session.run(ISOServer.java:123)
at
org.jpos.util.ThreadPool$PooledThread.run(ThreadPool.java:100)
</iso-exception>
</session-error>
</log>
<log realm="iso-server.channel/172.20.80.230:2060" at="Sun Dec 17
17:13:06 EET 2
006.703">
<disconnect>
null:0
</disconnect>
</log>
<log realm="iso-server.session/172.20.80.230" at="Sun Dec 17 17:13:06
EET 2006.7
03">
<session-end/>
</log>
<log realm="iso-server.session/172.20.80.230" at="Sun Dec 17 17:13:06
EET 2006.8
59">
<session-start/>
</log>

Amer

unread,
Dec 17, 2006, 9:26:24 AM12/17/06
to jPOS Users
by the way the Msg came to the my Server Application from the POS Device

Mark Salter

unread,
Dec 17, 2006, 10:31:26 AM12/17/06
to jpos-...@googlegroups.com
Amer wrote:
> sorry guys, iam NEW in the JPos stuff
> i didnt make my self clear, and thanx for the quick response
> iam new at my company and they gave me this Document:
> -----------------------------------------------------------------------------------------------------------------------------
> jPOS Programmer's Guide
[snip]

> is it the right Document ??
Yes, but a little old I would guess, ask them to treat you to the latest
version.

8)

>
> and the Exception that i faced is about Unpacking field number 62

> i wrote that cuz i want to just Send back to the POS Device Response
> Just that for now!

You should probably try to be parsing the request successfully before
you attempt to construct and send a response.

The problem is highlighted at field 62 because its definition uses three
bytes from the message for its length. The last field before 62 (49)
holds the value 514, the bytes following these characters in the message
have been taken as it length (3932) which is obviously wrong and send
you skidding off the end of the available bytes.

I would hazard a guess that field 62 is of length 0006 and has the value
of x'353134393236' or character '514926'. This means that one of your
earlier fields is too long, absorbing too many bytes.

The message looks to go wrong in field 42, so concentrate at the field
definitions before then. Note this is field contains the characters " ♠"
which looks out of place.

Compare the written specification against each of the fields parsed to
check that the values jPos has found make sense. Look for things like
card number, date and time fields etc. Check that the bitmap content
derived makes sense for an 0200 message.

Not a lot of the fields parsed seem to have 'good' values. The card
number field is often an early field in a message and although you have
a field that is 19 long, card numbers don't often contain hexadecimal
digits!

I have added some commentary to the your text below, just to illustrate
my derivation and thoughts...

... the comments make *big* assumptions about what might be found in the
fields present, these relate to other schemes messages and should be
read with a handful of sodium chloride.


> error unpacking field 62
> org.jpos.iso.ISOException: org.jpos.iso.IFB_LLLCHAR: Problem unpacking
> field 62
> (java.lang.ArrayIndexOutOfBoundsException: 69)

A funny length has been found sending JPos off the end of the available
bytes.


> org.jpos.iso.ISOBasePackager.unpack(ISOBasePackager.java:242)
> at org.jpos.iso.ISOMsg.unpack(ISOMsg.java:322)
> at org.jpos.iso.BaseChannel.receive(BaseChannel.java:531)
> at org.jpos.iso.ISOServer$Session.run(ISOServer.java:123)
> at

We are unpacking a message rather than packing for a send.

> 02007024058000C0800419666666666F00000000000000666600032866660012022900393531
> 39353135313935313935313935313935313935313430300006353134393236
> <bitmap>{2, 3, 4, 11, 14, 22, 24, 25, 41, 42, 49, 62}</bitmap>

reasonable fields in a non ICC message...

> <unpack fld="2" packager="org.jpos.iso.IFB_LLNUM">
> <value>666666666F000000000</value>
> </unpack>

A card number, seems unlikely, but could be test data?

> <unpack fld="3" packager="org.jpos.iso.IFB_NUMERIC">
> <value>000066</value>
> </unpack>
> <unpack fld="4" packager="org.jpos.iso.IFB_NUMERIC">
> <value>660003286666</value>

A big amount, things already out of alignment perhaps?

> </unpack>
> <unpack fld="11" packager="org.jpos.iso.IFB_NUMERIC">
> <value>001202</value>
> </unpack>
> <unpack fld="14" packager="org.jpos.iso.IFB_NUMERIC">
> <value>2900</value>
> </unpack>

Not a sensible expiry date, 1202 looks more likely.

> <unpack fld="22" packager="org.jpos.iso.IFB_NUMERIC">
> <value>935</value>
> </unpack>
> <unpack fld="24" packager="org.jpos.iso.IFB_NUMERIC">
> <value>139</value>
> </unpack>
> <unpack fld="25" packager="org.jpos.iso.IFB_NUMERIC">
> <value>35</value>
> </unpack>
> <unpack fld="41" packager="org.jpos.iso.IF_CHAR">
> <value>15195195</value>
> </unpack>
> <unpack fld="42" packager="org.jpos.iso.IF_CHAR">
> <value>1951951951400 ♠</value>
> </unpack>

This looks very wrong, in an ASCII message you might readily expect just
ASCII numbers which is pretty much what we had up to here.
We have been 'lucky' to get this far, good job there are not more
variable length fields! " ♠" is the binary value 0006, that looks like
a good length for the last field and means *if* 62 started here then the
message would end nicely as well.

Now where is the manual for this interface....?

8)

--
Mark

Amer

unread,
Dec 18, 2006, 2:19:42 AM12/18/06
to jPOS Users
thanx Guys very very much for ur very fast Response
thanx alot
u r the best ;) :D:D

JPractitioner

unread,
Dec 22, 2006, 3:13:15 AM12/22/06
to jPOS Users
jPOS rockS!

Reply all
Reply to author
Forward
0 new messages