Problem with receiving/sending the ISOMsg

88 views
Skip to first unread message

taha yassine benbrahim

unread,
Mar 23, 2017, 12:39:23 PM3/23/17
to jPOS Users
Hi everybody,
I am new in jpos, and I have a problem with receiving messages in client and server side this is my implementation 
-------------Client Side ------------------------------------------------------
public class SendISOMsg8583 extends Thread {

public void run() {
Properties prop = new Properties();
try {
FileInputStream in = new FileInputStream("conf.properties");
prop.load(in);
in.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
String uriPackager = prop.getProperty("uriPackager");
String ipAdress = prop.getProperty("ipAdress");
String portSendNumber = prop.getProperty("portSendNumber");
Logger logger = new Logger();
logger.addListener(new SimpleLogListener(System.out));
ISOPackager p;
ISOChannel channel;
try {
p = new GenericPackager(uriPackager);
channel = new HEXChannel(ipAdress, Integer.parseInt(portSendNumber), p, null);
((LogSource) channel).setLogger(logger, "test channel");
channel.connect();
ISOMsg isoMsg = new ISOMsg();
isoMsg.setMTI("0200");
isoMsg.set(3, "201234");
isoMsg.set(4, "10000");
isoMsg.set(7, "110722180");
isoMsg.set(11, "123456");
isoMsg.set(44, "A5DFGR");
isoMsg.set(105, "ABCDEFGHIJ 1234567890");
channel.send(isoMsg);
ISOMsg msg = channel.receive();// How can I parse this message 
channel.disconnect();
} catch (ISOException | IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
------------------- Server Side ----------------------------------------------------------

public class ReceiveISOMsg8583 extends Thread implements ISORequestListener {

public ReceiveISOMsg8583() {
super();
// TODO Auto-generated constructor stub
}

@Override
public boolean process(ISOSource source, ISOMsg msg) {
// TODO Auto-generated method stub
System.out.println("----ISO MESSAGE-----");
try {
System.out.println("  MTI : " + msg.getMTI());
for (int i = 1; i <= msg.getMaxField(); i++) {
if (msg.hasField(i)) {
System.out.println("    Field-" + i + " : " + msg.getString(i));
}
}
} catch (ISOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
return true;
}

public void run() {
Properties prop = new Properties();
try {
FileInputStream in = new FileInputStream("conf.properties");
prop.load(in);
in.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
String uriPackager = prop.getProperty("uriPackager");
String portReceiveNumber = prop.getProperty("portReceiveNumber");
Logger logger = new Logger();
logger.addListener(new SimpleLogListener(System.out));
ISOPackager p;
ServerChannel channel;
ISOServer server;
try {
p = new GenericPackager(uriPackager);
channel = new HEXChannel(p, null);
((LogSource) channel).setLogger(logger, "channel");
server = new ISOServer(Integer.parseInt(portReceiveNumber), channel, null);
server.setLogger(logger, "server");
server.addISORequestListener(new ReceiveISOMsg8583());
new Thread(server).start();
} catch (ISOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

}
}
/// How can i make the server send messages 

chhil

unread,
Mar 23, 2017, 9:37:36 PM3/23/17
to jpos-...@googlegroups.com

There is a huge thread in the list on how to initiate  a request  message from a server.

In short, you need to define in out queues and define a mux that uses them to send messages.

-chhil


--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage. Please support jPOS, contact: sa...@jpos.org
---
You received this message because you are subscribed to the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+...@googlegroups.com.
To post to this group, send email to jpos-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/79cd2731-49a4-45e4-9346-49858f8efb0f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Luiz Felipph

unread,
Mar 24, 2017, 9:07:14 AM3/24/17
to jpos-...@googlegroups.com
Search for SAF Jpos on Google . Follow a didihaki tutorial.

Felipph
@mobile

Em 23/03/2017 22:37, "chhil" <chi...@gmail.com> escreveu:

There is a huge thread in the list on how to initiate  a request  message from a server.

In short, you need to define in out queues and define a mux that uses them to send messages.

-chhil


To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+unsubscribe@googlegroups.com.

To post to this group, send email to jpos-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/79cd2731-49a4-45e4-9346-49858f8efb0f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage. Please support jPOS, contact: sa...@jpos.org
---
You received this message because you are subscribed to the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+unsubscribe@googlegroups.com.

To post to this group, send email to jpos-...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages