2016-10-13 2 views
0

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에 대한 **

부족 데이터 : 나는 데이터 공간을 변경하면

, 그것은 ** 오류가 발생합니다.

감사합니다.

+1

첫 번째는 입력 버퍼에서 공백을 제거합니다. –

+0

공간을 제거하면 오류가 발생합니다. "LLLVAR에 대한 데이터가 불충분 함" –

답변

3

답글 :

1) 메시지 버퍼에서 공백을 제거하십시오.

2) 메시지 형식 프로필을 확인하십시오.

귀하의 경우 필드 60은 길이에 4자를가집니다. 즉 LLLLVAR.

--- 
msg:#"0800A0200000008000100400000000000000000000000001323931313030..0301" 
- MTI: "0800" # Message Type ID. // Network management request 
- DE000: "A020000000800010" # Primary bitmap // 1.3.11.41.60. 
- BM0:#"0400000000000000000000000001323931313030303100" # Fields at Primary Bitmap 
    - DE001: "0400000000000000" # Secondary bitmap // 70. 
    - DE003:#"000000" # PC 
    - S01: "00" # Transaction Code. // Purchase of goods or services 
    - S02: "00" # Account, from. // Standard purchase 
    - S03: "00" # Account, to. // Standard purchase 
    - DE011: "000001" # STAN. // 1 
    - DE041: "3239313130303031" # CATI. // "29110001" 
    - DE060:#"001054455354204D45535347" 
    - len: "0010" // 10 
    - val: "54455354204D45535347" // "TEST MESSG" 
- BM1:#"0301" # Fields at Secondary Bitmap 
    - DE070: "0301" # Network management information code // 301 - Echo test 
+0

노력에 감사드립니다. 프로필을 확인하려면 어떻게해야합니까? 온라인 도구가 있습니까? –

+0

ISO 8583은 필드 형식에 따라 가변적입니다. 또 다른 질문에 따르면 http://stackoverflow.com/questions/40013434/j8583-iso8583-messagefactory-has-no-parsing-guide-for-message-type-0800 프로토콜 요구 사항에 맞게 XML 구성 프로파일을 변경할 수 있습니다. j8583 이외의 다른 도구를 사용하고 있으며이 Java API를 지원할 수 없습니다. –

+0

및 필드 60 길이 4는 어떻게 구합니까? 게시 할 때 len : "0010"및 val : "0010544535354204D45535347"을 표시합니다. 설명해 주시겠습니까? 나는 ISO8583을 처음 사용합니다. 나는 LLLLVAR에 대해 처음 4 개의 문자가 필드 길이를 정의한다는 것을 알고있다. 그러나 "0010"은 10 또는 2로 간주됩니다. –

관련 문제