-1

I am making a jPOS Client and a ISO Server program, in which I'm trying to hit the server from the client.

I got this exception on my client, my server successfully returned this response (both using the same packager).

ISO Server response

<log realm="xml-server-8000/127.0.0.1:54830" at="2023-02-13T09:30:02.218720900">
  <send>
    <isomsg direction="outgoing">
      <!-- org.jpos.iso.packager.GenericPackager[cfg/iso87ascii.xml] -->
      <header>49534F303136303030303135</header>
      <field id="0" value="0210"/>
      <field id="2" value="1818180000000001"/>
      <field id="3" value="011000"/>
      <field id="4" value="000020000000"/>
      <field id="5" value="000020000000"/>
      <field id="6" value="000020000000"/>
      <field id="7" value="0713085819"/>
      <field id="9" value="61000000"/>
      <field id="10" value="61000000"/>
      <field id="11" value="000017"/>
      <field id="12" value="155819"/>
      <field id="13" value="0713"/>
      <field id="17" value="0713"/>
      <field id="18" value="6011"/>
      <field id="32" value="11"/>
      <field id="35" value="1818180000000001=9912"/>
      <field id="37" value="1039        "/>
      <field id="38" value="000017"/>
      <field id="39" value="00"/>
      <field id="41" value="00001641"/>
      <field id="43" value="RPC MAKASSAR          UJUNG PANDANG   ID                                                           "/>
      <field id="49" value="360"/>
      <field id="50" value="360"/>
      <field id="51" value="360"/>
      <field id="54" value="1002360C000268000980"/>
      <field id="60" value="BDANPRO1+000"/>
      <field id="61" value="CBDAPRO10000P"/>
      <field id="100" value="888"/>
      <field id="102" value="003600108017"/>
      <field id="126" value="&amp; 0000200122! QJ00100 081278329015   123456      47059965    5577911488052911                                             "/>
    </isomsg>
  </send>
</log>

ISOClient packager log after receiving response

<log realm="debug" at="2023-02-13T09:30:02.210741800">
  <pack>
    30323030463233384330303132384130383031383030303030303030313430303030303431363138313831383030303030303030303130313130303030303030323030303030303030373133303835383139303030303137313535383139303731333037313336303131303231313231313831383138303030303030303030313D393931323130333920202020202020203030303031363431525043204D414B415353415220202020202020202020554A554E472050414E44414E47202020494420202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020203336303031324244414E50524F312B3030303031334342444150524F313030303050303338383831323030333630303130383031373132322620303030303230303132322120514A30303130302030383132373833323930313520202031323334353620202020202034373035393936352020202035353737393131343838303532393131202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020
  </pack>
