简体   繁体   English

在 java 中发布 iso8583

[英]Post iso8583 in java

How to collect and send a message in iso 8583 format, in java?如何在 java 中收集和发送 iso 8583 格式的消息? 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 .我尝试使用库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?) 30 38 30 30 82 20 - 您设置的消息 header(它包含看起来像 MTI 的字符串 0800 - 这是您的想法吗?)

08 00 - actual MTI for network management 08 00 - 网络管理的实际 MTI

22 20 00 00 00 00 00 00 - bitmap indicating that field 3,7,11 are present 22 20 00 00 00 00 00 00 - bitmap 表示存在字段 3,7,11

00 00 00 - processing code (field 3) 00 00 00 - 处理代码(字段 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) 00 - 处理代码后填充额外的 00 字节(可能是由于您将处理代码设置为奇数个字符和库,并且它没有按应有的方式截断)

11 13 12 53 20 - date/time (field 7) 11 13 12 53 20 - 日期/时间(字段 7)

12 34 56 - STAN (field 11) 12 34 56 - 斯坦(第 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 03 01 - 您设置为 STAN 的字符,但它们不会被视为这样,因为根据 ISO 规范, stan 是 6 位数字

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.我假设您要实现的实际上是一条不同的消息-它以 ASCII 中的 MTI 开头,包含第二个 bitmap,表示存在字段 7,11 和 70。

Field 7 would then be: 11 13 12 53 20字段 7 将是:11 13 12 53 20

Field 11 would be: 12 34 56字段 11 为:12 34 56

Field 70 would be: 03 01字段 70 将是:03 01

Is this what you were looking for?这是你要找的吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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