How to use JPOS with Postilion

1,275 views
Skip to first unread message

ola

unread,
Mar 2, 2009, 6:57:35 AM3/2/09
to jPOS Users
Hello,

Last week, I used C implementation of JPOS to communicate with
Postilion Server, but the did not work. Now I have decided to use JPOS
implementation itself -- using Postchannel & Postpackager (as I
discovered sometimes ago). I have JPOS- 1.5.0 downloaded before and I
also bought the guide on it 2 years ago. Please, I need to start work
fast on communicating my messages via JPOS (as a gateway) to Postilion
Server, especially implementing first the leg that communicates with
the Postilion (as a client). Please HOW DO I START OR GO ABOUT THIS?

I need your quick assistance and aid please....
Thanks,

Ola.

David Bergert

unread,
Mar 2, 2009, 8:09:22 AM3/2/09
to jpos-...@googlegroups.com
> Last week, I used C implementation of JPOS to communicate with
> Postilion Server, but the did not work. Now I have decided to use JPOS
> implementation itself

Migrating between C and JAVA - probably won't solve the issue you have been
having...

Some thoughts:

1) Acquire the Host Message Format Specs and Specs that describe the
communication and connection e.g: 2||4 byte length header, other header(s),
length in network or host byte order, etc. and Read Them.
2) Request Sample Dumps of same messages as well as network traces that show
the communication bytes of the message. And manually parse them and map them
back to the spec.
3) Develop and test your code to the specs and sample messages dumps using
jPOS
4) Use tools such as netcat "nc -l -p 10000 > dump.out (to build a quick
server) - and wireshark as well as your application logs to confirm that you
are sending what you think you are, and can provide detailed information to
someone on the 'other' end of the switch to help troubleshoot integration.
5) Develop a good or rather great working relationships with someone on the
'other' end of the switch, that can help assist with message format
questions, perform traces, and check what you are sending to what they
expect.
6) review the samples that come with jpos (Client simulator) as well as
review the mailing list archive of this list.
7) Understand that members of the list are not 'paid' to help you solve your
problem, especially in an expedited manner, and they have issues and
projects that need to be completed yesterday as well.

#5 sounds key in your quandary here.

Cheers,

David Bergert, CISSP, CISA, CPISM/A
www.paymentsystemsblog.com

ola

unread,
Mar 2, 2009, 8:25:24 AM3/2/09
to jPOS Users
Thanks David. However, I have much knowledge of the Hsot message
format spec (I have spec with me) and the Postilion spec expects 2
bytes header, which i calculated and padded to message before in C.
And for the communication, the Postilion Source Node was setup as a
server to listen for communication via TCP/IP. In addition, the
message format expected can be Hex Bytes or Ascii Bytes, and my
message was formated in Ascii Bytes after configured the source node
to expect the message in that format.I have dump ftrom the host
server, and I have used SourceSim.exe simulator on the Host postilion
to generate a dump that i have manually formated with my C
application. But still it did not work (To answer point number 1 & 2).

So, please, with these points you highlighted:

3) Develop and test your code to the specs and sample messages dumps
using jPOS: HOW WILL I START?

> 4) Use tools such as netcat "nc -l -p 10000 > dump.out (to build a quick
> server) - and wireshark as well as your application logs to confirm that you
> are sending what you think you are

WHERE DO I SEE THE TOOL?

6. > 6) review the samples that come with jpos (Client simulator) as
well as
> review the mailing list archive of this list.

WHERE CAN I FIND THE ACTUAL CLIENT SIMULATOR ?

Thanks!
> > Ola.- Hide quoted text -
>
> - Show quoted text -

chhil

unread,
Mar 2, 2009, 9:00:57 AM3/2/09
to jpos-...@googlegroups.com
One thing to bear in mind...SourceSim talks directly to Postilion transaction manager and uses an internal Postilion ISO8583 message. The dumps that you get from there does will not necessarity match up with what you need to send to Postbridge.

-chhil

ola

unread,
Mar 2, 2009, 10:50:19 AM3/2/09
to jPOS Users
Fine Chhil. But please, how can I implement Postpackager to talk to
Postbridge?
> > > - Show quoted text -- Hide quoted text -

David Bergert

unread,
Mar 2, 2009, 11:20:24 AM3/2/09
to jpos-...@googlegroups.com
From the jPOS Guide and this list: you should be able to put something
simple like this to start:

public static void main(String[] args) {

try {
//Build something that looks like an ISOMsg
ISOMsg req = new ISOMsg();
req.setMTI("100");
req.set("2", "4111111111111111");
req.set("3", "000000");
req.set("4", "100");
req.set("11", "123456");
req.set("41", "12345601");
req.set("42", "12345601010101");

Logger logger = new Logger();
logger.addListener (new SimpleLogListener (System.out));
ISOPackager p = new GenericPackager ("cfg/postpack.xml");
p.setLogger (logger, "test");

/* Note this does not use the recommend MUX approach */

ClientChannel channel = new PostChannel(p,null);
((LogSource)channel).setLogger (logger, "channel");
channel.setHost("127.0.0.1", 10000);
channel.connect();
channel.send(req);

//We are only sending to netcat to dump the request.

} catch (Exception e) {
e.printStackTrace();
}
}


