Add 2 byte length header to message using NACChannel.

707 views
Skip to first unread message

Shareefuddin Mohammed

unread,
Jan 9, 2020, 9:21:59 PM1/9/20
to jPOS Users

Hi,

I am using NACChannel to send ISO message to server which require [2 byte + message length]  as length header prepended to ISO message.

Example : Hex string : 004f303130307038000100c09000130600649128699990086531000000000000000014084514084501060606128630526f785465737439393939393939393939303030303008403030303038303636

Server is complaining that they are not getting 004f as the message header.

Used below code to send :

import org.jpos.iso.*;
import org.jpos.util.*;
import org.jpos.iso.channel.*;
import org.jpos.iso.header.BaseHeader;
import org.jpos.iso.packager.*;
import java.nio.ByteBuffer;

public class NACChannelTest1 {
    public static void main (String[] args) throws Exception {
        try {
            String HOST = "xxxxxx.xxxx.xxx";
            int PORT = xxxx;
            Logger logger = new Logger();
            logger.addListener (new SimpleLogListener (System.out));
            // Create Packager based on XML that contain DE type
            ISOBasePackager packager = new GenericPackager("resources/fields.xml");
            ISOMsg isoMsg = build200ISOMessage(packager);
           
            byte[] data = isoMsg.pack();
            short messageLength = (short)data.length;
            ByteBuffer bb = ByteBuffer.allocate(2);
            bb.putShort(messageLength);
            byte[] headerArr1 = bb.array();
            byte fByte = headerArr1[0];
            byte sByte = (byte) (headerArr1[1] + (byte)2);
            byte[] headerArr2 = new byte[2];
            headerArr2[0] = fByte;
            headerArr2[1] = sByte;
       
            BaseHeader bh = new BaseHeader(headerArr2);
            isoMsg.setHeader((ISOHeader)bh);
           
            String hexStr = ISOUtil.byte2hex(data);
            System.out.println("hexStr : "+hexStr);
           
            NACChannel nc = new NACChannel(HOST, PORT, isoMsg.getPackager(), null);
            ((LogSource)nc).setLogger (logger, "test-channel");
            ISOMUX mux = new ISOMUX(nc);
            new Thread(mux).start();
            ISOMsg response = mux.request(isoMsg, 5*1000);
           
            System.out.println("Getting response "+response);
            if (response != null) {
                response.dump(System.out, "");
                System.out.println("MTI : "+response.getMTI());
            }
        } catch (Exception e) {
            System.out.println("Exception found");
        }
    }
   
    private static ISOMsg build200ISOMessage(ISOBasePackager packager) throws ISOException {
        // Create ISO Message
        ISOMsg isoMsg = new ISOMsg();
        isoMsg.setPackager(packager);
        isoMsg.setMTI("0100");
        isoMsg.set("2", "6006491286999980958");
        isoMsg.set("3", "310000");
        isoMsg.set("4", "000000000000");
        isoMsg.set("11", "025220");
        isoMsg.set("12", "025220");
        isoMsg.set("13", "0109");
        isoMsg.set("32", "061286");
        isoMsg.set("41", "RoxTest1");
        isoMsg.set("42", "999999999900000");
        isoMsg.set("49", "0840");

        return isoMsg;
    }
   
}

Logs :

hexStr : 303130307038000100c080001306006491286999980958310000000000000000025220025220010906061286526f7854657374313939393939393939393930303030300840
<log realm="test-channel/208.224.248.174:5122" at="2020-01-09T16:47:19.601" lifespan="220ms">
  <connect>
    Try 0 xxxx.xxx.xxx:xxxx
  </connect>
</log>
<log realm="test-channel/xxx.xxx.xxx.xxx:xxxx" at="2020-01-09T16:47:19.673">
  <send>
    <isomsg direction="outgoing">
      <!-- org.jpos.iso.packager.GenericPackager[resources/fields.xml] -->
      <header>0047</header>
      <field id="0" value="0100"/>
      <field id="2" value="6006491286999980958"/>
      <field id="3" value="310000"/>
      <field id="4" value="000000000000"/>
      <field id="11" value="025220"/>
      <field id="12" value="025220"/>
      <field id="13" value="0109"/>
      <field id="32" value="061286"/>
      <field id="41" value="TesTest1"/>
      <field id="42" value="999999999900000"/>
      <field id="49" value="0840"/>
    </isomsg>
  </send>
</log>
<log realm="test-channel/xxx.xxx.xxx.xxx:xxxx" at="2020-01-09T16:47:19.887" lifespan="214ms">
  <receive>
    <peer-disconnect/>
  </receive>
</log>
<log realm="test-channel/xxx.xxx.xxx.xxx:xxxx" at="2020-01-09T16:47:19.888">
  <usable>
    false
  </usable>
</log>

Server support reported that they are not getting valid ISO message from client.

Server does not see a valid request as we cannot identify what is being sent:

 

08:00:29 $TNM1    ISO8583 : Unknown Msg [999]

08:01:27 $TNM1    ISO8583 : Unknown Msg [999]

Please help me in figuring out the issue.

Regards,
Shareef

Alejandro Revilla

unread,
Jan 9, 2020, 9:40:47 PM1/9/20
to jPOS Users
I believe you are going through a huge effort, dealing with the header, packing the message and computing its length, and all that is handled by jPOS automatically.

