Question

I use JPOS to send and receive ISO 8583 messages. Here is Client :

public static void main(String[] args) throws IOException, ISOException {
    System.setProperty("java.net.preferIPv4Stack", "true");
    EvnMsg msg = new EvnMsg();
    ISO93APackager packager = new ISO93APackager(); 
    msg.setPackager(packager);
    msg.setMTI("1804");
    msg.setAuditNumber("124125");
    ASCIIChannel channel  = new ASCIIChannel("Server_IP", PORT, packager);
    channel.connect();
    channel.send(msg);
    channel.receive();
    //channel.disconnect();
}

Here is Server :

public static void main(String[] args) throws IOException, ISOException {
    ISO93APackager packager = new ISO93APackager();
    ServerChannel channel = new ASCIIChannel (packager);
    channel.accept(new ServerSocket(PORT));
    ISOMsg isoMsg = channel.receive();

    System.out.println("Received");
}

Server is received message, but the problem is that the bitmap has value of -1

enter image description here

So did i made a mistake? Which is the right way to receive the message?

Was it helpful?

Solution

That's an internal representation used by jPOS, feel free to ignore that fact; the bitmap will be properly produced once the channel calls the ISOMsg's pack() method.

A few comments:

  • EnvMsg is not part of jPOS, I'm assuming you're extending ISOMsg
  • You don't have to call msg.setPackager, the channel will take care of that on your behalf
  • You're reinventing the wheel in your server by not using the QServer class
  • You're reinventing the wheel in your client code by not using the ChannelAdaptor class
  • You'll probably need a multiplexer, consider using QMUX
  • I suggest you take a look at the Q2 application to run all this.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top