简体   繁体   中英

Post iso8583 in java

How to collect and send a message in iso 8583 format, in java? Something like this:

30 38 30 30 82 20 00 00 00 00 00 00 04 00 00 00 00 00 00 00 00 11 13 12 53 20 12 34 56 03 01

I tried to build using the library https://github.com/imohsenb/ISO8583-Message-Client-java . Collects incorrectly.

30 38 30 30 82 20 08 00 22 20 00 00 00 00 00 00 00 00 00 00 11 13 12 53 20 12 34 56 03 01

Code:

public class ClientSocket {
    public static void main(String[] args) throws ISOException, ISOClientException, IOException {
        ISOMessage isoMessage = ISOMessageBuilder.Packer(VERSION.V1987)
                .networkManagement()
                .mti(MESSAGE_FUNCTION.Request, MESSAGE_ORIGIN.Acquirer)
                .processCode("0000000")
                .setField(FIELDS.F7_TransmissionDataTime,  "1113125320")
                .setField(FIELDS.F11_STAN,  "1234560301")
                .setHeader("303830308220")
                .build();

        ISOClient client = ISOClientBuilder.createSocket("172.20.104.69", 5803)
                .build();
        System.out.println("isoMessage " + isoMessage);

        client.connect();
        String response = Arrays.toString(client.sendMessageSync(isoMessage));
        System.out.println("response = " + response);
        client.disconnect();
    }
}

Parsing the message you got from the code:

30 38 30 30 82 20 - message header you have set (it contains the string 0800 that looks like MTI - is this what you had in mind?)

08 00 - actual MTI for network management

22 20 00 00 00 00 00 00 - bitmap indicating that field 3,7,11 are present

00 00 00 - processing code (field 3)

00 - additional 00 byte stuffed after processing code (probably due to the fact you set processing code to odd number of characters and the library and it was not truncated as it should be)

11 13 12 53 20 - date/time (field 7)

12 34 56 - STAN (field 11)

03 01 - characters you set as STAN, but they will not be treated as such, because stan is 6 digits according to ISO specs

It's quite hard to understand what you were trying to achieve looking at the target message.

I would assume that what you are trying to achieve is actually a different message - it starts with MTI in ASCII, contains second bitmap, indicates that fields 7,11 and 70 are present.

Field 7 would then be: 11 13 12 53 20

Field 11 would be: 12 34 56

Field 70 would be: 03 01

Is this what you were looking for?

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