Menu

ISO8583 Client in Android

Shaína
2020-12-29
2021-01-04
  • Shaína

    Shaína - 2020-12-29

    I am working with android studio, and I'm trying to send an ISO8583 message to my SimHost

    I pulled the Iso8583 source code from https://bitbucket.org/chochos/j8583/src/master/

    and tried to set up a IsoClient with the example code found here http://read.pudn.com/downloads141/sourcecode/java/612948/src/j8583/example/Client.java__.htm

    so I added the config.xml file in resource raw directory, changed this line of code
    mfact = ConfigParser.createFromClasspathConfig("res/raw/config.xml"); , then added the http://j8583.sourceforge.net/j8583.dtd uri in File> Settings > Language $ Frameworks > Schemas $ DTDs and finally changed the socket ip and port in the Client main.

    However I can't see

    The ConfigParser is printing Adding {} ISO8583 header for type {}: {} false, binary : 0400 ISO015000050

    so in this line of code
    Log.i(TAG,"Adding {}ISO8583 header for type {}: {} " + binHeader + " binary : " + elem.getAttribute("type") + " " + header);

    binHeader is returning false and elem.getAttribute("type") is returning 0400 and the header is returning ISO015000050

    the config.xml has the following configurations
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE j8583-config PUBLIC "-//J8583//DTD CONFIG 1.0//EN"
    "http://j8583.sourceforge.net/j8583.dtd">
    <j8583-config></j8583-config>

    <!-- These are the ISO headers to be prepended to the message types specified -->
    <header type="0200">ISO015000050</header>
    <header type="0210">ISO015000055</header>
    <header type="0400">ISO015000050</header>
    <header type="0410">ISO015000055</header>
    <header type="0800">ISO015000015</header>
    <header type="0810">ISO015000015</header>
    
    <!-- The client example uses this to create requests -->
    <template type="0200">
        <field num="3" type="NUMERIC" length="6">650000</field>
        <field num="32" type="LLVAR">456</field>
        <field num="35" type="LLVAR">4591700012340000=</field>
        <field num="43" type="ALPHA" length="40">SOLABTEST TEST-3 DF MX</field>
        <field num="49" type="ALPHA" length="3">484</field>
        <field num="60" type="LLLVAR">B456PRO1+000</field>
        <field num="61" type="LLLVAR"> 1234P</field>
        <field num="100" type="LLVAR">999</field>
        <field num="102" type="LLVAR">ABCD</field>
    </template>
    
    <!-- The server example uses this to create the responses
    we only need a few fields because the rest are copied from the request -->
    <template type="0210">
        <field num="60" type="LLLVAR">Fixed data from template</field>
        <field num="70" type="ALPHA" length="3">ABC</field>
        <field num="90" type="ALPHA" length="42">Field of length 42</field>
        <field num="100" type="LLVAR">Fixed field</field>
        <field num="102" type="LLVAR">Another fixed field</field>
        <field num="126" type="LLLVAR">...and yet another fixed field.</field>
    </template>
    
    <!-- The server example uses this to read the requests -->
    <parse type="0200">
        <field num="3" type="NUMERIC" length="6" />
        <field num="4" type="AMOUNT" />
        <field num="7" type="DATE10" />
        <field num="11" type="NUMERIC" length="6" />
        <field num="12" type="TIME" />
        <field num="13" type="DATE4" />
        <field num="15" type="DATE4" />
        <field num="17" type="DATE_EXP" />
        <field num="32" type="LLVAR" />
        <field num="35" type="LLVAR" />
        <field num="37" type="NUMERIC" length="12" />
        <field num="41" type="ALPHA" length="16" />
        <field num="43" type="ALPHA" length="40" />
        <field num="48" type="LLLVAR" />
        <field num="49" type="ALPHA" length="3" />
        <field num="60" type="LLLVAR" />
        <field num="61" type="LLLVAR" />
        <field num="100" type="LLVAR" />
        <field num="102" type="LLVAR" />
    </parse>
    
    <!-- The client example uses this to read the responses -->
    <parse type="0210">
        <field num="3" type="NUMERIC" length="6" />
        <field num="4" type="AMOUNT" />
        <field num="7" type="DATE10" />
        <field num="11" type="NUMERIC" length="6" />
        <field num="12" type="TIME" />
        <field num="13" type="DATE4" />
        <field num="15" type="DATE4" />
        <field num="17" type="DATE_EXP" />
        <field num="32" type="LLVAR" />
        <field num="35" type="LLVAR" />
        <field num="37" type="NUMERIC" length="12" />
        <field num="38" type="NUMERIC" length="6" />
        <field num="39" type="NUMERIC" length="2" />
        <field num="41" type="ALPHA" length="16" />
        <field num="43" type="ALPHA" length="40" />
        <field num="48" type="LLLVAR" />
        <field num="49" type="ALPHA" length="3" />
        <field num="60" type="LLLVAR" />
        <field num="61" type="LLLVAR" />
        <field num="70" type="ALPHA" length="3" />
        <field num="90" type="ALPHA" length="42" />
        <field num="100" type="LLVAR" />
        <field num="102" type="LLVAR" />
        <field num="126" type="LLLVAR" />
    </parse>
    

    StrackTrace

    2020-12-29 11:34:12.398 6322-6392/com.example.printdemo D/IsoClient Main: Reading config
    2020-12-29 11:34:12.412 6322-6392/com.example.printdemo D/CreateFromClasspathConfig: ISO8583 Parsing config from classpath file {}res/raw/config.xml
    2020-12-29 11:34:12.473 6322-6392/com.example.printdemo I/parse headers: Adding {}ISO8583 header for type {}: {}falsebinary :0200ISO015000050
    2020-12-29 11:34:12.473 6322-6392/com.example.printdemo I/parse headers: Adding {}ISO8583 header for type {}: {}falsebinary :0210ISO015000055
    2020-12-29 11:34:12.474 6322-6392/com.example.printdemo I/parse headers: Adding {}ISO8583 header for type {}: {}falsebinary :0400ISO015000050
    2020-12-29 11:34:12.474 6322-6392/com.example.printdemo I/parse headers: Adding {}ISO8583 header for type {}: {}falsebinary :0410ISO015000055
    2020-12-29 11:34:12.475 6322-6392/com.example.printdemo I/parse headers: Adding {}ISO8583 header for type {}: {}falsebinary :0800ISO015000015
    2020-12-29 11:34:12.475 6322-6392/com.example.printdemo I/parse headers: Adding {}ISO8583 header for type {}: {}falsebinary :0810ISO015000015
    2020-12-29 11:34:12.505 6322-6392/com.example.printdemo W/System.err: java.util.IllegalFormatConversionException: x != java.util.ArrayList
    2020-12-29 11:34:12.506 6322-6392/com.example.printdemo W/System.err: at java.util.Formatter$FormatSpecifier.failConversion(Formatter.java:4402)
    2020-12-29 11:34:12.506 6322-6392/com.example.printdemo W/System.err: at java.util.Formatter$FormatSpecifier.printInteger(Formatter.java:2884)
    2020-12-29 11:34:12.506 6322-6392/com.example.printdemo W/System.err: at java.util.Formatter$FormatSpecifier.print(Formatter.java:2838)
    2020-12-29 11:34:12.506 6322-6392/com.example.printdemo W/System.err: at java.util.Formatter.format(Formatter.java:2523)
    2020-12-29 11:34:12.506 6322-6392/com.example.printdemo W/System.err: at java.util.Formatter.format(Formatter.java:2458)
    2020-12-29 11:34:12.507 6322-6392/com.example.printdemo W/System.err: at java.lang.String.format(String.java:2770)
    2020-12-29 11:34:12.508 6322-6392/com.example.printdemo W/System.err: at com.example.printdemo.iso8583.MessageFactory.setParseMap(MessageFactory.java:744)
    2020-12-29 11:34:12.508 6322-6392/com.example.printdemo W/System.err: at com.example.printdemo.iso8583.parse.ConfigParser.parseGuides(ConfigParser.java:362)
    2020-12-29 11:34:12.508 6322-6392/com.example.printdemo W/System.err: at com.example.printdemo.iso8583.parse.ConfigParser.parse(ConfigParser.java:448)
    2020-12-29 11:34:12.508 6322-6392/com.example.printdemo W/System.err: at com.example.printdemo.iso8583.parse.ConfigParser.createFromClasspathConfig(ConfigParser.java:94)
    2020-12-29 11:34:12.508 6322-6392/com.example.printdemo W/System.err: at com.example.printdemo.iso8583.parse.ConfigParser.createFromClasspathConfig(ConfigParser.java:81)
    2020-12-29 11:34:12.508 6322-6392/com.example.printdemo W/System.err: at com.example.printdemo.IsoClient.send(IsoClient.java:105)
    2020-12-29 11:34:12.508 6322-6392/com.example.printdemo W/System.err: at com.example.printdemo.MainActivity.lambda$sendIsoMessageOnClick$1$MainActivity(MainActivity.java:73)
    2020-12-29 11:34:12.508 6322-6392/com.example.printdemo W/System.err: at com.example.printdemo.-$$Lambda$MainActivity$jzAf5m209ydL3O0-0owgCwqr5fI.run(Unknown Source:2)
    2020-12-29 11:34:12.508 6322-6392/com.example.printdemo W/System.err: at java.lang.Thread.run(Thread.java:764)
    2020-12-29 11:35:12.707 6322-6376/com.example.printdemo W/Adreno-ES20: <core_glfinish:34>: glFinish skipped: 0</core_glfinish:34>

     
  • Shaína

    Shaína - 2021-01-04

    nevermind

     

Log in to post a comment.