简体   繁体   中英

How to Pack ISO message to acquiring host

I am trying to pack ISO 8583 message using J8583:

        IsoMessage m = mf.newMessage(0x200); // You must use 0x200, 0x400, etc.
        m.setValue(3, "000000", IsoType.ALPHA, 6);
        m.setValue(11, "000001", IsoType.ALPHA, 6);
        m.setValue(41, "3239313130303031", IsoType.ALPHA, 16);
        m.setValue(60, "001054455354204D45535347", IsoType.ALPHA, 24);
        m.setValue(70, "0301", IsoType.ALPHA, 4);

        System.out.println(m.debugString());

How should I get the ISO message before sending to the acquiring host?

There are three ways:

  • Call writeData to get the message encoded as a byte array. It will be your responsibility to write this to a socket, with length headers, terminator, etc
  • Call writeToBuffer if you're using java.nio, to get a ByteBuffer. You can pass the size of the length header (2 or 4 bytes usually), or 0 to omit the length header. The resulting ByteBuffer includes the message terminator, if set.
  • Call write , to write the message directly to an OutputStream. You can specify the size of the length header and it will also write the terminator (if set), and flush the stream afterwards.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM