Java 连接到jpos频道时遇到我的ISO8583打包机问题

Java 连接到jpos频道时遇到我的ISO8583打包机问题,java,android,iso,emv,iso8583,Java,Android,Iso,Emv,Iso8583,打包数据后,在尝试发送到JPOS通道(服务器)时,我确实收到以下错误 长度=0030字节长度(b):48::传入数据十六进制(d): 38303002380000000C28200003030301303037323231373139343630303030303630303231383030303631373139 org.jpos.iso.IFA_LLNUM:解包问题字段33(java.lang.ArrayIndexOutOfBoundsException:48)解包字段=33, 消耗=42

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

长度=0030字节长度(b):48::传入数据十六进制(d): 38303002380000000C28200003030301303037323231373139343630303030303630303231383030303631373139 org.jpos.iso.IFA_LLNUM:解包问题字段33(java.lang.ArrayIndexOutOfBoundsException:48)解包字段=33, 消耗=42 org.jpos.iso.ISOException:org.jpos.iso.IFA_LLNUM:解包问题字段33(java.lang.ArrayIndexOutOfBoundsException:48) 拆包字段=33,消耗=42 在org.jpos.iso.isobasepacker.unpack上(isobasepacker.java:273) 在org.jpos.iso.ISOMsg.unpack上(ISOMsg.java:416) 位于org.jpos.iso.BaseChannel.unpack(BaseChannel.java:903) org.jpos.iso.BaseChannel.receive(BaseChannel.java:671) 位于org.jpos.iso.ISOServer$Session.run(ISOServer.java:130) 位于org.jpos.util.ThreadPool$PooledThread.run(ThreadPool.java:71) ---资料--- 0000 38 30 30 02 38 00 00 00 C2 82 00 00 30 30 30 30 300 800.8……0000 0010 31 30 30 37 32 31 39 34 36 30 30 30 100 7221719460000 0020 30 36 30 30 30 30 30 31 37 31390600021800061719

org.jpos.iso.IFA_LLNUM:解包问题字段33(java.lang.ArrayIndexOutOfBoundsException:48)解包字段=33, 消耗=42 org.jpos.iso.ISOException:org.jpos.iso.IFA_LLNUM:解包问题字段33(java.lang.ArrayIndexOutOfBoundsException:48) 拆包字段=33,消耗=42 在org.jpos.iso.isobasepacker.unpack上(isobasepacker.java:273) 在org.jpos.iso.ISOMsg.unpack上(ISOMsg.java:416) 位于org.jpos.iso.BaseChannel.unpack(BaseChannel.java:903) org.jpos.iso.BaseChannel.receive(BaseChannel.java:671) 位于org.jpos.iso.ISOServer$Session.run(ISOServer.java:130) 位于org.jpos.util.ThreadPool$PooledThread.run(ThreadPool.java:71)

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

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;
    }
publicstaticstringnetworktransport(stringisomessage)抛出UnknownHostException、IOException{
插座连接=新插座(“192.168.3.118”,1010);
BufferedOutputStream bos=新的BufferedOutputStream(connection.getOutputStream());
OutputStreamWriter osw=新的OutputStreamWriter(bos);
int len=isoMessage.length();//获取数据的长度
//既然你的包装商名字上写着Postilion,我想这会管用的。
osw.write(len>>8);//以2字节的形式发送长度字节。这是字节1
//写入(len);//以2字节的形式发送长度字节。这是字节2
osw.write(等信息);
osw.flush();
字节[]arrOutut=新字节[4096];
int count=connection.getInputStream().read(arrOutut,04096);
字符串clientRequest=“”;
对于(int-outputCount=0;outputCount
我目前面临的挑战是如何让我的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设备上使用这个方法,这些是我实际使用的文件夹

  • 渠道
  • 滤器
  • 标题
  • 包装工
  • 验证器和整个java类

  • 或者更好的方法是,使用jpos服务器打包数据中的所有文件和文件夹。您必须检查两个详细信息:

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

    2) jpos服务器打包程序

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

    您的问题与iso8583邮件打包无关。当处理意外/不支持的数据打包/解析时,这纯粹是与外部库相关的开发问题。由于您的错误日志,当TLV数据使用一些意外的垃圾数据时,可能是EMV数据打包问题。非常感谢您的回复。但是,我还没有真正理解的是。我看到了我的Android Studio控制台中包含的内容。但是,在另一个接收端,它只连接…而不显示已打包的内容…然后实际返回空错误。as@iso8583.infosupport说这应该是编程错误。但是,您是否仔细检查了ISO数据元素55中是否遇到异常,或者它是否来自其他数据元素?是否可以在处理元素的过程中逐个记录元素,以查看其在哪个阶段出现故障。我注意到,我的打包程序打包了所有必需的字段,但在到达不需要打包的字段时…返回null…这是否意味着我必须发送isoPackager中所需的所有内容。因为,我的isoField有一个结构化的设计,采用这种格式/*01 SALE*/{F02_-PAN、F03_-PROC、F04_-AMOUNT、F11_-STAN、F14_-EXP、F22_-POSE、F23、F25_-POCC、F26_-CAPTURE、F35_-TRACK2、F36_-TRACK3、F38_-AUTH、F39_-RSP、F41_-TID、F42_-ACCID、F49_-CURRENCY、F52_-PIN、F53_-SCI、F53_-SCI、F55_-ICC、F60、F64_-MAC}、FYI,在ISO8583接口中