ISO 메시지를 구문 분석하기 위해 j8583 iso 파서를 사용하고 있습니다.j8583 : ISOMessage 파서가 예상대로 출력을 생성하지 않습니다.
는 "30303031 00105445 5354204D 45,535,347 0301 00,000,080 00,100,400 00,000,000 00,000,000 00,000,001 32,393,131 0800A020는"
다음은 내 코드입니다.import com.solab.iso8583.IsoMessage;
import com.solab.iso8583.IsoValue;
import com.solab.iso8583.MessageFactory;
import com.solab.iso8583.parse.ConfigParser;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import java.text.ParseException;
public class ISOUtility {
private static BufferedReader reader;
private static String getMessage() throws IOException {
if (reader == null) {
reader = new BufferedReader(new InputStreamReader(System.in));
}
// System.out.println("Paste your ISO8583 message here (no ISO headers): ");
return "08002020 00000080 00000000 00000001 32393131 30303031";
}
public static void main(String [] args) throws IOException, ParseException {
// System.out.println("Hello");
final MessageFactory<IsoMessage> mf = new MessageFactory<IsoMessage>();
if (1 == 0) {
// System.out.println("Hello2");
// ConfigParser.createFromClasspathConfig("j8583.xml");
ConfigParser.configureFromDefault(mf);
} else {
System.out.println("Hello3");
String path="C:\\Users\\DELL\\workspace\\SolabParser\\j8583.xml";
if (System.console() != null) {
System.console().printf("Attempting to configure MessageFactory from %s...%n", path);
}
System.out.println("Messagefactory is done");
String url = "C:\\Users\\DELL\\workspace\\SolabParser\\j8583.xml";
if (url.contains("://")) {
System.out.println("else ");
ConfigParser.configureFromUrl(mf, new URL(args[0]));
} else {
System.out.println("else ");
ConfigParser.configureFromUrl(mf, new File(path).toURI().toURL());
}
}
//Now read messages in a loop
String line = getMessage();
// while (line != null && line.length() > 0) {
mf.setIgnoreLastMissingField(true);
System.out.println(mf.getIgnoreLastMissingField());
IsoMessage m = mf.parseMessage(line.getBytes(), 0);
System.out.println("Hello5");
if (m != null) {
System.out.printf("Message type: %04x%n", m.getType());
System.out.println("FIELD TYPE VALUE");
for (int i = 2; i <= 128; i++) {
IsoValue<?> f = m.getField(i);
if (f != null) {
System.out.printf("%5d %-6s [", i, f.getType());
System.out.print(f.toString());
System.out.println(']');
}
}
}
line = getMessage();
// }
}
출력이 잘못 표시됩니다.
Message type: 0800
FIELD TYPE VALUE
3 ALPHA [000000]
11 NUMERIC [00 000]
41 NUMERIC [00001 32393131 3]
60 LLLVAR [3031 00105445 5354204D 4553534]
70 NUMERIC [7 0]
모든 필드에는 잘못된 데이터가 있습니다. 이것을 극복하기 위해 LLLVAR 필드 (60)
모든 sugeestion에 대한 **
부족 데이터 : 나는 데이터 공간을 변경하면
, 그것은 ** 오류가 발생합니다.
감사합니다.
첫 번째는 입력 버퍼에서 공백을 제거합니다. –
공간을 제거하면 오류가 발생합니다. "LLLVAR에 대한 데이터가 불충분 함" –