</log>
<log realm="debug" at="2023-02-13T09:30:02.221712900" lifespan="2ms">
  <unpack>
    49534F3031363030303031353032313046454638433030313245413045343138303030303030303031343030303030343136313831383138303030303030303030313031313030303030303032303030303030303030303032303030303030303030303032303030303030303037313330383538313936313030303030303631303030303030303030303137313535383139303731333037313336303131303231313231313831383138303030303030303030313D3939313231303339202020202020202030303030313730303030303031363431525043204D414B415353415220202020202020202020554A554E472050414E44414E472020204944202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202033363033363033363030323031303032333630433030303236383030303938303031324244414E50524F312B3030303031334342444150524F313030303050303338383831323030333630303130383031373132322620303030303230303132322120514A30303130302030383132373833323930313520202031323334353620202020202034373035393936352020202035353737393131343838303532393131202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020
    <bitmap>{4, 6, 7, 28, 30, 32, 39, 44, 49, 50, 51, 52, 53, 54, 55, 57, 58, 59, 60, 61}</bitmap>
    <unpack fld="4" packager="org.jpos.iso.IFA_NUMERIC">
      <!-- AMOUNT, TRANSACTION -->
      <value>C0012EA0E418</value>
    </unpack>
    <unpack fld="6" packager="org.jpos.iso.IFA_NUMERIC">
      <!-- AMOUNT, CARDHOLDER BILLING -->
      <value>000000001400</value>
    </unpack>
    <unpack fld="7" packager="org.jpos.iso.IFA_NUMERIC">
      <!-- TRANSMISSION DATE AND TIME -->
      <value>0004161818</value>
    </unpack>
    <unpack fld="28" packager="org.jpos.iso.IFA_AMOUNT">
      <!-- AMOUNT, TRANSACTION FEE -->
      <value>180000000</value>
    </unpack>
    <unpack fld="30" packager="org.jpos.iso.IFA_AMOUNT">
      <!-- AMOUNT, TRANSACTION PROCESSING FEE -->
      <value>001011000</value>
    </unpack>
    <unpack fld="32" packager="org.jpos.iso.IFA_LLNUM">
      <!-- ACQUIRING INSTITUTION IDENT CODE -->
      <value></value>
    </unpack>
    <unpack fld="39" packager="org.jpos.iso.IF_CHAR">
      <!-- RESPONSE CODE -->
      <value>00</value>
    </unpack>
    <unpack fld="44" packager="org.jpos.iso.IFA_LLCHAR">
      <!-- ADITIONAL RESPONSE DATA -->
      <value>00000000002000000000</value>
    </unpack>
    <unpack fld="49" packager="org.jpos.iso.IF_CHAR">
      <!-- CURRENCY CODE, TRANSACTION -->
      <value>002</value>
    </unpack>
    <unpack fld="50" packager="org.jpos.iso.IF_CHAR">
      <!-- CURRENCY CODE, SETTLEMENT -->
      <value>000</value>
    </unpack>
    <unpack fld="51" packager="org.jpos.iso.IF_CHAR">
      <!-- CURRENCY CODE, CARDHOLDER BILLING -->
      <value>000</value>
    </unpack>
    <unpack fld="52" packager="org.jpos.iso.IFA_BINARY">
      <!-- PIN DATA -->
      <value type='binary'>0071308581961000</value>
    </unpack>
    <unpack fld="53" packager="org.jpos.iso.IFA_NUMERIC">
      <!-- SECURITY RELATED CONTROL INFORMATION -->
      <value>0006100000000001</value>
    </unpack>
    error unpacking field 54 consumed=139
    <iso-exception>
      org.jpos.iso.IFA_LLLCHAR: Problem unpacking field 54
      <iso-exception>
        Field length 715 too long. Max: 120
        org.jpos.iso.ISOException: Field length 715 too long. Max: 120
    at org.jpos.iso.ISOStringFieldPackager.unpack(ISOStringFieldPackager.java:179)
    at org.jpos.iso.ISOBasePackager.unpack(ISOBasePackager.java:306)
    at org.jpos.iso.ISOMsg.unpack(ISOMsg.java:479)
    at org.jpos.iso.BaseChannel.unpack(BaseChannel.java:978)
    at org.jpos.iso.BaseChannel.receive(BaseChannel.java:748)
    at com.taskincomplete.jpos.SampleRequestB24Channel.main(SampleRequestB24Channel.java:103)
      </iso-exception>
      org.jpos.iso.ISOException: org.jpos.iso.IFA_LLLCHAR: Problem unpacking field 54 (org.jpos.iso.ISOException: Field length 715 too long. Max: 120)
    at org.jpos.iso.ISOStringFieldPackager.unpack(ISOStringFieldPackager.java:187)
    at org.jpos.iso.ISOBasePackager.unpack(ISOBasePackager.java:306)
    at org.jpos.iso.ISOMsg.unpack(ISOMsg.java:479)
    at org.jpos.iso.BaseChannel.unpack(BaseChannel.java:978)
    at org.jpos.iso.BaseChannel.receive(BaseChannel.java:748)
    at com.taskincomplete.jpos.SampleRequestB24Channel.main(SampleRequestB24Channel.java:103)