init:
deps-jar:
compile:
run:
<log realm="channel/127.0.0.1:10000" at="Mon Mar 02 10:09:11 CST 2009.352">
<connect>
127.0.0.1:10000
</connect>
</log>
<log realm="test" at="Mon Mar 02 10:09:11 CST 2009.369">
<pack>
303130307020000000C000003136343131313131313131313131313131313030303030303030
3030303030303031303031323334353631323334353630313132333435363031303130313031
20
</pack>
</log>
<log realm="channel/127.0.0.1:10000" at="Mon Mar 02 10:09:11 CST 2009.370">
<send>
<isomsg direction="outgoing">
<field id="0" value="100"/>
<field id="2" value="4111111111111111"/>
<field id="3" value="000000"/>
<field id="4" value="100"/>
<field id="11" value="123456"/>
<field id="41" value="12345601"/>
<field id="42" value="12345601010101"/>
</isomsg>
</send>
</log>
BUILD SUCCESSFUL (total time: 7 seconds)


$nc -l -p 10000 > out.txt

$hd out.txt
00000000 00 4d 30 31 30 30 70 20 00 00 00 c0 00 00 31 36 |.M0100p
......16|
00000010 34 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31
|4111111111111111|
00000020 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 31
|0000000000000001|
00000030 30 30 31 32 33 34 35 36 31 32 33 34 35 36 30 31
|0012345612345601|
00000040 31 32 33 34 35 36 30 31 30 31 30 31 30 31 20 |12345601010101
|
0000004f

Regards,

David Bergert, CISSP, CISA, CPISM/A
www.paymentsystemsblog.com


ola

unread,
Mar 3, 2009, 2:58:26 AM3/3/09
to jPOS Users
Thanks! But please what is netcat?
> 303130307020000000C00000313634313131313131313131313131313131303030303030303­0
> 303030303030303130303132333435363132333435363031313233343536303130313031303­1
> > > - Show quoted text -- Hide quoted text -

Mark Salter

unread,
Mar 3, 2009, 4:16:35 AM3/3/09
to jpos-...@googlegroups.com
ola wrote:
> Thanks! But please what is netcat?

http://www.google.co.uk/search?hl=en&q=netcat+windows&btnG=Google+Search&meta=

Results 1 - 10 of about 818,000 for netcat windows. (0.25 seconds)

(I added windows to the search as you appear to be using that operating
system.)

It is a tool for all sorts of networking 'jobs'. It is (I believe)
'native' to a unix based operating system, but there are versions for
windows too.

The functionality it provides may cause it to appear as a hacking tool
on virus scanners or rootkit monitoring tools; not a problem as such,
just something for you to be aware of.

--
Mark

chhil