Take a look at the jPOS gateway tutorial (http://jpos.org/tutorials), use Q2 to setup your MUX and ChannelAdaptor, then you just need to create an ISOMsg (don't have to create packager/channel, etc.) and call `mux.request`




--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage. Please support jPOS, contact: sa...@jpos.org
---
You received this message because you are subscribed to the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/8d3d9b72-54f9-4e28-b41e-80436c4b1fea%40googlegroups.com.

Shareefuddin Mohammed

unread,
Jan 13, 2020, 12:58:44 AM1/13/20
to jPOS Users

Thank you Alejandro, I'll follow the tutorials to send header length.

I am facing one more issue :
Server unable to receive complete message from client, once client closes connection then receiving the remaining message.
Tried in netcat server :

Receive this which is not a complete message,

00000000  00 47 30 31 30 30 70 38  00 01 00 c0 80 00 13 06  |.G0100p8........|
00000010  00 64 91 28 69 99 98 09  58 31 00 00 00 00 00 00  |.d.(i...X1......|
00000020  00 00 10 34 20 10 34 20  11 26 06 06 12 86 52 6f  |...4 .4 .&....Ro|
00000030  78 54 65 73 74 31 39 39  39 39 39 39 39 39 39 39  |xTest19999999999|  


Receive this(remaining) once client connection is closed.

00000040  30 30 30 30 30 08 40                              |00000.@|
00000047

Regards,
Shareef
To unsubscribe from this group and stop receiving emails from it, send an email to jpos-...@googlegroups.com.

Alejandro Revilla

unread,
Jan 20, 2020, 7:28:25 PM1/20/20
to jpos-...@googlegroups.com
I’m not sure I properly understand what those logs and dumps actually mean. What is the client? a jPOS based application or a third party one? Can you explain in more detail?

--

chhil

unread,
Jan 21, 2020, 1:04:28 AM1/21/20
to jpos-...@googlegroups.com
Alejandro,
Check the slack jpos support channel.


For clarity, netcat server was being used with a custom channel  class that overrode some methods. 
The netcat server displayed a partial message when the request was sent using the simple channel client. 

-chhil



--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage. Please support jPOS, contact: sa...@jpos.org
---
You received this message because you are subscribed to the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/CAAgSK%3D%3Djbz2x1yNNTnvg4K7xzxMT92M4T4EqEVWsH884nmyUEA%40mail.gmail.com.

Shareefuddin Mohammed

unread,
Jan 21, 2020, 1:15:42 AM1/21/20
to jpos-...@googlegroups.com
Hi Alejandro,

Thanks for helping me.
Client is a jPOS based application and trying to send request to Netcat server using NACChannel.

My requirement is to add 2 byte length header prepended to ISO message.
Length header(2 byte) + ISO message

Length header should include length of message too.

Ex: If length of message = 69 bytes then length header should be 69 + 2 = 71 bytes which is hex 47 but netcat server is showing only 69 bytes(hex 45).

1. Code using Netcat as server:

import java.io.IOException;
import org.jpos.core.Configuration;
import org.jpos.core.ConfigurationException;
import org.jpos.core.SimpleConfiguration;
import org.jpos.iso.ISOBasePackager;
import org.jpos.iso.ISOException;
import org.jpos.iso.ISOMsg;
import org.jpos.iso.ISOServer;
import org.jpos.iso.ISOUtil;
import org.jpos.iso.channel.NACChannel;
import org.jpos.iso.packager.GenericPackager;
import org.jpos.util.Logger;
import org.jpos.util.SimpleLogListener;
import org.jpos.util.ThreadPool;

public class NACChannelTestChhil {
    int lenlen = 2;
    public static void main(String[] args) throws IOException, ISOException {
        createISOMessage();
    }

    public static byte[] createISOMessage() throws ISOException {
        Thread t;
        String HOST = "127.0.0.1";
        int PORT = 9300;
        ISOServer server;        
        Logger l = new Logger();
        l.addListener(new SimpleLogListener());

        // Create Packager based on XML that contain DE type
        GenericPackager packager = new GenericPackager("resources/fields.xml");

        NACChannel nacchannel = new NACChannel();
        nacchannel.setLogger(l, "channel");
        nacchannel.setHost(HOST, PORT);

        ISOMsg isoMsg = build200ISOMessage(packager);
 
        byte[] message = isoMsg.pack();
        try {
            nacchannel.setPackager(packager);
            SimpleConfiguration cfg = new SimpleConfiguration();
            cfg.put("include-header-length", Boolean.TRUE);
            nacchannel.setConfiguration(cfg);
            nacchannel.connect();
            nacchannel.send(isoMsg);
            if (nacchannel.isConnected()) {
                System.out.println("Connected");
                ISOMsg isoMsgResp = nacchannel.receive();                         // Getting EOFException here
                System.out.println("isoMsgResp "+isoMsgResp);
            }
        } catch (Exception e) {
            System.out.println("Exception in sending msg");
            e.printStackTrace();
        }
        return message;

    }
   
    private static ISOMsg build200ISOMessage(ISOBasePackager packager) throws ISOException {
        // Create ISO Message
        ISOMsg isoMsg = new ISOMsg();
        isoMsg.setPackager(packager);
        isoMsg.setMTI("0100");
        isoMsg.set("2", "6006491286999980958");
        isoMsg.set("3", "310000");
        isoMsg.set("4", "000000000000");
        isoMsg.set("11", "020820");
        isoMsg.set("12", "020820");
        isoMsg.set("13", "0120");

        isoMsg.set("32", "061286");
        isoMsg.set("41", "RoxTest1");
        isoMsg.set("42", "999999999900000");
        isoMsg.set("49", "840");
        return isoMsg;
    }

}

Result Netcat server:

00000000  00 45 30 31 30 30 70 38  00 01 00 c0 80 00 13 06  |.E0100p8........|             --> Length is showing as '00 45' instead it should be '00 47'

00000010  00 64 91 28 69 99 98 09  58 31 00 00 00 00 00 00  |.d.(i...X1......|
00000020  00 00 02 08 20 02 08 20  01 20 06 06 12 86 52 6f  |.... .. . ....Ro|
00000030  78 54 65 73 74 31 39 39  39 39 39 39 39 39 39 39  |xTest19999999999|      --> Showing upto here until Java application shutdown
00000040  30 30 30 30 30 08 40                              |00000.@|                                        --> Once Java application shutdown(Eclipse Terminate) then showing this line of output
00000047


2. Code using ISOServer as server :

import java.io.IOException;
import org.jpos.core.Configuration;
import org.jpos.core.ConfigurationException;
import org.jpos.core.SimpleConfiguration;
import org.jpos.iso.ISOBasePackager;
import org.jpos.iso.ISOException;
import org.jpos.iso.ISOMsg;
import org.jpos.iso.ISOServer;
import org.jpos.iso.ISOUtil;
import org.jpos.iso.channel.NACChannel;
import org.jpos.iso.packager.GenericPackager;
import org.jpos.util.Logger;
import org.jpos.util.SimpleLogListener;
import org.jpos.util.ThreadPool;

public class NACChannelTestChhil {
    int lenlen = 2;
    public static void main(String[] args) throws IOException, ISOException {
        createISOMessage();
    }

    public static byte[] createISOMessage() throws ISOException {
        Thread t;
        String HOST = "127.0.0.1";
        int PORT = 9300;
        ISOServer server;        
        Logger l = new Logger();
        l.addListener(new SimpleLogListener());

        // Create Packager based on XML that contain DE type
        GenericPackager packager = new GenericPackager("resources/fields.xml");

        NACChannel nacchannel = new NACChannel();
        nacchannel.setLogger(l, "channel");
        nacchannel.setHost(HOST, PORT);

        ISOMsg isoMsg = build200ISOMessage(packager);
 
        byte[] message = isoMsg.pack();
        try {
            nacchannel.setPackager(packager);
            SimpleConfiguration cfg = new SimpleConfiguration();
            cfg.put("include-header-length", Boolean.TRUE);
            nacchannel.setConfiguration(cfg);

            server = new ISOServer(PORT, nacchannel, new ThreadPool());
            server.setLogger(l, "server");            

            server.addISORequestListener((source, m) -> {
                try {
                    m.setResponseMTI();
                    m.dump(System.out, "Received");
                    source.send(m);
                    return false;
                }
                catch (ISOException | IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
                return false;            
            });            

            t = new Thread(server);
            t.start();

            nacchannel.connect();
            nacchannel.send(isoMsg);
            if (nacchannel.isConnected()) {
                System.out.println("Connected");
                ISOMsg isoMsgResp = nacchannel.receive();                        
                System.out.println("isoMsgResp "+isoMsgResp);
            }
        } catch (Exception e) {
            System.out.println("Exception in sending msg");
            e.printStackTrace();
        }
        return message;

    }
   
    private static ISOMsg build200ISOMessage(ISOBasePackager packager) throws ISOException {
        // Create ISO Message
        ISOMsg isoMsg = new ISOMsg();
        isoMsg.setPackager(packager);
        isoMsg.setMTI("0100");
        isoMsg.set("2", "6006491286999980958");
        isoMsg.set("3", "310000");
        isoMsg.set("4", "000000000000");
        isoMsg.set("11", "020820");
        isoMsg.set("12", "020820");
        isoMsg.set("13", "0120");

        isoMsg.set("32", "061286");
        isoMsg.set("41", "RoxTest1");
        isoMsg.set("42", "999999999900000");
        isoMsg.set("49", "840");
        return isoMsg;
    }

}

Result :-
<log realm="server" at="2020-01-21T11:32:49.267">
  <iso-server>
    listening on port 9300
  </iso-server>
</log>
<log realm="channel/127.0.0.1:9300" at="2020-01-21T11:32:49.280" lifespan="14ms">
  <connect>
    Try 0 127.0.0.1:9300
  </connect>
</log>
<log realm="channel/127.0.0.1:9300" at="2020-01-21T11:32:49.280">

  <send>
    <isomsg direction="outgoing">
      <!-- org.jpos.iso.packager.GenericPackager[resources/fields.xml] -->
      <field id="0" value="0100"/>
      <field id="2" value="6006491286999980958"/>
      <field id="3" value="310000"/>
      <field id="4" value="000000000000"/>
      <field id="11" value="020820"/>
      <field id="12" value="020820"/>
      <field id="13" value="0120"/>

      <field id="32" value="061286"/>
      <field id="41" value="RoxTest1"/>

      <field id="42" value="999999999900000"/>
      <field id="49" value="840"/>
    </isomsg>
  </send>
</log>
Connected
<log realm="server.session/127.0.0.1:42968" at="2020-01-21T11:32:49.280">
  <session-start/>
</log>
<log realm="channel/127.0.0.1:42968" at="2020-01-21T11:32:49.281">
  <receive>
    <isomsg direction="incoming">
      <!-- org.jpos.iso.packager.GenericPackager[resources/fields.xml] -->

      <field id="0" value="0100"/>
      <field id="2" value="6006491286999980958"/>
      <field id="3" value="310000"/>
      <field id="4" value="000000000000"/>
      <field id="11" value="020820"/>
      <field id="12" value="020820"/>
      <field id="13" value="0120"/>

      <field id="32" value="061286"/>
      <field id="41" value="RoxTest1"/>

      <field id="42" value="999999999900000"/>
      <field id="49" value="840"/>
    </isomsg>
  </receive>
</log>
Received<isomsg direction="incoming">
Received  <!-- org.jpos.iso.packager.GenericPackager[resources/fields.xml] -->
Received  <field id="0" value="0110"/>
Received  <field id="2" value="6006491286999980958"/>
Received  <field id="3" value="310000"/>
Received  <field id="4" value="000000000000"/>
Received  <field id="11" value="020820"/>
Received  <field id="12" value="020820"/>
Received  <field id="13" value="0120"/>
Received  <field id="32" value="061286"/>
Received  <field id="41" value="RoxTest1"/>
Received  <field id="42" value="999999999900000"/>
Received  <field id="49" value="840"/>
Received</isomsg>
<log realm="channel/127.0.0.1:42968" at="2020-01-21T11:32:49.282" lifespan="1ms">

  <send>
    <isomsg direction="outgoing">
      <!-- org.jpos.iso.packager.GenericPackager[resources/fields.xml] -->
      <field id="0" value="0110"/>

      <field id="2" value="6006491286999980958"/>
      <field id="3" value="310000"/>
      <field id="4" value="000000000000"/>
      <field id="11" value="020820"/>
      <field id="12" value="020820"/>
      <field id="13" value="0120"/>

      <field id="32" value="061286"/>
      <field id="41" value="RoxTest1"/>

      <field id="42" value="999999999900000"/>
      <field id="49" value="840"/>
    </isomsg>
  </send>
</log>
<log realm="channel/127.0.0.1:9300" at="2020-01-21T11:32:49.282" lifespan="2ms">
  <receive>
    <isomsg direction="incoming">
      <!-- org.jpos.iso.packager.GenericPackager[resources/fields.xml] -->
      <field id="0" value="0110"/>

      <field id="2" value="6006491286999980958"/>
      <field id="3" value="310000"/>
      <field id="4" value="000000000000"/>
      <field id="11" value="020820"/>
      <field id="12" value="020820"/>
      <field id="13" value="0120"/>

      <field id="32" value="061286"/>
      <field id="41" value="RoxTest1"/>

      <field id="42" value="999999999900000"/>
      <field id="49" value="840"/>
    </isomsg>
  </receive>
</log>
isoMsgResp  In: 0110 020820 RoxTest1

3. Code using Netcat as server(overriding sendMessageLength and getMessageLength methods) :

import org.jpos.core.SimpleConfiguration;
import org.jpos.iso.ISOException;
import org.jpos.iso.ISOMsg;
import org.jpos.iso.ISOServer;
import org.jpos.iso.packager.GenericPackager;
import java.io.*;
import org.jpos.iso.channel.NACChannel;
import org.jpos.iso.ISOBasePackager;
import org.jpos.util.Logger;
import org.jpos.util.SimpleLogListener;
import org.jpos.util.ThreadPool;

public class NACChannelTest extends NACChannel {
int lenlen = 0;
public static void main(String[] args) throws IOException, ISOException {
   createISOMessage();
}

public static byte[] createISOMessage() throws ISOException {
String HOST = "127.0.0.1";
int PORT = 9300;
ISOServer server;
Thread t;

Logger l = new Logger();
        l.addListener(new SimpleLogListener());

       
// Create Packager based on XML that contain DE type
   ISOBasePackager packager = new GenericPackager("resources/fields.xml");    
   
   NACChannelTest nacchannel = new NACChannelTest();    
   nacchannel.setHost(HOST, PORT);    
   nacchannel.setLogger(l, "channel");
   
   ISOMsg isoMsg = build200ISOMessage(packager);    
   
   // Get and print the output result
   byte[] message = isoMsg.pack();
   
   try {
nacchannel.setPackager(isoMsg.getPackager());

SimpleConfiguration cfg = new SimpleConfiguration();
            cfg.put("include-header-length", Boolean.TRUE);
            nacchannel.setConfiguration(cfg);

nacchannel.connect();        
nacchannel.send(isoMsg);        
if (nacchannel.isConnected()) {
System.out.println("Connected");
nacchannel.getMessageLength();
ISOMsg isoMsgResp = nacchannel.receive();                                       // Getting EOFException here
System.out.println("isoMsgResp "+isoMsgResp);
}

   } catch (Exception e) {
    System.out.println("Exception in sending msg");
    e.printStackTrace();
   }
   return message;
}

protected void sendMessageLength(int len) throws IOException {
len += 2;
serverOut.write (len >> 8);
        serverOut.write (len);
        serverOut.flush();
    }

protected int getMessageLength() throws IOException, ISOException {
int l = 0;
byte[] b = new byte[2];
while (l == 0) {
System.out.println("Avail "+serverIn.available());                                                 // "Avail 0" is printing here
serverIn.readFully(b, 0, 2);                                                                                   // EOFException he      
   l = ((((int) b[0]) & 0xFF) << 8) | (((int) b[1]) & 0xFF);
   if (l == 0) {
       serverOut.write(b);
       serverOut.flush();
   }
}
return l;

}

private static ISOMsg build200ISOMessage(ISOBasePackager packager) throws ISOException {
   // Create ISO Message
   ISOMsg isoMsg = new ISOMsg();
   isoMsg.setPackager(packager);
   isoMsg.setMTI("0100");
   isoMsg.set("2", "6006491286999980958");
   isoMsg.set("3", "310000");
   isoMsg.set("4", "000000000000");
   isoMsg.set("11", "044620");
   isoMsg.set("12", "044620");
   isoMsg.set("13", "0117");

   isoMsg.set("32", "061286");
   isoMsg.set("41", "RoxTest1");
   isoMsg.set("42", "999999999900000");
   isoMsg.set("49", "840");    return isoMsg;
}

private static void logISOMsg(ISOMsg msg) {
   System.out.println("----ISO MESSAGE-----");
   try {
System.out.println("  MTI : " + msg.getMTI());
for (int i = 1; i <= msg.getMaxField(); i++) {
   if (msg.hasField(i)) {
       System.out.println("    Field-" + i + " : "
               + msg.getString(i));
   }
}
   } catch (ISOException e) {
    e.printStackTrace();
   } finally {
    System.out.println("--------------------");
   }
}

}



My packager xml file :

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE isopackager PUBLIC
        "-//jPOS/jPOS Generic Packager DTD 1.0//EN"
        "http://jpos.org/dtd/generic-packager-1.0.dtd">

<!-- ISO 8583:1987 (BINARY) field descriptions for GenericPackager -->

<isopackager>
  <isofield
      id="0"
      length="4"
      name="MESSAGE TYPE INDICATOR"
      pad="true"
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="1"
      length="16"
      name="BIT MAP"
      class="org.jpos.iso.IFB_BITMAP"/>
  <isofield
      id="2"
      length="19"
      name="PAN - PRIMARY ACCOUNT NUMBER"
      pad="true"
      class="org.jpos.iso.IFB_LLHNUM"/>
  <isofield
      id="3"
      length="6"
      name="PROCESSING CODE"
      pad="true"
      class="org.jpos.iso.IFB_NUMERIC"/>
  <isofield
      id="4"
      length="12"
      name="AMOUNT, TRANSACTION"
      pad="true"
      class="org.jpos.iso.IFB_NUMERIC"/>
  <isofield
      id="5"
      length="12"
      name="AMOUNT, SETTLEMENT"
      pad="true"
      class="org.jpos.iso.IFB_NUMERIC"/>
  <isofield
      id="6"
      length="12"
      name="AMOUNT, CARDHOLDER BILLING"
      pad="true"
      class="org.jpos.iso.IFB_NUMERIC"/>
  <isofield
      id="7"
      length="10"
      name="TRANSMISSION DATE AND TIME"
      pad="true"
      class="org.jpos.iso.IFB_NUMERIC"/>
  <isofield
      id="8"
      length="8"
      name="AMOUNT, CARDHOLDER BILLING FEE"
      pad="true"
      class="org.jpos.iso.IFB_NUMERIC"/>
  <isofield
      id="9"
      length="8"
      name="CONVERSION RATE, SETTLEMENT"
      pad="true"
      class="org.jpos.iso.IFB_NUMERIC"/>
  <isofield
      id="10"
      length="8"
      name="CONVERSION RATE, CARDHOLDER BILLING"
      pad="true"
      class="org.jpos.iso.IFB_NUMERIC"/>
  <isofield
      id="11"
      length="6"
      name="SYSTEM TRACE AUDIT NUMBER"
      pad="true"
      class="org.jpos.iso.IFB_NUMERIC"/>
  <isofield
      id="12"
      length="6"
      name="TIME, LOCAL TRANSACTION"
      pad="true"
      class="org.jpos.iso.IFB_NUMERIC"/>
  <isofield
      id="13"
      length="4"
      name="DATE, LOCAL TRANSACTION"
      pad="true"
      class="org.jpos.iso.IFB_NUMERIC"/>
  <isofield
      id="14"
      length="4"
      name="DATE, EXPIRATION"
      pad="true"
      class="org.jpos.iso.IFB_NUMERIC"/>
  <isofield
      id="15"
      length="4"
      name="DATE, SETTLEMENT"
      pad="true"
      class="org.jpos.iso.IFB_NUMERIC"/>
  <isofield
      id="16"
      length="4"
      name="DATE, CONVERSION"
      pad="true"
      class="org.jpos.iso.IFB_NUMERIC"/>
  <isofield
      id="17"
      length="4"
      name="DATE, CAPTURE"
      pad="true"
      class="org.jpos.iso.IFB_NUMERIC"/>
  <isofield
      id="18"
      length="4"
      name="MERCHANTS TYPE"
      pad="true"
      class="org.jpos.iso.IFB_NUMERIC"/>
  <isofield
      id="19"
      length="3"
      name="ACQUIRING INSTITUTION COUNTRY CODE"
      pad="true"
      class="org.jpos.iso.IFB_NUMERIC"/>
  <isofield
      id="20"
      length="3"
      name="PAN EXTENDED COUNTRY CODE"
      pad="true"
      class="org.jpos.iso.IFB_NUMERIC"/>
  <isofield
      id="21"
      length="3"
      name="FORWARDING INSTITUTION COUNTRY CODE"
      pad="true"
      class="org.jpos.iso.IFB_NUMERIC"/>
  <isofield
      id="22"
      length="3"
      name="POINT OF SERVICE ENTRY MODE"
      pad="true"
      class="org.jpos.iso.IFB_NUMERIC"/>
  <isofield
      id="23"
      length="3"
      name="CARD SEQUENCE NUMBER"
      pad="true"
      class="org.jpos.iso.IFB_NUMERIC"/>
  <isofield
      id="24"
      length="3"
      name="NETWORK INTERNATIONAL IDENTIFIEER"
      pad="true"
      class="org.jpos.iso.IFB_NUMERIC"/>
  <isofield
      id="25"
      length="2"
      name="POINT OF SERVICE CONDITION CODE"
      pad="true"
      class="org.jpos.iso.IFB_NUMERIC"/>
  <isofield
      id="26"
      length="2"
      name="POINT OF SERVICE PIN CAPTURE CODE"
      pad="true"
      class="org.jpos.iso.IFB_NUMERIC"/>
  <isofield
      id="27"
      length="1"
      name="AUTHORIZATION IDENTIFICATION RESP LEN"
      pad="true"
      class="org.jpos.iso.IFB_NUMERIC"/>
  <isofield
      id="28"
      length="9"
      name="AMOUNT, TRANSACTION FEE"
      pad="true"
      class="org.jpos.iso.IFB_AMOUNT"/>
  <isofield
      id="29"
      length="9"
      name="AMOUNT, SETTLEMENT FEE"
      pad="true"
      class="org.jpos.iso.IFB_AMOUNT"/>
  <isofield
      id="30"
      length="9"
      name="AMOUNT, TRANSACTION PROCESSING FEE"
      pad="true"
      class="org.jpos.iso.IFB_AMOUNT"/>
  <isofield
      id="31"
      length="9"
      name="AMOUNT, SETTLEMENT PROCESSING FEE"
      pad="true"
      class="org.jpos.iso.IFB_AMOUNT"/>
  <isofield
      id="32"
      length="11"
      name="ACQUIRING INSTITUTION IDENT CODE"
      pad="true"
      class="org.jpos.iso.IFB_LLHNUM"/>
  <isofield
      id="33"
      length="11"
      name="FORWARDING INSTITUTION IDENT CODE"
      pad="false"
      class="org.jpos.iso.IFB_LLNUM"/>
  <isofield
      id="34"
      length="28"
      name="PAN EXTENDED"
      class="org.jpos.iso.IFB_LLCHAR"/>
  <isofield
      id="35"
      length="37"
      name="TRACK 2 DATA"
      pad="false"
      class="org.jpos.iso.IFB_LLNUM"/>
  <isofield
      id="36"
      length="104"
      name="TRACK 3 DATA"
      class="org.jpos.iso.IFB_LLLCHAR"/>
  <isofield
      id="37"
      length="12"
      name="RETRIEVAL REFERENCE NUMBER"
      class="org.jpos.iso.IF_CHAR"/>
  <isofield
      id="38"
      length="6"
      name="AUTHORIZATION IDENTIFICATION RESPONSE"
      class="org.jpos.iso.IF_CHAR"/>
  <isofield
      id="39"
      length="2"
      name="RESPONSE CODE"
      class="org.jpos.iso.IF_CHAR"/>
  <isofield
      id="40"
      length="3"
      name="SERVICE RESTRICTION CODE"
      class="org.jpos.iso.IF_CHAR"/>
  <isofield
      id="41"
      length="8"
      name="CARD ACCEPTOR TERMINAL IDENTIFICACION"
      class="org.jpos.iso.IF_CHAR"/>
  <isofield
      id="42"
      length="15"
      name="CARD ACCEPTOR IDENTIFICATION CODE"
      class="org.jpos.iso.IF_CHAR"/>
  <isofield
      id="43"
      length="40"
      name="CARD ACCEPTOR NAME/LOCATION"
      class="org.jpos.iso.IF_CHAR"/>
  <isofield
      id="44"
      length="25"
      name="ADITIONAL RESPONSE DATA"
      class="org.jpos.iso.IFB_LLCHAR"/>
  <isofield
      id="45"
      length="76"
      name="TRACK 1 DATA"
      class="org.jpos.iso.IFB_LLCHAR"/>
  <isofield
      id="46"
      length="999"
      name="ADITIONAL DATA - ISO"
      class="org.jpos.iso.IFB_LLLCHAR"/>
  <isofield
      id="47"
      length="999"
      name="ADITIONAL DATA - NATIONAL"
      class="org.jpos.iso.IFB_LLLCHAR"/>
  <isofield
      id="48"
      length="999"
      name="ADITIONAL DATA - PRIVATE"
      class="org.jpos.iso.IFB_LLLCHAR"/>
  <isofield
      id="49"
      length="3"
      name="CURRENCY CODE, TRANSACTION"
      pad="true"
      class="org.jpos.iso.IFB_NUMERIC"/>
  <isofield
      id="50"
      length="3"
      name="CURRENCY CODE, SETTLEMENT"
      class="org.jpos.iso.IF_CHAR"/>
  <isofield
      id="51"
      length="3"
      name="CURRENCY CODE, CARDHOLDER BILLING"
      class="org.jpos.iso.IF_CHAR"/>
  <isofield
      id="52"
      length="8"
      name="PIN DATA"
      class="org.jpos.iso.IFB_BINARY"/>
  <isofield
      id="53"
      length="16"
      name="SECURITY RELATED CONTROL INFORMATION"
      pad="true"
      class="org.jpos.iso.IFB_NUMERIC"/>
  <isofield
      id="54"
      length="120"
      name="ADDITIONAL AMOUNTS"
      class="org.jpos.iso.IFB_LLLCHAR"/>
  <isofield
      id="55"
      length="999"
      name="RESERVED ISO"
      class="org.jpos.iso.IFB_LLLBINARY"/>
  <isofield
      id="56"
      length="999"
      name="RESERVED ISO"
      class="org.jpos.iso.IFB_LLLCHAR"/>
  <isofield
      id="57"
      length="999"
      name="RESERVED NATIONAL"
      class="org.jpos.iso.IFB_LLLCHAR"/>
  <isofield
      id="58"
      length="999"
      name="RESERVED NATIONAL"
      class="org.jpos.iso.IFB_LLLCHAR"/>
  <isofield
      id="59"
      length="999"
      name="RESERVED NATIONAL"
      class="org.jpos.iso.IFB_LLLCHAR"/>
  <isofield
      id="60"
      length="999"
      name="RESERVED PRIVATE"
      class="org.jpos.iso.IFB_LLLCHAR"/>
  <isofield
      id="61"
      length="999"
      name="RESERVED PRIVATE"
      class="org.jpos.iso.IFB_LLLCHAR"/>
  <isofield
      id="62"
      length="999"
      name="RESERVED PRIVATE"
      class="org.jpos.iso.IFB_LLLCHAR"/>
  <isofield
      id="63"
      length="999"
      name="RESERVED PRIVATE"
      class="org.jpos.iso.IFB_LLLCHAR"/>
  <isofield
      id="64"
      length="8"
      name="MESSAGE AUTHENTICATION CODE FIELD"
      class="org.jpos.iso.IFB_BINARY"/>
  <isofield
      id="65"
      length="1"
      name="BITMAP, EXTENDED"
      class="org.jpos.iso.IFB_BINARY"/>
  <isofield
      id="66"
      length="1"
      name="SETTLEMENT CODE"
      pad="true"
      class="org.jpos.iso.IFB_NUMERIC"/>
  <isofield
      id="67"
      length="2"
      name="EXTENDED PAYMENT CODE"
      pad="true"
      class="org.jpos.iso.IFB_NUMERIC"/>
  <isofield
      id="68"
      length="3"
      name="RECEIVING INSTITUTION COUNTRY CODE"
      pad="true"
      class="org.jpos.iso.IFB_NUMERIC"/>
  <isofield
      id="69"
      length="3"
      name="SETTLEMENT INSTITUTION COUNTRY CODE"
      pad="true"
      class="org.jpos.iso.IFB_NUMERIC"/>
  <isofield
      id="70"
      length="3"
      name="NETWORK MANAGEMENT INFORMATION CODE"
      pad="true"
      class="org.jpos.iso.IFB_NUMERIC"/>
  <isofield
      id="71"
      length="4"
      name="MESSAGE NUMBER"
      pad="true"
      class="org.jpos.iso.IFB_NUMERIC"/>
  <isofield
      id="72"
      length="4"
      name="MESSAGE NUMBER LAST"
      pad="true"
      class="org.jpos.iso.IFB_NUMERIC"/>
  <isofield
      id="73"
      length="6"
      name="DATE ACTION"
      pad="true"
      class="org.jpos.iso.IFB_NUMERIC"/>
  <isofield
      id="74"
      length="10"
      name="CREDITS NUMBER"
      pad="true"
      class="org.jpos.iso.IFB_NUMERIC"/>
  <isofield
      id="75"
      length="10"
      name="CREDITS REVERSAL NUMBER"
      pad="true"
      class="org.jpos.iso.IFB_NUMERIC"/>
  <isofield
      id="76"
      length="10"
      name="DEBITS NUMBER"
      pad="true"
      class="org.jpos.iso.IFB_NUMERIC"/>
  <isofield
      id="77"
      length="10"
      name="DEBITS REVERSAL NUMBER"
      pad="true"
      class="org.jpos.iso.IFB_NUMERIC"/>
  <isofield
      id="78"
      length="10"
      name="TRANSFER NUMBER"
      pad="true"
      class="org.jpos.iso.IFB_NUMERIC"/>
  <isofield
      id="79"
      length="10"
      name="TRANSFER REVERSAL NUMBER"
      pad="true"
      class="org.jpos.iso.IFB_NUMERIC"/>
  <isofield
      id="80"
      length="10"
      name="INQUIRIES NUMBER"
      pad="true"
      class="org.jpos.iso.IFB_NUMERIC"/>
  <isofield
      id="81"
      length="10"
      name="AUTHORIZATION NUMBER"
      pad="true"
      class="org.jpos.iso.IFB_NUMERIC"/>
  <isofield
      id="82"
      length="12"
      name="CREDITS, PROCESSING FEE AMOUNT"
      pad="true"
      class="org.jpos.iso.IFB_NUMERIC"/>
  <isofield
      id="83"
      length="12"
      name="CREDITS, TRANSACTION FEE AMOUNT"
      pad="true"
      class="org.jpos.iso.IFB_NUMERIC"/>
  <isofield
      id="84"
      length="12"
      name="DEBITS, PROCESSING FEE AMOUNT"
      pad="true"
      class="org.jpos.iso.IFB_NUMERIC"/>
  <isofield
      id="85"
      length="12"
      name="DEBITS, TRANSACTION FEE AMOUNT"
      pad="true"
      class="org.jpos.iso.IFB_NUMERIC"/>
  <isofield
      id="86"
      length="16"
      name="CREDITS, AMOUNT"
      pad="true"
      class="org.jpos.iso.IFB_NUMERIC"/>
  <isofield
      id="87"
      length="16"
      name="CREDITS, REVERSAL AMOUNT"
      pad="true"
      class="org.jpos.iso.IFB_NUMERIC"/>
  <isofield
      id="88"
      length="16"
      name="DEBITS, AMOUNT"
      pad="true"
      class="org.jpos.iso.IFB_NUMERIC"/>
  <isofield
      id="89"
      length="16"
      name="DEBITS, REVERSAL AMOUNT"
      pad="true"
      class="org.jpos.iso.IFB_NUMERIC"/>
  <isofield
      id="90"
      length="42"
      name="ORIGINAL DATA ELEMENTS"
      pad="true"
      class="org.jpos.iso.IFB_NUMERIC"/>
  <isofield
      id="91"
      length="1"
      name="FILE UPDATE CODE"
      class="org.jpos.iso.IF_CHAR"/>
  <isofield
      id="92"
      length="2"
      name="FILE SECURITY CODE"
      class="org.jpos.iso.IF_CHAR"/>
  <isofield
      id="93"
      length="6"
      name="RESPONSE INDICATOR"
      class="org.jpos.iso.IF_CHAR"/>
  <isofield
      id="94"
      length="7"
      name="SERVICE INDICATOR"
      class="org.jpos.iso.IF_CHAR"/>
  <isofield
      id="95"
      length="42"
      name="REPLACEMENT AMOUNTS"
      class="org.jpos.iso.IF_CHAR"/>
  <isofield
      id="96"
      length="16"
      name="MESSAGE SECURITY CODE"
      class="org.jpos.iso.IFB_BINARY"/>
  <isofield
      id="97"
      length="17"
      name="AMOUNT, NET SETTLEMENT"
      pad="false"
      class="org.jpos.iso.IFB_AMOUNT"/>
  <isofield
      id="98"
      length="25"
      name="PAYEE"
      class="org.jpos.iso.IF_CHAR"/>
  <isofield
      id="99"
      length="11"
      name="SETTLEMENT INSTITUTION IDENT CODE"
      pad="false"
      class="org.jpos.iso.IFB_LLNUM"/>
  <isofield
      id="100"
      length="11"
      name="RECEIVING INSTITUTION IDENT CODE"
      pad="false"
      class="org.jpos.iso.IFB_LLNUM"/>
  <isofield
      id="101"
      length="17"
      name="FILE NAME"
      class="org.jpos.iso.IFB_LLCHAR"/>
  <isofield
      id="102"
      length="28"
      name="ACCOUNT IDENTIFICATION 1"
      class="org.jpos.iso.IFB_LLCHAR"/>
  <isofield
      id="103"
      length="28"
      name="ACCOUNT IDENTIFICATION 2"
      class="org.jpos.iso.IFB_LLCHAR"/>
  <isofield
      id="104"
      length="100"
      name="TRANSACTION DESCRIPTION"
      class="org.jpos.iso.IFB_LLLCHAR"/>
  <isofield
      id="105"
      length="999"
      name="RESERVED ISO USE"
      class="org.jpos.iso.IFB_LLLCHAR"/>
  <isofield
      id="106"
      length="999"
      name="RESERVED ISO USE"
      class="org.jpos.iso.IFB_LLLCHAR"/>
  <isofield
      id="107"
      length="999"
      name="RESERVED ISO USE"
      class="org.jpos.iso.IFB_LLLCHAR"/>
  <isofield
      id="108"
      length="999"
      name="RESERVED ISO USE"
      class="org.jpos.iso.IFB_LLLCHAR"/>
  <isofield
      id="109"
      length="999"
      name="RESERVED ISO USE"
      class="org.jpos.iso.IFB_LLLCHAR"/>
  <isofield
      id="110"
      length="999"
      name="RESERVED ISO USE"
      class="org.jpos.iso.IFB_LLLCHAR"/>
  <isofield
      id="111"
      length="999"
      name="RESERVED ISO USE"
      class="org.jpos.iso.IFB_LLLCHAR"/>
  <isofield
      id="112"
      length="999"
      name="RESERVED NATIONAL USE"
      class="org.jpos.iso.IFB_LLLCHAR"/>
  <isofield
      id="113"
      length="999"
      name="RESERVED NATIONAL USE"
      class="org.jpos.iso.IFB_LLLCHAR"/>
  <isofield
      id="114"
      length="999"
      name="RESERVED NATIONAL USE"
      class="org.jpos.iso.IFB_LLLCHAR"/>
  <isofield
      id="115"
      length="999"
      name="RESERVED NATIONAL USE"
      class="org.jpos.iso.IFB_LLLCHAR"/>
  <isofield
      id="116"
      length="999"
      name="RESERVED NATIONAL USE"
      class="org.jpos.iso.IFB_LLLCHAR"/>
  <isofield
      id="117"
      length="999"
      name="RESERVED NATIONAL USE"
      class="org.jpos.iso.IFB_LLLCHAR"/>
  <isofield
      id="118"
      length="999"
      name="RESERVED NATIONAL USE"
      class="org.jpos.iso.IFB_LLLCHAR"/>
  <isofield
      id="119"
      length="999"
      name="RESERVED NATIONAL USE"
      class="org.jpos.iso.IFB_LLLCHAR"/>
  <isofield
      id="120"
      length="999"
      name="RESERVED PRIVATE USE"
      class="org.jpos.iso.IFB_LLLCHAR"/>
  <isofield
      id="121"
      length="999"
      name="RESERVED PRIVATE USE"
      class="org.jpos.iso.IFB_LLLCHAR"/>
  <isofield
      id="122"
      length="999"
      name="RESERVED PRIVATE USE"
      class="org.jpos.iso.IFB_LLLCHAR"/>
  <isofield
      id="123"
      length="999"
      name="RESERVED PRIVATE USE"
      class="org.jpos.iso.IFB_LLLCHAR"/>
  <isofield
      id="124"
      length="999"
      name="RESERVED PRIVATE USE"
      class="org.jpos.iso.IFB_LLLCHAR"/>
  <isofield
      id="125"
      length="999"
      name="RESERVED PRIVATE USE"
      class="org.jpos.iso.IFB_LLLCHAR"/>
  <isofield
      id="126"
      length="999"
      name="RESERVED PRIVATE USE"
      class="org.jpos.iso.IFB_LLLCHAR"/>
  <isofield
      id="127"
      length="999"
      name="RESERVED PRIVATE USE"
      class="org.jpos.iso.IFB_LLLCHAR"/>
  <isofield
      id="128"
      length="8"
      name="MAC 2"
      class="org.jpos.iso.IFB_BINARY"/>
</isopackager>

Please check and update what I am doing wrong.

Thanks,
Shareef

--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage. Please support jPOS, contact: sa...@jpos.org
---
You received this message because you are subscribed to the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/CAAgSK%3D%3Djbz2x1yNNTnvg4K7xzxMT92M4T4EqEVWsH884nmyUEA%40mail.gmail.com.

Alejandro Revilla

unread,
Jan 21, 2020, 4:06:27 PM1/21/20
to jPOS Users
You want to use the regular NACChannel and set the 'include-header-length' to true in your configuration.

I suggest you take a look at http://jpos.org/tutorials, your life will be much easier.

You just need to add:

   <property name="include-header-length" value="true" />

to your NACChannel config.



Shareefuddin Mohammed

unread,
Jan 23, 2020, 6:49:22 AM1/23/20
to jpos-...@googlegroups.com
Hi Alejandro and Chhil,

Thanks for helping me !!!

Able to prepare required format and send it to server, but still server unable to recognize the format.

image.png

Getting [AR] from them so checking with them the root cause.

I have a doubt : Is NACChannel sends request in hex format?

Regards,
Shareef


Alejandro Revilla

unread,
Feb 8, 2020, 5:06:38 PM2/8/20
to jPOS Users

I have a doubt : Is NACChannel sends request in hex format?

NACChannel sends the length as two bytes in network byte order (also called BIG ENDIAN).

HEXChannel sends the length in four hexadecimal ASCII characters.
 

chhil

unread,
Feb 9, 2020, 9:30:09 PM2/9/20
to jpos-...@googlegroups.com
Alejandro,
This was resolved in the jpos slack support channel.

To sum up the changes, Shareefuddin used the NACChannel with the include length of length in the length header configuration property.
Then he was told to use stunnel as it needed to be TLS, which worked. 
Following which he added the TLS supported at the channel level to avoid using stunnel.
Finally TLS worked for him in one version of JDK and not in the other and he has been debugging it with java's supported property to log all debug TLS info. Which now is out of the jpos domain and into pure java.

-chhil


--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage. Please support jPOS, contact: sa...@jpos.org
---
You received this message because you are subscribed to the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+...@googlegroups.com.

Shareefuddin Mohammed

unread,
Feb 10, 2020, 1:14:54 AM2/10/20
to jpos-...@googlegroups.com
Hi Alenjandro/Chhil,

Thanks for helping.
Issue has been fixed using JPOS_2.1.3 and Java 8 and I am using Java 8.

I'll contact Constantino for JPOS license..

Regards,
Shareef



Reply all
Reply to author
Forward
0 new messages