--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/b96cdbd6-eb9a-4864-a415-d2eb8ee99599%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/CALK1SyzVRY4BAUdy%2B1yx0EP7ktDk69F6j23dDPeAbK017_rFBg%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/CAL8bJ0GJQ7oDQ7-kUE7gsygomk1Moh9qAUFxA50v2nht-zoEtg%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/CALK1SywEpxh1QPy83n4azgLcMRdHKPDKTjtEEtdJNvMfaAXt%2Bw%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/CAAgSK%3D%3D%2Bq3Py2wP99hqw%2BBV6Gw0SamFkwzkPc6HEFc%2B%2B5vXjrg%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/CAL8bJ0HOiVL3FH8sZMG7xM9LrKpo%2BxW5CYCteXjG%3DW-arDFpkQ%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/CAL8bJ0HOiVL3FH8sZMG7xM9LrKpo%2BxW5CYCteXjG%3DW-arDFpkQ%40mail.gmail.com.
Thanks Alejandro for the insightBut i opted for a different approachI tried PADchannel and indeed it can read all the isomessages in the socket, but not the way i expected. Because the primary bitmap is binary-written (010001010000...) And the padchannel expect it to be hexa.
--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/CAAgSK%3Dnjr2A7wjiHeNbjeZ9gzy3fsCyz-hYQGOhrfPYFvT1ALQ%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/CAL8bJ0HiRzFePw-1vD84WF7e_MuYDKEiOorST2c%2BzjDFLedQ6g%40mail.gmail.com.
Hi:
Check this out:
import org.jpos.core.ConfigurationException;
import org.jpos.core.SimpleConfiguration;
import org.jpos.iso.BaseChannel;
import org.jpos.iso.ISOException;
import org.jpos.iso.ISOMsg;
import org.jpos.iso.ISOPackager;
import org.jpos.iso.ISOServer;
import org.jpos.iso.packager.ISO87APackager;
import org.jpos.util.LogEvent;
import org.jpos.util.Logger;
import java.io.EOFException;
import java.io.IOException;
import java.io.InterruptedIOException;
public class VVDemo
{
private ISOServer server;
private Thread t;
private static final int port = 10000;
public static void main(String[] args) throws Exception
{
VVDemo vv = new VVDemo();
vv.startServer();
vv.process();
}
private void process() throws ISOException, IOException, InterruptedException
{
ISO87APackager packager = new ISO87APackager();
MyChannel channel = new MyChannel("localhost", port, packager);
channel.connect();
String s = "ISO1111111110800822000000000000000000000000000001215150308000005001" +
"ISO1111111110800822000000000000000000000000000001215150308000006001" +
"ISO1111111110800822000000000000000000000000000001215150308000007001";
channel.send(s.getBytes());
ISOMsg r;
r = channel.receive(); // Receive 1st response
r.dump(System.out, "--> RSP: ");
r = channel.receive(); // Receive 2nd response
r.dump(System.out, "--> RSP: ");
r = channel.receive(); // Receive 3rd response
r.dump(System.out, "--> RSP: ");
server.shutdown();
t.join();
}
/**
* Creates simple server that produces a fixed response.
*
* @throws IOException
* @throws ConfigurationException
*/
private void startServer() throws IOException, ConfigurationException
{
ISO87APackager packager = new ISO87APackager();
MyChannel channel = new MyChannel(packager);
server = new ISOServer(port, channel, null);
server.setConfiguration(new SimpleConfiguration());
server.addISORequestListener(
(source, m) ->
{
try
{
ISOMsg r = (ISOMsg) m.clone();
r.setResponseMTI();
r.set(39, "00");
source.send(r);
return true;
}
catch (Exception e)
{
e.printStackTrace();
return false;
}
});
t = new Thread(server);
t.start();
}
/**
* Custom channel with a 12 byte header and 3 byte trailer which streams input.
*/
public static class MyChannel extends BaseChannel
{
public MyChannel(String host, int port, ISOPackager p)
{
super(host, port, p);
}
public MyChannel(ISOPackager p) throws IOException
{
super(p);
}
@Override
protected int getHeaderLength()
{
return 12;
}
/**
* Completely lifted from PADChannel. Just adds "trailer" support
* @return
* @throws IOException
* @throws ISOException
*/
@Override
public ISOMsg receive() throws IOException, ISOException
{
byte[] header = null;
ISOMsg m = new ISOMsg();
m.setPackager(packager);
m.setSource(this);
int hLen = getHeaderLength();
LogEvent evt = new LogEvent(this, "receive");
try
{
synchronized (serverInLock)
{
if (hLen > 0)
{
header = new byte[hLen];
serverIn.readFully(header);
}
m.unpack(serverIn);
getMessageTrailer(m);
}
m.setHeader(header);
m.setDirection(ISOMsg.INCOMING);
m = applyIncomingFilters(m, evt);
m.setDirection(ISOMsg.INCOMING);
evt.addMessage(m);
cnt[RX]++;
setChanged();
notifyObservers(m);
}
catch (ISOException e)
{
evt.addMessage(e);
throw e;
}
catch (EOFException e)
{
evt.addMessage("<peer-disconnect/>");
throw e;
}
catch (InterruptedIOException e)
{
evt.addMessage("<io-timeout/>");
throw e;
}
catch (IOException e)
{
if (usable)
{
evt.addMessage(e);
}
throw e;
}
catch (Exception e)
{
evt.addMessage(e);
throw new ISOException("unexpected exception", e);
}
finally
{
Logger.log(evt);
}
Logger.log(evt);
return m;
}
@Override
protected void getMessageTrailer(ISOMsg m) throws IOException
{
byte[] bytes = new byte[3];
serverIn.read(bytes);
}
@Override
protected void sendMessageTrailer(ISOMsg m, byte[] b) throws IOException
{
serverOut.write("001".getBytes());
}
}
}
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/CAL8bJ0HiRzFePw-1vD84WF7e_MuYDKEiOorST2c%2BzjDFLedQ6g%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/CALK1SyxJ%2BKxZmKvDqtmoid9Fbxfkq-BVcLaYR5VAsyrRsxJwrA%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/CAL8bJ0EG9zV4S9xZhfj8xrtk3-dZYjJ0XLyEvt2tt5jqqG9OeQ%40mail.gmail.com.
I'm really not sure why you would need your own channel, you can use PADChannel, and why you would need your own bitmap packager, you just need to use IFB_BITMAP, I don't think you need to write a single line of code, just use proper XML config.
--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/CAAgSK%3Dki6MHnzmUct%3DQmMLf7P3403t6tHE8jC5T736fm0np%3D1g%40mail.gmail.com.
I'm really not sure why you would need your own channel, you can use PADChannel, and why you would need your own bitmap packager, you just need to use IFB_BITMAP, I don't think you need to write a single line of code, just use proper XML config.
--
--
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 view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/CAAgSK%3Dki6MHnzmUct%3DQmMLf7P3403t6tHE8jC5T736fm0np%3D1g%40mail.gmail.com.
Hi AlejandroHe can't use PADChannel since has a 3 byte trailer (ASCII) as part of the message.
Sent from my iPhone
I'm really not sure why you would need your own channel, you can use PADChannel, and why you would need your own bitmap packager, you just need to use IFB_BITMAP, I don't think you need to write a single line of code, just use proper XML config.--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/CAAgSK%3Dki6MHnzmUct%3DQmMLf7P3403t6tHE8jC5T736fm0np%3D1g%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: 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 view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/546EC03F-6900-4FBB-8DD3-C45B5D847A85%40gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/CAL8bJ0GWbqBwms-TAtvNDemXh0_9Gusz%3DsbY1_FwW7cceAEkrA%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/CALK1SyyRzb_VpUUCTP1p7EtNzsmGyLHuRsNGT-cH2CJPjRqBHA%40mail.gmail.com.
To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/CAL8bJ0E_Xv44HA2006gqTUHbNW4yZOded4RiZr9D%3DL3P%2B%2BATcQ%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/CAAgSK%3Dkk0bZdQSqHS5gDLMRs7c0ru6m7oV%2BcuUV8XrttwZaJag%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/CAL8bJ0GeWEMH2iTt5BFOjJKg0qbj9%2BN1ObALr-eynsRr3mnWdA%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/CAL8bJ0GeWEMH2iTt5BFOjJKg0qbj9%2BN1ObALr-eynsRr3mnWdA%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/CAAgSK%3Dk0TuS6UH9pTO7vOUoXdYD7WcfzogHZn%3DYod5NgvR_Tbg%40mail.gmail.com.