J8583: ISO8583 MessageFactory 没有消息类型的解析指南"ffffff50"

J8583: ISO8583 MessageFactory has no parsing guide for message type "ffffff50"

我尝试编写一个在套接字上模拟 ISO 服务器的存根。 当我收到消息时,我得到类似这样的信息:

[pool-1-thread-5] ERROR com.solab.iso8583.MessageFactory - ISO8583 MessageFactory has no parsing guide for message type ffffff50 [ r$$? ??A??#9i.....

控制台消息:

Parsing incoming message:  r$$? ??A??#@&       i?....

我不知道我收到的消息类型..

为什么会有这么奇怪的编码?我该如何解决?

服务器代码:

public class SocketServer implements Runnable {
    private static final Log log = LogFactory.getLog(SocketServer.class);
    private static ScheduledExecutorService threadPool = Executors.newScheduledThreadPool(5);
    private static MessageFactory messageFactory;
    private Socket socket;

    public SocketServer(Socket socket){
        this.socket = socket;
    }

    public void run() {
        int count = 0;
        byte[] bufferLenght = new byte[2];
        try{
            while (socket != null && socket.isConnected()
                    && Thread.currentThread().isAlive()
                    && !Thread.currentThread().isInterrupted()){
                if (socket.getInputStream().read(bufferLenght) == 2){
                    int size = ((bufferLenght[0] & 0xff) << 8) | (bufferLenght[1] & 0xff);
                    byte[] buffer = new byte[size];
                    socket.getInputStream().read(buffer);
                    count++;
                    threadPool.schedule(new Processor(buffer, socket), 400, TimeUnit.MILLISECONDS);
                }
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
        log.debug(String.format("Count of requests: %d", count));
        try {
            socket.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

class 处​​理消息的处理器...

    private class Processor implements Runnable{

        private byte[] message;
        private Socket socket;

        public Processor(byte[] buffer, Socket socket){
            this.message = buffer;
            this.socket = socket;
        }

        public void run() {
            try{
                System.out.println(String.format("Parsing incoming message: %s", new String(message)));
                IsoMessage request = messageFactory.parseMessage(message,4);
                IsoMessage response = messageFactory.createResponse(request);
                response.setField(11, request.getField(11));
                response.setField(7, request.getField(7));
                response.write(socket.getOutputStream(), 2);
            } catch (ParseException e) {
                e.printStackTrace();
            } catch (UnsupportedEncodingException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

主要

    public static void main(String[] args) throws IOException {
        messageFactory = ConfigParser.createFromClasspathConfig("config.xml");
        System.err.println("Setting up server socket...");
        ServerSocket serverSocket = new ServerSocket(8583);
        System.err.println("Waiting for connections...");
        while (true){
            Socket socket = serverSocket.accept();
            System.err.println(String.format("New connection from %s:%d", socket.getInetAddress(), socket.getPort()));
            new Thread(new SocketServer(socket),"iso8583 server").start();
        }
    }
}

我的一部分config.xml:

    <parse type="0100">
        <field num="2" type="NUMERIC" length="20" />
        <field num="3" type="NUMERIC" length="6" />
        <field num="4" type="AMOUNT" />
        <field num="7" type="DATE10" />

..............

        <field num="62" type="LLLVAR" />
        <field num="63" type="LLLVAR" />
        <field num="64" type="LLLVAR" />
    </parse>

提前致谢!

邮件似乎是二进制编码的,您没想到会这样?或者反过来,也许(消息是 ASCII 编码的,你正试图以二进制编码读取它)