Nested:org.jpos.iso.ISOException: Field length 715 too long. Max: 120
    at org.jpos.iso.ISOStringFieldPackager.unpack(ISOStringFieldPackager.java:179)
    at org.jpos.iso.ISOBasePackager.unpack(ISOBasePackager.java:306)
    at org.jpos.iso.ISOMsg.unpack(ISOMsg.java:479)
    at org.jpos.iso.BaseChannel.unpack(BaseChannel.java:978)
    at org.jpos.iso.BaseChannel.receive(BaseChannel.java:748)
    at com.taskincomplete.jpos.SampleRequestB24Channel.main(SampleRequestB24Channel.java:103)
    </iso-exception>
    <iso-exception>
      org.jpos.iso.IFA_LLLCHAR: Problem unpacking field 54 (org.jpos.iso.ISOException: Field length 715 too long. Max: 120) unpacking field=54, consumed=139
      org.jpos.iso.ISOException: org.jpos.iso.IFA_LLLCHAR: Problem unpacking field 54 (org.jpos.iso.ISOException: Field length 715 too long. Max: 120) unpacking field=54, consumed=139
    at org.jpos.iso.ISOBasePackager.unpack(ISOBasePackager.java:341)
    at org.jpos.iso.ISOMsg.unpack(ISOMsg.java:479)
    at org.jpos.iso.BaseChannel.unpack(BaseChannel.java:978)
    at org.jpos.iso.BaseChannel.receive(BaseChannel.java:748)
    at com.taskincomplete.jpos.SampleRequestB24Channel.main(SampleRequestB24Channel.java:103)
    </iso-exception>
  </unpack>
</log>

