连接到 jpos 频道时我的 ISO8583 打包程序出现问题

Having issues with my ISO8583 packager while connecting to jpos channel

打包我的数据并尝试发送到 JPOS 通道(服务器)时,我确实收到以下错误。

Length = 0030 Byte length(b): 48 :: Incoming data HEX(d): 3830300238000000C2820000303030303130303732323137313934363030303030363030303231383030303631373139 org.jpos.iso.IFA_LLNUM: Problem unpacking field 33 (java.lang.ArrayIndexOutOfBoundsException: 48) unpacking field=33, consumed=42 org.jpos.iso.ISOException: org.jpos.iso.IFA_LLNUM: Problem unpacking field 33 (java.lang.ArrayIndexOutOfBoundsException: 48) unpacking field=33, consumed=42 at org.jpos.iso.ISOBasePackager.unpack(ISOBasePackager.java:273) at org.jpos.iso.ISOMsg.unpack(ISOMsg.java:416) at org.jpos.iso.BaseChannel.unpack(BaseChannel.java:903) at org.jpos.iso.BaseChannel.receive(BaseChannel.java:671) at org.jpos.iso.ISOServer$Session.run(ISOServer.java:130) at org.jpos.util.ThreadPool$PooledThread.run(ThreadPool.java:71) --- data --- 0000 38 30 30 02 38 00 00 00 C2 82 00 00 30 30 30 30 800.8.......0000 0010 31 30 30 37 32 32 31 37 31 39 34 36 30 30 30 30 1007221719460000 0020 30 36 30 30 30 32 31 38 30 30 30 36 31 37 31 39 0600021800061719

org.jpos.iso.IFA_LLNUM: Problem unpacking field 33 (java.lang.ArrayIndexOutOfBoundsException: 48) unpacking field=33, consumed=42 org.jpos.iso.ISOException: org.jpos.iso.IFA_LLNUM: Problem unpacking field 33 (java.lang.ArrayIndexOutOfBoundsException: 48) unpacking field=33, consumed=42 at org.jpos.iso.ISOBasePackager.unpack(ISOBasePackager.java:273) at org.jpos.iso.ISOMsg.unpack(ISOMsg.java:416) at org.jpos.iso.BaseChannel.unpack(BaseChannel.java:903) at org.jpos.iso.BaseChannel.receive(BaseChannel.java:671) at org.jpos.iso.ISOServer$Session.run(ISOServer.java:130) at org.jpos.util.ThreadPool$PooledThread.run(ThreadPool.java:71)

而且,我正在使用下面的 java class 来传输我的打包数据。

public static String networkTransport(String isoMessage) throws UnknownHostException, IOException {
        Socket connection = new Socket("192.168.3.118", 1010);
        BufferedOutputStream bos = new BufferedOutputStream(connection.getOutputStream());

        OutputStreamWriter osw = new OutputStreamWriter(bos);
        int len = isoMessage.length(); // get the length of the data
        // SInce your packager name says Postilion, I think this will work.
        osw.write(len >> 8); // send the length bytes in 2 bytes. this is the byte 1
       // osw.write(len);// send the length bytes in 2 bytes. this is the byte 2

        osw.write(isoMessage);
        osw.flush();

        byte[] arrOutut = new byte[4096];
        int count = connection.getInputStream().read(arrOutut, 0, 4096);

        String clientRequest = "";
        for (int outputCount = 0; outputCount < count; outputCount++) {
            char response = (char) arrOutut[outputCount];
            clientRequest = clientRequest + response;
        }

        connection.close();

        return clientRequest;
    }

我目前面临的挑战是如何让我的 JPOS 渠道畅通无阻。 非常欢迎所有建议。

下面是我将如何拆分您的数据。

383030                          //echo message type as you said 0800. 
                                But where is the starting 0 (0x30) ? 
0238000000C28200                //bitmap 8 bytes -  packed BCD
00303030303130303732323137313934363030303030363030303231383030303631373139 - data

以下是您打开的位。您能否验证您是否拥有以下打开位的所有字段数据?我不明白你为什么在回显消息中需要 DE55。

0   0000
2   0010 7
3   0011 11, 12
8   1000 13
0   0000
0   0000
0   0000
0   0000
0   0000
0   0000
C   1100 41, 42
2   0011 47, 48
8   1000 49
2   0011 55, 56  
0   0000 
0   0000

根据假设,我会将您的数据拆分如下:

00 30 30 30 30 31 30 30 37 32   -   transmission date mmddhhmmss 
32 31 37 31 39                  -   trace number
34 36 30 30 30 30               -   local time
30 36 30 30                     -   local date
30 32 31 38 30 30 30 36         -   terminal id
31 37 31 39                     -   this is all the remaining data for bits 42, 47, 48, 49,
                                    55 and 56. 

所以得到一个空指针是很明显的。

我能够在使用 JPOS 库的同时解决这个问题,但不得不将其限制为仅使用我自己需要的东西。

如果您可能想在 android 设备上使用此方法,这些是我实际使用的文件夹

  1. 频道
  2. 过滤器
  3. 页眉
  4. 打包程序
  5. 验证器和整个javaclasshere

或者更好的是,使用所有文件和文件夹 here

在 jpos 服务器的打包数据中,您必须检查两个细节:

1) jpos 服务器通道类型(前导或尾随数据)

2) jpos 服务器打包程序

请注意,jpos 服务器不期望来自客户端的原始流数据。 在 jpos.org 网站上,您可以找到非常好的 jpos 手册。