unread,
Mar 3, 2009, 4:21:17 AM3/3/09
to jpos-...@googlegroups.com
Ya.. I have been after IT guys to put it in a white list...to no avail:(.

Mark Salter

unread,
Mar 3, 2009, 4:23:18 AM3/3/09
to jpos-...@googlegroups.com
ola wrote:
> Fine Chhil. But please, how can I implement Postpackager to talk to
> Postbridge?

You have told us that you have the interface specification, have you
confirmed that the PostPackager matches that spec yet?

David gives a good 'blow by blow' account of the steps you need to cover
in his reply, which you have read?


David has also given some sample code that uses the jPOS GenericPackager
xml (cfg/postpack.xml) instead of the PostPackager class; but this
approach should get you going?

--
Mark

Mark Salter

unread,
Mar 3, 2009, 4:28:51 AM3/3/09
to jpos-...@googlegroups.com
chhil wrote:
> Ya.. I have been after IT guys to put it in a white list...to no avail:(.

I guess the problem is that placing it on a 'building wide' whitelist
would help hide inappropriate occurrences. 8)

On the couple of occasions I have used it in my place of work, my
friendly unix admin/user provided me with a stepping stone and the
output he captured for me.

--
Mark

ola

unread,
Mar 3, 2009, 6:21:07 AM3/3/09
to jPOS Users
Thanks. Please which library do i need to import to use
"ClientChannel". My porgram was giving Symbol Cannot found "
ClientChannel " while compiling....

ola

unread,
Mar 3, 2009, 6:35:49 AM3/3/09
to jPOS Users
Hello,

Please i can compile it successfully now. But when i run it, it gives
this error:

org.jpos.iso.ISOException: unconnected ISOChannel
at org.jpos.iso.BaseChannel.send(BaseChannel.java:432)
at samples.TestConnect.main(TestConnect.java:72)

Any Help?
> > Mark- Hide quoted text -

Mark Salter

unread,
Mar 3, 2009, 6:46:43 AM3/3/09
to jpos-...@googlegroups.com
ola wrote:
> Thanks. Please which library do i need to import to use
> "ClientChannel". My porgram was giving Symbol Cannot found "
> ClientChannel " while compiling....

org.jpos.iso.*

Are you not using an IDE to do this, have you acquired a jpos jar file
and told the IDE about it?


--
Mark

Mark Salter

unread,
Mar 3, 2009, 6:49:16 AM3/3/09
to jpos-...@googlegroups.com
ola wrote:
> Hello,
>
> Please i can compile it successfully now. But when i run it, it gives
> this error:
>
> org.jpos.iso.ISOException: unconnected ISOChannel
> at org.jpos.iso.BaseChannel.send(BaseChannel.java:432)
> at samples.TestConnect.main(TestConnect.java:72)

Have you got the server running, is it accepting connections?

Can you show your code? Are you using David's example?

I wonder if you are using a MUX or a channel 'directly' are you calling
channel.connect() before attempting to send a message?

--
Mark

ola

unread,
Mar 3, 2009, 6:54:34 AM3/3/09
to jPOS Users
Thanks for the reply!

It works! I used David's example, and I can see the dump of the packed
message at Postilion side. I really appreciate you guys.

However, a new challenge! Immediately the message gets to postilion,
my application disconnects, so it does not wait to receive response.
Please, how would i perform the following (though I read the guide,
but I need your further guidance please):

- To bind the connection so that I can prevent disconnection
- To use MUX ( i used channel directly as David specified)
- to receive the message (i mean channel.recieve(IsoMsg m))

Thanks once again, as I expect your reply!

Ola.

Mark Salter

unread,
Mar 3, 2009, 7:14:03 AM3/3/09
to jpos-...@googlegroups.com
ola wrote:
> Thanks for the reply!
>
> It works!
You sound surprised?

8)

> I used David's example, and I can see the dump of the packed
> message at Postilion side. I really appreciate you guys.

David's example does not include a channel.receive, it was really only
addressing a means of you to see what messages you were producing
(through using nc).

>
> However, a new challenge! Immediately the message gets to postilion,
> my application disconnects, so it does not wait to receive response.
> Please, how would i perform the following (though I read the guide,
> but I need your further guidance please):
>
> - To bind the connection so that I can prevent disconnection
> - To use MUX ( i used channel directly as David specified)
> - to receive the message (i mean channel.recieve(IsoMsg m))

Take a look at the examples in the guide (again); search this list for
answers to these points.

Your overall solution may start to take shape here, perhaps using
jpos-ee and it's xml component deployment approach?

I don't think we know what you are ultimately wanting to do yet?

Don't forget about licences you may need to satisfy.

--
Mark

ola

unread,
Mar 3, 2009, 7:30:01 AM3/3/09
to jPOS Users
Thank you Mark. Really, what I am about developing with JPOS is a
GATEWAY between my POS terminal application and POSTILION server at
the bank. The gateway will accept parameters like PAN and PIN from POS
terminal, pass it to the JPOS gateway (i am trying to develop) and the
gateway further pack and forward it to postilion, receive response,
unpack it and return response code back to the POS terminal. This
means, my gateway will act as server to the terminal as well as client
to postilion. In addition, I need to satisfy all the standards and
practices like PIN Block, using 3DES, Key Exchange, handling reversal,
etc....

Please, kindly guide me through the best JPOS components that can
serve these purposes....

Thanks once again. You guys really made my day!!!!

Mark Salter

unread,
Mar 3, 2009, 8:22:11 AM3/3/09
to jpos-...@googlegroups.com
ola wrote:
> Thank you Mark. Really, what I am about developing with JPOS is a
> GATEWAY between my POS terminal application and POSTILION server at
> the bank. The gateway will accept parameters like PAN and PIN from POS
> terminal, pass it to the JPOS gateway (i am trying to develop) and the
> gateway further pack and forward it to postilion, receive response,
> unpack it and return response code back to the POS terminal. This
> means, my gateway will act as server to the terminal as well as client
> to postilion. In addition, I need to satisfy all the standards and
> practices like PIN Block, using 3DES, Key Exchange, handling reversal,
> etc....
>
> Please, kindly guide me through the best JPOS components that can
> serve these purposes....

Each approach and component have their own benefits, I'm afraid you need
to decide the best approach for you and your budget/time-scale.

I would suggest you take a look at jpos-ee (via jpos.org); membership to
PEP might also suit you - it is too hard for me to tell though 8).

Do you know (yet) what form the messages from the POS terminals will
take? Do you have an HSM already in mind? Lot's for you to think about
and perhaps also discover.

Good luck.

--
Mark

Reply all
Reply to author
Forward
0 new messages