[jpos-users] Problem with receiving/sending the ISOMsg

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[jpos-users] Problem with receiving/sending the ISOMsg

taha yassine benbrahim
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 

--
--
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: [hidden email]
---
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 [hidden email].
To post to this group, send email to [hidden email].
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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [jpos-users] Problem with receiving/sending the ISOMsg

chhil

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


On Thu, Mar 23, 2017, 10:09 PM taha yassine benbrahim <[hidden email]> wrote:
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 

--
--
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: [hidden email]
---
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 [hidden email].
To post to this group, send email to [hidden email].
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: [hidden email]
---
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/CAPazefC7hHwB8UV4MFog_cTiQ%2B19cv-RK74LPydbgSfHCZZxog%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [jpos-users] Problem with receiving/sending the ISOMsg

Luiz Felipph Calado
Search for SAF Jpos on Google . Follow a didihaki tutorial.

Felipph
@mobile

Em 23/03/2017 22:37, "chhil" <[hidden email]> 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


On Thu, Mar 23, 2017, 10:09 PM taha yassine benbrahim <[hidden email]> wrote:
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 <a href="tel:(12)%203456-7890" value="+551234567890" target="_blank">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 

--
--
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: [hidden email]
---
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 [hidden email].
To post to this group, send email to [hidden email].
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: [hidden email]
---
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/CAPazefC7hHwB8UV4MFog_cTiQ%2B19cv-RK74LPydbgSfHCZZxog%40mail.gmail.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: [hidden email]
---
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/CABCV0cxmx-pfaiOTKvmdmpkymCdj7-ra1G3XzXtCSKWsAeNgfQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Loading...