this is the ISO Client Code i used

    public static void main(String[] args) throws IOException, ISOException {
        // Create Packager based on XML that contain DE type
        GenericPackager packager = new GenericPackager("iso87ascii.xml");

        // Create ISO Message
        ISOMsg isoMsg = new ISOMsg();
        isoMsg.setPackager(packager);
         //isoMsg.setHeader("6003560000".getBytes());
        isoMsg.setHeader("ISO016000010".getBytes());
        isoMsg.setMTI("0200");
        isoMsg.set(2, "1818180000000001");
        isoMsg.set(3, "011000");
        isoMsg.set(4, "000020000000");
        isoMsg.set(7, "0713085819");
        isoMsg.set(11, "000017");
        isoMsg.set(12, "155819");
        isoMsg.set(13, "0713");
        isoMsg.set(17,"0713");
        isoMsg.set(18,"6011");
        isoMsg.set(32,"11");
        isoMsg.set(35, "1818180000000001=9912");
        isoMsg.set(37, "1039");
        isoMsg.set(41, "00001641");
        isoMsg.set(43, "RPC MAKASSAR          UJUNG PANDANG   ID");
        isoMsg.set(49, "360");
        isoMsg.set(60, "BDANPRO1+000");
        isoMsg.set(61, "CBDAPRO10000P");
        isoMsg.set(100, "888");
        isoMsg.set(102, "003600108017");
        isoMsg.set(126, "& 0000200122! QJ00100 081278329015   123456      47059965    5577911488052911                                             ");

        BASE24Channel c = new BASE24Channel("localhost", 8000, packager/*
                                                                         * , ISOUtil.str2bcd("600356", false)
                                                                         */);
        logISOMsg(isoMsg);
        System.out.println(ISOUtil.hexdump(isoMsg.pack()));
        c.connect();
        c.send(isoMsg);
        ISOMsg response = c.receive();
        System.out.println(ISOUtil.hexdump(response.pack()));
        System.out.println("****************Response *********************");
        logISOMsg(response);

the current jpos server xml i use using the same ISOChannelType as the client

<server class="org.jpos.q2.iso.QServer" logger="Q2" name="xml-server-8000" realm="xml-server-8000">
    <attr name="port" type="java.lang.Integer">8000</attr>
    <channel class="org.jpos.iso.channel.BASE24Channel"
             packager="org.jpos.iso.packager.GenericPackager"
             type="server"
             logger="Q2"
             realm="xml-server-8000"
             header= "ISO016000010">
        <property name="timeout" value="180000"/>
        <property name="packager-config" value="cfg/iso87ascii.xml" />
    </channel>
    <request-listener class="org.jpos.tutorial.LogonRequest" />
</server>

last the packager myPackager both server and client using the same packager, but still the client can't parse the message, any idea? Also just noticed my ISOClient received different bitmap with my ISOServer response bitmap

Andrés Alcarraz
  • 1,570
  • 1
  • 12
  • 21
mc ser
  • 43
  • 1
  • 7
  • If the packager is the same, then It's probably a misalignment at channel level, maybe the sender response message has a header the client channel isn't expecting. Please share in the question the logs of sever and channel as well as it's definitions (XML or java code you are using for writing them) – Andrés Alcarraz Feb 12 '23 at 15:52
  • I think there was a mistake before, now i tried to adjust with the same packager and my client getting another error like this [link](https://pastebin.com/v1pHMdMj) and my ISO Server sending this [link](https://pastebin.com/VuhyvND8), as you can see my server return field 54 correctly below the maximum length, but why my client read it too long? Any idea? – mc ser Feb 12 '23 at 17:14
  • Also i want to ask, if the field if absent on the server response? the client will also try to unpack the absent field? – mc ser Feb 12 '23 at 17:21
  • As the packager or channel is not correctly aligned it is reading the bitmap wrong – Andrés Alcarraz Feb 12 '23 at 17:48
  • Please add the text to the question not links in the comments. It makes it hard for someone watching this question later to know the problems or how to solve it – Andrés Alcarraz Feb 12 '23 at 17:50
  • Add the code to the question also, and the relevant outputs, help us help you – Andrés Alcarraz Feb 12 '23 at 17:52
  • @AndrésAlcarraz i already edited my question to the updated issue, provided my code and etc – mc ser Feb 13 '23 at 02:12

1 Answers1

0

The issue was solved the issue by setting a header on the client channel, this is because the channel needs to know how many of the incoming bytes are for the header.

Here isthe fixed code

public static void main(String[] args) throws IOException, ISOException {
    // Create Packager based on XML that contain DE type
    GenericPackager packager = new GenericPackager("iso87ascii.xml");

    // Create ISO Message
    ISOMsg isoMsg = new ISOMsg();
    isoMsg.setPackager(packager);
     //isoMsg.setHeader("6003560000".getBytes());
    isoMsg.setHeader("ISO016000010".getBytes());
    isoMsg.setMTI("0200");
    isoMsg.set(2, "1818180000000001");
    isoMsg.set(3, "011000");
    isoMsg.set(4, "000020000000");
    isoMsg.set(7, "0713085819");
    isoMsg.set(11, "000017");
    isoMsg.set(12, "155819");
    isoMsg.set(13, "0713");
    isoMsg.set(17,"0713");
    isoMsg.set(18,"6011");
    isoMsg.set(32,"11");
    isoMsg.set(35, "1818180000000001=9912");
    isoMsg.set(37, "1039");
    isoMsg.set(41, "00001641");
    isoMsg.set(43, "RPC MAKASSAR          UJUNG PANDANG   ID");
    isoMsg.set(49, "360");
    isoMsg.set(60, "BDANPRO1+000");
    isoMsg.set(61, "CBDAPRO10000P");
    isoMsg.set(100, "888");
    isoMsg.set(102, "003600108017");
    isoMsg.set(126, "& 0000200122! QJ00100 081278329015   123456      47059965    5577911488052911                                             ");

    BASE24Channel c = new BASE24Channel("localhost", 8000, packager);
    c.setHeader("ISO016000010");

    logISOMsg(isoMsg);
    System.out.println(ISOUtil.hexdump(isoMsg.pack()));
    c.connect();
    c.send(isoMsg);
    ISOMsg response = c.receive();
    System.out.println(ISOUtil.hexdump(response.pack()));
    System.out.println("****************Response *********************");
    logISOMsg(response);
Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
mc ser
  • 43
  • 1
  • 7