Always getting error while unpacking the Switch response into ISO message

999 views
Skip to first unread message

DPR

unread,
Jul 9, 2016, 11:44:32 AM7/9/16
to jPOS Users
<log realm="channel/XXXXXX" at="Sat Jul 09 20:29:29 IST 2016.530" lifespan="83225ms">
  <receive>
    <iso-exception>
      org.jpos.iso.IFA_LLNUM: Problem unpacking field 32 (org.jpos.iso.ISOException: Field length 91 too long. Max: 11) unpacking field=32, consumed=105
      org.jpos.iso.ISOException: org.jpos.iso.IFA_LLNUM: Problem unpacking field 32 (org.jpos.iso.ISOException: Field length 91 too long. Max: 11) unpacking field=32, consumed=105
        at.components.XXXXXFinalPackager.unpack(XXXXXFinalPackager.java:653)
        at .components.XXXXXChannel.receive(XXXXChannel.java:153)
        at org.jpos.q2.iso.ChannelAdaptor$Receiver.run(ChannelAdaptor.java:319)
        at java.lang.Thread.run(Thread.java:744)
    </iso-exception>
    --- header ---
    0000  49 53 4F 37 30 31 30 30  30 30 30 31 32 31 30     ISO701000001210

    --- data ---
    0000  FE 72 00 21 8A C1 E2 08  00 00 00 00 00 00 00 01  .r.!............
0010  31 36 35 32 39 36 31 36  30 30 30 31 36 33 31 36  1652961600016316
0020  30 39 30 30 30 30 30 30  30 30 30 30 30 30 39 39  0900000000000099
0030  39 35 30 30 30 30 30 30  30 30 39 39 39 35 30 30  9500000000999500
0040  30 30 30 30 30 30 39 39  39 35 30 30 31 36 30 37  0000009995001607
0050  30 39 31 34 35 39 36 31  30 30 30 30 30 30 30 30  0914596100000000
0060  36 34 33 32 31 36 30 37  30 39 31 34 35 39 30 35  6432160709145905
0070  31 36 30 37 30 39 36 31  31 30 30 30 30 30 30 30  1607096110000000
0080  30 30 30 30 31 31 30 30  30 30 30 30 30 30 30 30  0000110000000000
0090  30 34 36 38 30 37 36 33  34 35 37 38 36 39 30 39  0468076345786909
00a0  31 30 30 30 30 30 30 31  36 32 37 30 35 35 32 34  1000000162705524
00b0  31 36 32 30 37 30 30 30  34 35 50 30 39 30 30 36  1620700045P09006
00c0  30 30 30 31 39 30 50 36  39 30 31 35 36 32 37 30  000190P690156270
00d0  35 35 32 34 31 36 32 30  37 30 30 50 31 33 30 30  55241620700P1300
00e0  36 30 30 36 34 33 32 30  34 35 33 37 34 30 52 65  60064320453740Re
00f0  30 30 30 30 30 39 30 33  39 30 30 33 20 20 20 58  000009039003   X
0100  58 58 58 30 30 30 30                              XXX0000

  </receive>
</log>

chhil

unread,
Jul 9, 2016, 12:26:40 PM7/9/16
to jPOS Users

It's a misalignment of your packager field definitions. Go field by field to make sure you have defined it correctly.
Were fields prior to this field unpacked properly with correct values?

You can take the hex dump,  convert it to a byte array,  pass it into a isomsg object which has the packaged assigned and unpack it.  In the catch part of the exception you can  dump the isomsg to see till where it was unpacked and if it had the correct values. There are multiple examples in the older posts which you can search for.
Or
Share your packager for users of this from to assist you further.

-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
 
Join us in IRC at http://webchat.freenode.net/?channels=jpos
 
You received this message because you are subscribed to the "jPOS Users" group.
Please see http://jpos.org/wiki/JPOS_Mailing_List_Readme_first
To post to this group, send email to jpos-...@googlegroups.com
To unsubscribe, send email to jpos-users+...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/jpos-users
---
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/e2424f69-dc65-4691-a224-de22920ad673%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mark Salter

unread,
Jul 9, 2016, 1:48:31 PM7/9/16
to jpos-...@googlegroups.com
On 09/07/16 16:44, DPR wrote:
I think your header is probably too long, but as chhil says you need to
choose your channel implementation and packager carefully first.

The MTI might be 1210 and if so has been absorbed into your "header" .

--
Mark

DPR

unread,
Jul 11, 2016, 2:31:38 AM7/11/16
to jPOS Users
Hi Chhil / Mark,


Thank you for your valuable suggestions.I have already took the Response HexaDump message and tried to unpack using ISOMsg.unpack(byte []). The sample application is able to unpack and print the ISO message field wise. But when I use the same response in my original application, it always fails with the above exception. I am pasting the Packager and Channel  class code here. Please help me solve this issue.

package com.xx.xxxxx;

import org.jpos.core.Configurable;
import org.jpos.core.Configuration;
import org.jpos.core.ConfigurationException;
import org.jpos.iso.IF_TBASE;
import org.jpos.iso.ISOBasePackager;
import org.jpos.iso.ISOBitMap;
import org.jpos.iso.ISOBitMapPackager;
import org.jpos.iso.ISOComponent;
import org.jpos.iso.ISOException;
import org.jpos.iso.ISOFieldPackager;
import org.jpos.iso.ISOMsg;
import org.jpos.iso.ISOMsgFieldPackager;
import org.jpos.iso.ISOPackager;
import org.jpos.iso.ISOUtil;
import org.jpos.q2.Q2;
import org.jpos.util.Log;
import org.jpos.util.LogEvent;
import org.jpos.util.LogSource;
import org.jpos.util.Logger;
import org.xml.sax.Attributes;
import org.xml.sax.EntityResolver;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.DefaultHandler;
import org.xml.sax.helpers.XMLReaderFactory;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.Map;
import java.util.Map.Entry;
import java.util.BitSet;
import java.util.Stack;
import java.util.TreeMap;


/**
 * <pre>
 * XXXXFinalPackager uses an XML config file to describe the layout of an ISOMessage
 * The general format is as follows
 * &lt;isopackager&gt;
 *     &lt;isofield 
 *         id="[field id]"
 *         name="[field name]"
 *         length="[max field length]"
 *         class="[org.jpos.iso.IF_*]"
 *         pad="true|false"&gt;  
 *     &lt;/isofield&gt;
 *     ...
 * &lt;/isopackager&gt;
 *
 * Fields that contain subfields can be handled as follows
 * &lt;isofieldpackager
 *     id="[field id]"
 *     name="[field name]"
 *     length="[field length]"
 *     class="[org.jpos.iso.IF_*]"
 *     packager="[org.jpos.iso.packager.*]"&gt;
 *      
 *     &lt;isofield 
 *         id="[subfield id]"
 *         name="[subfield name]"
 *         length="[max subfield length]"
 *         class="[org.jpos.iso.IF_*]"
 *         pad="true|false"&gt;
 *     &lt;/isofield&gt;
 *         ...
 * &lt;/isofieldpackager&gt;
 *
 * The optional attributes maxValidField, bitmapField and emitBitmap
 * are allowed on the isopackager node.
 *
 * </pre>
 * @author Eoin Flood
 * @version $Revision$ $Date$
 * @see ISOPackager
 * @see ISOBasePackager
 */

@SuppressWarnings("unchecked")
public class XXXXFinalPackager 
    extends ISOBasePackager implements Configurable
{
   /* Values copied from ISOBasePackager
      These can be changes using attributes on the isopackager node */ 
    private int maxValidField=128;
    private boolean emitBitmap=true;
    private int bitmapField=1;
    private String firstField = null;
    private String filename;
    private Log log;
    
    public XXXXFinalPackager() throws ISOException
    {
        super();
        log = Log.getLog(Q2.LOGGER_NAME, "XXXXFInalPackager");
    log.info ("Inside XXXXFinalPackager");
    }

    /** 
     * Create a XXXXFInalPackager with the field descriptions 
     * from an XML File
     * @param filename The XML field description file
     */
    public XXXXFinalPackager(String filename) throws ISOException
    {
        this.filename = filename;
        readFile(filename);
    }

    /** 
     * Create a XXXXFinalPackager with the field descriptions 
     * from an XML InputStream
     * @param input The XML field description InputStream
     */
    public XXXXFinalPackager(InputStream input) throws ISOException
    {
        readFile(input);
    }

    /**
     * Packager Configuration.
     *
     * <ul>
     *  <li>packager-config
     *  <li>packager-logger
     *  <li>packager-realm
     * </ul>
     *
     * @param cfg Configuration
     */
    public void setConfiguration (Configuration cfg) 
        throws ConfigurationException
    {
        filename = cfg.get("packager-config", null);
        if (filename == null)
            throw new ConfigurationException("packager-config property cannot be null");

        try
        {
            String loggerName = cfg.get("packager-logger");
            if (loggerName != null)
                setLogger(Logger.getLogger (loggerName), 
                           cfg.get ("packager-realm"));
            readFile(filename);
        } catch (ISOException e)
        {
            throw new ConfigurationException(e.getMessage(), e.fillInStackTrace());
        }
    }

    @Override
    protected int getMaxValidField()
    {
        return maxValidField;
    }

    @Override
    protected boolean emitBitMap()
    {
        return emitBitmap;
    }

    @Override
    protected ISOFieldPackager getBitMapfieldPackager()
    {
        return fld[bitmapField];
    }

    /**
     * Parse the field descriptions from an XML file.
     *
     * <pre>
     * Uses the sax parser specified by the system property 'sax.parser'
     * The default parser is org.apache.crimson.parser.XMLReaderImpl
     * </pre>
     * @param filename The XML field description file
     */
    public void readFile(String filename) throws ISOException
    {
        try {
            if (filename.startsWith("jar:") && filename.length()>4) {
                ClassLoader cl = Thread.currentThread().getContextClassLoader();
                readFile(
                    cl.getResourceAsStream(filename.substring(4))
                );
            } else {
                createXMLReader().parse(filename);
            }
        } 
        catch (Exception e) {
            throw new ISOException("Error reading " + filename, e);
        }
    }

    /**
     * Parse the field descriptions from an XML InputStream.
     *
     * <pre>
     * Uses the sax parser specified by the system property 'sax.parser'
     * The default parser is org.apache.crimson.parser.XMLReaderImpl
     * </pre>
     * @param input The XML field description InputStream
     */
    public void readFile(InputStream input) throws ISOException
    {
        try {
            createXMLReader().parse(new InputSource(input));
        } 
        catch (Exception e) {
            throw new ISOException(e);
        }
    }
    @Override
    public void setLogger (Logger logger, String realm) {
        super.setLogger (logger, realm);
        if (fld != null) {
            for (int i=0; i<fld.length; i++) {
                if (fld[i] instanceof ISOMsgFieldPackager) {
                    Object o = ((ISOMsgFieldPackager)fld[i]).getISOMsgPackager();
                    if (o instanceof LogSource) {
                        ((LogSource)o).setLogger (logger, realm + "-fld-" + i);
                    }
                } 
            }
        }
    }
    private XMLReader createXMLReader () throws SAXException {
        XMLReader reader;
        try {
            reader = XMLReaderFactory.createXMLReader();
        } catch (SAXException e) {
            reader = XMLReaderFactory.createXMLReader (
                System.getProperty( 
                    "org.xml.sax.driver", 
                    "org.apache.crimson.parser.XMLReaderImpl"
                )
            );
        }
        reader.setFeature ("http://xml.org/sax/features/validation", true);
        GenericContentHandler handler = new GenericContentHandler();
        reader.setContentHandler(handler);
        reader.setErrorHandler(handler);
        reader.setEntityResolver(new GenericEntityResolver());
        return reader;
    }
    @Override
    public String getDescription () {
        StringBuilder sb = new StringBuilder();
        sb.append (super.getDescription());
        if (filename != null) {
            sb.append ('[');
            sb.append (filename);
            sb.append (']');
        }
        return sb.toString();
    }

    protected void setXXXXFinalPackagerParams (Attributes atts)
    {
        String maxField  = atts.getValue("maxValidField");
        String emitBmap  = atts.getValue("emitBitmap");
        String bmapfield = atts.getValue("bitmapField");
        firstField = atts.getValue("firstField");
        String headerLenStr = atts.getValue("headerLength");

        if (maxField != null)
            maxValidField = Integer.parseInt(maxField); 

        if (emitBmap != null)
            emitBitmap = Boolean.valueOf(emitBmap);

        if (bmapfield != null)
            bitmapField = Integer.parseInt(bmapfield);

        if (firstField != null)
            Integer.parseInt (firstField);  // attempt to parse just to
                                            // force an exception if the
                                            // data is not correct.
        
        if (headerLenStr != null)
        setHeaderLength(Integer.parseInt(headerLenStr));
    }

    public static class GenericEntityResolver implements EntityResolver
    {
        /**
         * Allow the application to resolve external entities.
         * <p/>
         * The strategy we follow is:<p>
         * We first check whether the DTD points to a well defined URI,
         * and resolve to our internal DTDs.<p>
         *
         * If the systemId points to a file, then we attempt to read the 
         * DTD from the filesystem, in case they've been modified by the user.
         * Otherwise, we fallback to the built-in DTDs inside jPOS.<p>
         *
         * @param publicId The public identifier of the external entity
         *                 being referenced, or null if none was supplied.
         * @param systemId The system identifier of the external entity
         *                 being referenced.
         * @return An InputSource object describing the new input source,
         *         or null to request that the parser open a regular
         *         URI connection to the system identifier.
         * @throws org.xml.sax.SAXException Any SAX exception, possibly
         *                                  wrapping another exception.
         * @throws java.io.IOException      A Java-specific IO exception,
         *                                  possibly the result of creating a new InputStream
         *                                  or Reader for the InputSource.
         * @see org.xml.sax.InputSource
         */
        public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException
        {
            if(systemId==null) return null;

            ClassLoader cl =Thread.currentThread().getContextClassLoader();
            cl = cl ==null?ClassLoader.getSystemClassLoader() : cl;

            if(systemId.equals("http://jpos.org/dtd/generic-packager-1.0.dtd"))
            {
                final URL resource = cl.getResource("org/jpos/iso/packager/genericpackager.dtd");
                return new InputSource(resource.toExternalForm());
            }
            else if(systemId.equals("http://jpos.org/dtd/generic-validating-packager-1.0.dtd"))
            {
                final URL resource = cl.getResource("org/jpos/iso/packager/generic-validating-packager.dtd");
                return new InputSource(resource.toExternalForm());
            }

            URL url=new URL(systemId);
            if(url.getProtocol().equals("file"))
            {
                String file=url.getFile();
                if(file.endsWith(".dtd"))
                {
                    File f=new File(file);
                    InputStream res=null;
                    if(f.exists())
                    {
                        res=new FileInputStream(f);
                    }
                    if(res==null)
                    {
                        String dtdResource="org/jpos/iso/packager/"+f.getName();
                        res= cl.getResourceAsStream(dtdResource);
                    }
                    if(res!=null) return new InputSource(res);
                }
            }
            return null;
        }
    }

    public class GenericContentHandler extends DefaultHandler
    {
        private Stack<Object> fieldStack;

        @Override
        public void startDocument()
        {
            fieldStack = new Stack<Object>();
        }

        @Override
        public void endDocument() throws SAXException
        {
            if (!fieldStack.isEmpty())
            {
                throw new SAXException ("Format error in XML Field Description File");
            }
        }

        @Override
        public void startElement(String namespaceURI, String localName, String qName, Attributes atts)
                throws SAXException
        {
            try
            {
                String id   = atts.getValue("id");
                String type = atts.getValue("class");
                String name = atts.getValue("name");
                String size = atts.getValue("length");
                String pad  = atts.getValue("pad");
                // Modified for using IF_TBASE
                String token = atts.getValue("token");

                if (localName.equals("isopackager"))
                {
                    // Stick a new Map on stack to collect the fields
                    fieldStack.push(new TreeMap());

                    setMOROCCOFinalPackagerParams (atts);
                }

                if (localName.equals("isofieldpackager"))
                {
                    /*
                    For a isofield packager node push the following fields
                    onto the stack.
                    1) an Integer indicating the field ID
                    2) an instance of the specified ISOFieldPackager class
                    3) an instance of the specified ISOBasePackager (msgPackager) class
                    4) a Map to collect the subfields
                    */
                    String packager = atts.getValue("packager");

                    fieldStack.push(new Integer(id));

                    ISOFieldPackager f;
                    f = (ISOFieldPackager) Class.forName(type).newInstance();   
                    f.setDescription(name);
                    f.setLength(Integer.parseInt(size));
                    f.setPad(Boolean.parseBoolean(pad));
                    // Modified for using IF_TBASE
                    if( f instanceof IF_TBASE){
                      ((IF_TBASE)f).setToken( token );
                    }
                    fieldStack.push(f);

                    ISOBasePackager p;
                    p = (ISOBasePackager) Class.forName(packager).newInstance();
                    if (p instanceof MOROCCOFinalPackager)
                    {
                        XXXXFInalPackager gp = (XXXXFinalPackager) p;
                        gp.setXXXXFinalPackagerParams (atts);
                    }
                    fieldStack.push(p);

                    fieldStack.push(new TreeMap());
                }

                if (localName.equals("isofield"))
                {
                    Class c = Class.forName(type);
                    ISOFieldPackager f;
                    f = (ISOFieldPackager) c.newInstance();     
                    f.setDescription(name);
                    f.setLength(Integer.parseInt(size));
                    f.setPad(Boolean.parseBoolean(pad));
                    // Modified for using IF_TBASE
                    if( f instanceof IF_TBASE){
                      ((IF_TBASE)f).setToken( token );
                    }
                    // Insert this new isofield into the Map
                    // on the top of the stack using the fieldID as the key
                    Map m = (Map) fieldStack.peek();
                    m.put(new Integer(id), f);
                }
            }
            catch (Exception ex)
            {
                throw new SAXException(ex);
            }
        }

        /**
         * Convert the ISOFieldPackagers in the Map
         * to an array of ISOFieldPackagers
         */
        private ISOFieldPackager[] makeFieldArray(Map<Integer,ISOFieldPackager> m)
        {
            int maxField = 0;

            // First find the largest field number in the Map
            for (Entry<Integer,ISOFieldPackager> ent :m.entrySet())
                if (ent.getKey() > maxField)
                    maxField = ent.getKey();

            // Create the array
            ISOFieldPackager fld[] = new ISOFieldPackager[maxField+1];

            // Populate it
            for (Entry<Integer,ISOFieldPackager> ent :m.entrySet())
               fld[ent.getKey()] = ent.getValue();
            return fld;
        }

        @Override
        public void endElement(String namespaceURI, String localName, String qName)
        {
            Map<Integer,ISOFieldPackager> m;
            if (localName.equals("isopackager"))
            {
                m  = (Map)fieldStack.pop();

                setFieldPackager(makeFieldArray(m));
            }

            if (localName.equals("isofieldpackager"))
            {
                // Pop the 4 entries off the stack in the correct order
                m = (Map)fieldStack.pop();

                ISOBasePackager msgPackager = (ISOBasePackager) fieldStack.pop();
                msgPackager.setFieldPackager (makeFieldArray(m));

                ISOFieldPackager fieldPackager = (ISOFieldPackager) fieldStack.pop();

                Integer fno = (Integer) fieldStack.pop();

                msgPackager.setLogger (getLogger(), getRealm() + "-fld-" + fno);

                // Create the ISOMsgField packager with the retrieved msg and field Packagers
                ISOMsgFieldPackager mfp = 
                    new ISOMsgFieldPackager(fieldPackager, msgPackager);

                // Add the newly created ISOMsgField packager to the
                // lower level field stack

                m=(Map)fieldStack.peek();
                m.put(fno, mfp);
            }
        }

        // ErrorHandler Methods
        @Override
        public void error (SAXParseException ex) throws SAXException
        {
            throw ex;
        }

        @Override
        public void fatalError (SAXParseException ex) throws SAXException
        {
            throw ex;
        }
    }
    @Override
    protected int getFirstField() {
        if (firstField != null)
            return Integer.parseInt (firstField);
        else return super.getFirstField();
    }
    


    /**
     * @param   m   the Container of this message
     * @param   b   ISO message image
     * @return      consumed bytes
     * @exception ISOException
     */
    @Override
    public int unpack (ISOComponent m, byte[] b) throws ISOException {
        LogEvent evt = new LogEvent (this, "unpack");
        int consumed = 0;

        try {
            if (m.getComposite() != m) 
                throw new ISOException ("Can't call packager on non Composite");
            if (logger != null)  // save a few CPU cycle if no logger available
                evt.addMessage (ISOUtil.hexString (b));

            
            // if ISOMsg and headerLength defined 
            if (m instanceof ISOMsg /*&& ((ISOMsg) m).getHeader()==null*/ && headerLength>0) 
            {
            byte[] h = new byte[headerLength];
                System.arraycopy(b, 0, h, 0, headerLength);
            ((ISOMsg) m).setHeader(h);
            consumed += headerLength;
            System.out.println("header = "+ ISOUtil.hexString(h));
            }       
            
            if (!(fld[0] == null) && !(fld[0] instanceof ISOBitMapPackager) && consumed==15)
            {
            consumed = consumed-4;
                ISOComponent mti = fld[0].createComponent(0);
                consumed  += fld[0].unpack(mti, b, consumed);
                m.set (mti);
            }
            
            else if (!(fld[0] == null) && !(fld[0] instanceof ISOBitMapPackager))
            {
                ISOComponent mti = fld[0].createComponent(0);
                consumed  += fld[0].unpack(mti, b, consumed);
                m.set (mti);
            }
            BitSet bmap = null;
            int maxField = fld.length;
            if (emitBitMap()) {
                ISOBitMap bitmap = new ISOBitMap (-1);
                consumed += getBitMapfieldPackager().unpack(bitmap,b,consumed);
                bmap = (BitSet) bitmap.getValue();
                if (logger != null)
                    evt.addMessage ("<bitmap>"+bmap.toString()+"</bitmap>");
                m.set (bitmap);
                maxField = Math.min(maxField, bmap.size());
            }
            for (int i=getFirstField(); i<maxField; i++) {
                try {
                    if (bmap == null && fld[i] == null)
                        continue;
                    if (maxField > 128 && i==65)
                        continue;   // ignore extended bitmap

                    if (bmap == null || bmap.get(i)) {
                        if (fld[i] == null)
                            throw new ISOException ("field packager '" + i + "' is null");

                        ISOComponent c = fld[i].createComponent(i);
                        consumed += fld[i].unpack (c, b, consumed);
                        if (logger != null) {
                            evt.addMessage ("<unpack fld=\"" + i 
                                +"\" packager=\""
                                +fld[i].getClass().getName()+ "\">");
                            if (c.getValue() instanceof ISOMsg)
                                evt.addMessage (c.getValue());
                            else if (c.getValue() instanceof byte[]) {
                                evt.addMessage ("  <value type='binary'>" 
                                    +ISOUtil.hexString((byte[]) c.getValue())
                                    + "</value>");
                            }
                            else {
                                evt.addMessage ("  <value>" 
                                    +c.getValue()
                                    + "</value>");
                            }
                            evt.addMessage ("</unpack>");
                        }
                        m.set(c);
                    }
                } catch (ISOException e) {
                    evt.addMessage (
                        "error unpacking field " + i + " consumed=" + consumed
                    );
                    evt.addMessage (e);
                    // jPOS-3
                    e = new ISOException (
                        String.format ("%s (%s) unpacking field=%d, consumed=%d",
                        e.getMessage(), e.getNested().toString(), i, consumed)
                    );
                    throw e;
                }
            }
            if (b.length != consumed) {
                evt.addMessage (
                    "WARNING: unpack len=" +b.length +" consumed=" +consumed
                );
            }
            return consumed;
        } catch (ISOException e) {
            evt.addMessage (e);
            throw e;
        } catch (Exception e) {
            evt.addMessage (e);
            throw new ISOException (e.getMessage() + " consumed=" + consumed);
        } finally {
            Logger.log (evt);
        }
    }



 -------------------------------------------------------------------

asciiB-custom.xml
==============

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE isopackager PUBLIC
        "-//jPOS/jPOS Generic Packager DTD 1.0//EN"

<!-- ISO 8583:1993 (ASCII) field descriptions for GenericPackager -->

<isopackager headerLength="15">
  <isofield
      id="0"
      length="4"
      name="Message Type Indicator"
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="1"
      length="16"
      name="Bitmap"
      class="org.jpos.iso.IFB_BITMAP"/>
  <isofield
      id="2"
      length="19"
      name="Primary Account number"
      class="org.jpos.iso.IFA_LLNUM"/>
  <isofield
      id="3"
      length="6"
      name="Processing Code"
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="4"
      length="12"
      name="Amount, Transaction"
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="5"
      length="12"
      name="Amount, Reconciliation"
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="6"
      length="12"
      name="Amount, Cardholder billing"
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="7"
      length="10"
      name="Date and time, transmission"
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="8"
      length="8"
      name="Amount, Cardholder billing fee"
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="9"
      length="8"
      name="Conversion rate, Reconciliation"
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="10"
      length="8"
      name="Conversion rate, Cardholder billing"
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="11"
      length="6"
      name="Systems trace audit number"
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="12"
      length="12"
      name="Date and time, Local transaction"
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="13"
      length="4"
      name="Date, Effective"
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="14"
      length="4"
      name="Date, Expiration"
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="15"
      length="6"
      name="Date, Settlement"
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="16"
      length="4"
      name="Date, Conversion"
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="17"
      length="4"
      name="Date, Capture"
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="18"
      length="4"
      name="Merchant type"
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="19"
      length="3"
      name="Country code, Acquiring institution"
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="20"
      length="3"
      name="Country code, Primary account number"
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="21"
      length="3"
      name="Country code, Forwarding institution"
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="22"
      length="12"
      name="Point of service data code"
      class="org.jpos.iso.IF_CHAR"/>
  <isofield
      id="23"
      length="3"
      name="Card sequence number"
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="24"
      length="3"
      name="Function code"
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="25"
      length="4"
      name="Message reason code"
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="26"
      length="4"
      name="Card acceptor business code"
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="27"
      length="1"
      name="Approval code length"
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="28"
      length="6"
      name="Date, Reconciliation"
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="29"
      length="3"
      name="Reconciliation indicator"
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="30"
      length="24"
      name="Amounts, original"
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="31"
      length="99"
      name="Acquirer reference data"
      class="org.jpos.iso.IFA_LLCHAR"/>
  <isofield
      id="32"
      length="11"
      name="Acquirer institution identification code"
      class="org.jpos.iso.IFA_LLNUM"/>
  <isofield
      id="33"
      length="11"
      name="Forwarding institution identification code"
      class="org.jpos.iso.IFA_LLNUM"/>
  <isofield
      id="34"
      length="28"
      name="Primary account number, extended"
      class="org.jpos.iso.IFA_LLCHAR"/>
  <isofield
      id="35"
      length="37"
      name="Track 2 data"
      class="org.jpos.iso.IFA_LLCHAR"/>
  <isofield
      id="36"
      length="104"
      name="Track 3 data"
      class="org.jpos.iso.IFA_LLLCHAR"/>
  <isofield
      id="37"
      length="12"
      name="Retrieval reference number"
      class="org.jpos.iso.IF_CHAR"/>
  <isofield
      id="38"
      length="6"
      name="Approval code"
      class="org.jpos.iso.IF_CHAR"/>
  <isofield
      id="39"
      length="3"
      name="Action code"
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="40"
      length="3"
      name="Service code"
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="41"
      length="16"
      name="Card acceptor terminal identification"
      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="99"
      name="Card acceptor name/location"
      class="org.jpos.iso.IFA_LLCHAR"/>
   <isofield
      id="44"
      length="99"
      name="Additional Response data"
      class="org.jpos.iso.IFA_LLCHAR"/>
  <isofield
      id="45"
      length="76"
      name="Track 1 data"
      class="org.jpos.iso.IFA_LLCHAR"/>
  <isofield
      id="46"
      length="204"
      name="Amounts, Fees"
      class="org.jpos.iso.IFA_LLLCHAR"/>
  <isofield
      id="47"
      length="999"
      name="Additional data - national"
      class="org.jpos.iso.IFA_LLLCHAR"/>
  <isofield
      id="48"
      length="999"
      name="Additional data - private"
      class="org.jpos.iso.IFA_LLLCHAR"/>
  <isofield
      id="49"
      length="3"
      name="Currency code, Transaction"
      class="org.jpos.iso.IF_CHAR"/>
  <isofield
      id="50"
      length="3"
      name="Currency code, Reconciliation"
      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="Personal identification number [PIN] data"
      class="org.jpos.iso.IFA_BINARY"/>
  <isofield
      id="53"
      length="48"
      name="Security related control information"
      class="org.jpos.iso.IFA_LLBINARY"/>
  <isofield
      id="54"
      length="120"
      name="Amounts, additional"
      class="org.jpos.iso.IFA_LLLCHAR"/>
   <isofield
   id="55"
   length="255"
   name="IC card system related data" 
class="org.jpos.iso.IFA_LLLBINARY"/>
  <isofield
      id="56"
      length="35"
      name="Original data elements"
      class="org.jpos.iso.IFA_LLNUM"/>
  <isofield
      id="57"
      length="3"
      name="Authorization lIFA cycle code"
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="58"
      length="11"
      name="Authorizing agent institution Id Code"
      class="org.jpos.iso.IFA_LLNUM"/>
  <isofield
      id="59"
      length="999"
      name="Transport data"
      class="org.jpos.iso.IFA_LLLCHAR"/>
  <isofield
      id="60"
      length="999"
      name="Reserved for national use"
      class="org.jpos.iso.IFA_LLLCHAR"/>
  <isofield
      id="61"
      length="999"
      name="Reserved for national use"
      class="org.jpos.iso.IFA_LLLCHAR"/>
  <isofield
      id="62"
      length="999"
      name="Reserved for private use"
      class="org.jpos.iso.IFA_LLLCHAR"/>
  <isofield
      id="63"
      length="999"
      name="Reserved for private use"
      class="org.jpos.iso.IFA_LLLCHAR"/>
  <isofield
      id="64"
      length="8"
      name="Message authentication code field"
      class="org.jpos.iso.IF_CHAR"/>
  <isofield
      id="65"
      length="8"
      name="Reserved for ISO use"
      class="org.jpos.iso.IFA_BINARY"/>
  <isofield
      id="66"
      length="204"
      name="Amounts, original fees"
      class="org.jpos.iso.IFA_LLLCHAR"/>
  <isofield
      id="67"
      length="2"
      name="Extended payment data"
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="68"
      length="3"
      name="Country code, receiving institution"
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="69"
      length="3"
      name="Country code, settlement institution"
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="70"
      length="3"
      name="Country code, authorizing agent Inst."
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="71"
      length="8"
      name="Message number"
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="72"
      length="999"
      name="Data record"
      class="org.jpos.iso.IFA_LLLCHAR"/>
  <isofield
      id="73"
      length="6"
      name="Date, action"
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="74"
      length="10"
      name="Credits, number"
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="75"
      length="10"
      name="Credits, reversal number"
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="76"
      length="10"
      name="Debits, number"
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="77"
      length="10"
      name="Debits, reversal number"
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="78"
      length="10"
      name="Transfer, number"
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="79"
      length="10"
      name="Transfer, reversal number"
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="80"
      length="10"
      name="Inquiries, number"
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="81"
      length="10"
      name="Authorizations, number"
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="82"
      length="10"
      name="Inquiries, reversal number"
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="83"
      length="10"
      name="Payments, number"
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="84"
      length="10"
      name="Payments, reversal number"
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="85"
      length="10"
      name="Fee collections, number"
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="86"
      length="16"
      name="Credits, amount"
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="87"
      length="16"
      name="Credits, reversal amount"
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="88"
      length="16"
      name="Debits, amount"
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="89"
      length="16"
      name="Debits, reversal amount"
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="90"
      length="10"
      name="Authorizations, reversal number"
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="91"
      length="3"
      name="Country code, transaction Dest. Inst."
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="92"
      length="3"
      name="Country code, transaction Orig. Inst."
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="93"
      length="11"
      name="Transaction Dest. Inst. Id code"
      class="org.jpos.iso.IFA_LLNUM"/>
  <isofield
      id="94"
      length="11"
      name="Transaction Orig. Inst. Id code"
      class="org.jpos.iso.IFA_LLNUM"/>
  <isofield
      id="95"
      length="99"
      name="Card issuer reference data"
      class="org.jpos.iso.IFA_LLCHAR"/>
  <isofield
      id="96"
      length="999"
      name="Key management data"
      class="org.jpos.iso.IFA_LLLBINARY"/>
  <isofield
      id="97"
      length="17"
      name="Amount, Net reconciliation"
      class="org.jpos.iso.IFA_AMOUNT"/>
  <isofield
      id="98"
      length="25"
      name="Payee"
      class="org.jpos.iso.IF_CHAR"/>
  <isofield
      id="99"
      length="11"
      name="Settlement institution Id code"
      class="org.jpos.iso.IFA_LLCHAR"/>
  <isofield
      id="100"
      length="11"
      name="Receiving institution Id code"
      class="org.jpos.iso.IFA_LLNUM"/>
  <isofield
      id="101"
      length="17"
      name="File name"
      class="org.jpos.iso.IFA_LLCHAR"/>
  <isofield
      id="102"
      length="28"
      name="Account identification 1"
      class="org.jpos.iso.IFA_LLCHAR"/>
  <isofield
      id="103"
      length="28"
      name="Account identification 2"
      class="org.jpos.iso.IFA_LLCHAR"/>
  <isofield
      id="104"
      length="100"
      name="Transaction description"
      class="org.jpos.iso.IFA_LLLCHAR"/>
  <isofield
      id="105"
      length="16"
      name="Credits, Chargeback amount"
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="106"
      length="16"
      name="Debits, Chargeback amount"
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="107"
      length="10"
      name="Credits, Chargeback number"
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="108"
      length="10"
      name="Debits, Chargeback number"
      class="org.jpos.iso.IFA_NUMERIC"/>
  <isofield
      id="109"
      length="84"
      name="Credits, Fee amounts"
      class="org.jpos.iso.IFA_LLCHAR"/>
  <isofield
      id="110"
      length="84"
      name="Debits, Fee amounts"
      class="org.jpos.iso.IFA_LLCHAR"/>
  <isofield
      id="111"
      length="999"
      name="Reserved for ISO use"
      class="org.jpos.iso.IFA_LLLCHAR"/>
  <isofield
      id="112"
      length="999"
      name="Reserved for ISO use"
      class="org.jpos.iso.IFA_LLLCHAR"/>
  <isofield
      id="113"
      length="999"
      name="Reserved for ISO use"
      class="org.jpos.iso.IFA_LLLCHAR"/>
  <isofield
      id="114"
      length="999"
      name="Reserved for ISO use"
      class="org.jpos.iso.IFA_LLLCHAR"/>
  <isofield
      id="115"
      length="999"
      name="Reserved for ISO use"
      class="org.jpos.iso.IFA_LLLCHAR"/>
  <isofield
      id="116"
      length="999"
      name="Reserved for national use"
      class="org.jpos.iso.IFA_LLLCHAR"/>
  <isofield
      id="117"
      length="999"
      name="Reserved for national use"
      class="org.jpos.iso.IFA_LLLCHAR"/>
  <isofield
      id="118"
      length="999"
      name="Reserved for national use"
      class="org.jpos.iso.IFA_LLLCHAR"/>
  <isofield
      id="119"
      length="999"
      name="Reserved for national use"
      class="org.jpos.iso.IFA_LLLCHAR"/>
  <isofield
      id="120"
      length="999"
      name="Reserved for national use"
      class="org.jpos.iso.IFA_LLLCHAR"/>
  <isofield
      id="121"
      length="999"
      name="Reserved for national use"
      class="org.jpos.iso.IFA_LLLCHAR"/>
  <isofield
      id="122"
      length="999"
      name="Reserved for national use"
      class="org.jpos.iso.IFA_LLLCHAR"/>
  <isofield
      id="123"
      length="999"
      name="Reserved for private use"
      class="org.jpos.iso.IFA_LLLCHAR"/>
  <isofield
      id="124"
      length="999"
      name="Reserved for private use"
      class="org.jpos.iso.IFA_LLLCHAR"/>
  <isofield
      id="125"
      length="999"
      name="Reserved for private use"
      class="org.jpos.iso.IFA_LLLCHAR"/>
  <isofield
      id="126"
      length="999"
      name="Reserved for private use"
      class="org.jpos.iso.IFA_LLLCHAR"/>
  <isofield
      id="127"
      length="999"
      name="Reserved for private use"
      class="org.jpos.iso.IFA_LLLCHAR"/>
   <isofield
      id="128"
      length="8"
      name="Message authentication code field"
      class="org.jpos.iso.IF_CHAR"/>
</isopackager>

------------------------------------------------------------------------------------------------------------------------------------------------------------
XXXXChannel.java   code
=====================


package com.xx.xxxxx;

import java.io.EOFException;
import java.io.IOException;
import java.io.InterruptedIOException;
import java.net.Socket;

import org.jpos.iso.ISOException;
import org.jpos.iso.ISOMsg;
import org.jpos.iso.ISOPackager;
import org.jpos.iso.channel.ASCIIChannel;
import org.jpos.iso.ISOUtil;

import java.io.*;
import java.net.*;
import java.util.ArrayList;

import javax.net.ssl.SSLSocket;

import org.jpos.iso.ISOUtil;
import org.jpos.q2.Q2;
import org.jpos.util.LogEvent;
import org.jpos.util.LogSource;
import org.jpos.util.Logger;
import org.jpos.util.Log;
import org.jpos.iso.ISOException;
import org.jpos.util.SimpleLogListener;

public class XXXXXChannel extends ASCIIChannel {
private Log log;
private static Log logStatic;
final protected static char[] hexArray = "0123456789ABCDEF".toCharArray();
private ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataInputStream ds = null;
int msgLngth = 0;
StringBuffer inputLine = new StringBuffer();
int tmp=0;
private boolean expectKeepAlive;
private Socket socket;
private boolean soLingerOn = true;
private int soLingerSeconds = 5;
XXXXPackager packager;
public XXXXXChannel(){
log = Log.getLog(Q2.LOGGER_NAME, "XXXXXChannel");
log.info ("Inside XXXXXChannel");
}
public XXXXXChannel(XXXXPackager packager) throws ISOException {
packager = new XXXXPackager("asciiB-custom.xml");
this.packager = packager;
}

@Override
protected int getMessageLength() throws IOException, ISOException {
    int length = 0;
    byte[] b = new byte[4];
    log.info ("Inside XXXXXChannel.getMessageLength() line # 62--> ");
    while (length == 0) {
      serverIn.readFully(b, 0, 4);
      log.info ("Inside XXXXXChannel.getMessageLength() line # 65--> " + length);
      try {
        if ((length = Integer.parseInt(new String(b))) == 0) {
          serverOut.write(b);
          serverOut.flush();
          log.info ("Inside XXXXXChannel.getMessageLength() line # 70--> " + length);
        }
      } catch (NumberFormatException e) {
        throw new ISOException("Invalid message length " + new String(b));
      }
    }
    log.info ("Inside XXXXXChannel.getMessageLength() line # 76 --> " + length);
    return length;
  }
private String convertHexToString(String hexString){
StringBuilder sb = new StringBuilder(hexString.length() / 2);
for (int i = 0; i < hexString.length(); i+=2) {
   String hex = "" + hexString.charAt(i) + hexString.charAt(i+1);
   int ival = Integer.parseInt(hex, 16);
   sb.append((char) ival);
}
return sb.toString();
}
@Override
protected int getHeaderLength() {
log.info ("Inside XXXXXChannel.getHeaderLength() line # 82--> ");
return 15;
}
@Override
public ISOMsg receive() throws IOException, ISOException {
        byte[] b=null;
        byte[] header=null;
        LogEvent evt = new LogEvent (this, "receive");
        ISOMsg m = createMsg ();  // call createMsg instead of createISOMsg for 
                                  // backward compatibility
        m.setSource (this);
        try {
            if (!isConnected())
                throw new ISOException ("unconnected ISOChannel");
            log.info ("Inside XXXXXChannel.receive() line # 125--> ");
            synchronized (serverInLock) {
                int len  = getMessageLength();
                int hLen = getHeaderLength();
 
                if (len == -1) {
                    if (hLen > 0) {
                        header = readHeader(hLen);
                        log.info ("Inside XXXXXChannel.receive() line # 144--> " +header.length);
                    }
                    b = streamReceive();
                }
                else if (len > 0 && len <= getMaxPacketLength()) {
                    if (hLen > 0) {
                        // ignore message header (TPDU)
                        // Note header length is not necessarily equal to hLen (see VAPChannel)
                        header = readHeader(hLen);
                        log.info ("Inside XXXXXChannel.receive() line # 144--> " +header.length);
                        len -= header.length;
                    }
                    b = new byte[len];
                    log.info ("Inside XXXXXChannel.receive() line # 144--> " +len);
                    getMessage (b, 0, len);
                    getMessageTrailler();
                }
                else
                    throw new ISOException(
                        "receive length " +len + " seems strange - maxPacketLength = " + getMaxPacketLength());
            }
          //  m.setPackager (getDynamicPackager(header, b));
            m.setHeader (getDynamicHeader(header));
            Logger l = new Logger();
            l.addListener(new SimpleLogListener());
            XXXXFinalPackager pkgr = new XXXXFinalPackager("asciiB-custom.xml");
            pkgr.setLogger(l,"");
          //  if (b.length > 0 && !shouldIgnore (header))  // Ignore NULL messages
            //pkgr.unpackResp (m, b);
            pkgr.unpack (m, b);
            m.setDirection(ISOMsg.INCOMING);
            evt.addMessage (m);
            m = applyIncomingFilters (m, header, b, evt);
            m.setDirection(ISOMsg.INCOMING);
            cnt[RX]++;
            setChanged();
            notifyObservers(m);
        } catch (ISOException e) {
            evt.addMessage (e);
            if (header != null) {
                evt.addMessage ("--- header ---");
                evt.addMessage (ISOUtil.hexdump (header));
            }
            if (b != null) {
                evt.addMessage ("--- data ---");
                evt.addMessage (ISOUtil.hexdump (b));
            }
            throw e;
        } catch (EOFException e) {
            closeSocket();
            evt.addMessage ("<peer-disconnect/>");
            throw e;
        } catch (SocketException e) {
            closeSocket();
            if (usable)
                evt.addMessage ("<peer-disconnect>" + e.getMessage() + "</peer-disconnect>");
            throw e;
        } catch (InterruptedIOException e) {
            closeSocket();
            evt.addMessage ("<io-timeout/>");
            throw e;
        } catch (IOException e) { 
            closeSocket();
            if (usable) 
                evt.addMessage (e);
            throw e;
        } catch (Exception e) { 
            evt.addMessage (m);
            evt.addMessage (e);
            throw new ISOException ("unexpected exception", e);
        } finally {
            Logger.log (evt);
        }
        return m;
    }

@Override
protected void getMessage(byte[] b, int offset, int len) throws IOException, ISOException {
try{
if((serverIn.available())!=-1){
log.info("XXXXXChannel.getMessage() line# 203--> " +len);
//serverIn.readFully(b, offset, len);
serverIn.readFully(b);
log.info("XXXXXChannel.getMessage() line# 205--> ",b.length);
}
}catch(EOFException e){
log.error("Exception in XXXXXChannel.getMessage() line# 209--> ", e);
}
/*for ( int j = 0; j < b.length; j++ ) {
       int v = b[j] & 0xFF;
log.info ("Inside XXXXXChannel.getMessage() line# 188--> " + v );
}*/
}

@Override
protected void sendMessageHeader(ISOMsg m, int len) throws IOException {
}
public  String bytesToHex(byte[] bytes) {
   char[] hexChars = new char[bytes.length * 2];
   for ( int j = 0; j < bytes.length; j++ ) {
       int v = bytes[j] & 0xFF;
       log.info ("Inside XXXXXChannel.bytesToHex() line# 290--> " + v);
       hexChars[j * 2] = hexArray[v >>> 4];
       hexChars[j * 2 + 1] = hexArray[v & 0x0F];
   }
   return new String(hexChars);
}
public String bitwiseShiftHexValue(String hexStringBefore){
String hexStringAfter = null;
StringBuffer sBuff = new StringBuffer();
for(int i=0; i<32;){
hexStringAfter = hexStringBefore.substring(i+6, i+8);
sBuff = sBuff.append(hexStringAfter);
i=i+8;
}
return sBuff.toString();
}
public String hexToAscii(String hexString){
StringBuilder output = new StringBuilder();
for (int i = 0; i < hexString.length(); i+=2) {
       String str = hexString.substring(i, i+2);
       output.append((char)Integer.parseInt(str, 16));
   }
return output.toString();
}
@Override
protected ISOPackager getDynamicPackager(byte[] b1, byte[] b2) {
try{
log.info ("Inside XXXXXChannel.getDynamicPackager() line #322--> ");
return new XXXXPackager("asciiB-custom.xml");
}catch (ISOException e){
log.error("Inside XXXXXChannel.getDynamicPackager() line #325 --> ", e);
}
return null;
}
protected byte[] readHeader(int hLen)
     throws IOException
   {
     byte[] header = new byte[hLen];
     serverIn.readFully(header, 0, hLen);
     return header;
   }
 
private void closeSocket() throws IOException {
     Socket s = null;
     synchronized (this) {
       if (socket != null) {
         s = socket;
         socket = null;
       }
     }
     if (s != null) {
       try {
         s.setSoLinger(soLingerOn, soLingerSeconds);
         if ((shutdownSupportedBySocket(s)) && (!isSoLingerForcingImmediateTcpReset())) {
           s.shutdownOutput();
         }
       }
       catch (SocketException e) {}
       
       s.close();
     }
   }
 
private boolean shutdownSupportedBySocket(Socket s) { return !(s instanceof SSLSocket); }
 
   private boolean isSoLingerForcingImmediateTcpReset() { return (soLingerOn) && (soLingerSeconds == 0); }
 

}

DPR

unread,
Jul 11, 2016, 2:54:02 AM7/11/16
to jPOS Users
Sorry  the earlier post was not accepting the total code as it was lengthy. SO I am I attaching the code in a file. Please see.


On Saturday, July 9, 2016 at 9:14:32 PM UTC+5:30, DPR wrote:
code.txt

chhil

unread,
Jul 11, 2016, 3:33:17 AM7/11/16
to jpos-...@googlegroups.com

​​
​​
​Hello,​
​​
If I take the hex part of the dump and try to unpack it


    public static void main(String[] args)  {

// The hex data from your email, includes the header and data part concatenated.
        String hex ="49534F373031303030303031323130FE7200218AC1E208000000000000000131363532393631363030303136333136303930303030303030303030303039393935303030303030303039393935303030303030303039393935303031363037303931343539363130303030303030303634333231363037303931343539303531363037303936313130303030303030303030303131303030303030303030303034363830373633343537383639303931303030303030313632373035353234313632303730303034355030393030363030303139305036393031353632373035353234313632303730305031333030363030363433323034353337343052653030303030393033393030332020205858585830303030";
        ISOMsg m = new ISOMsg();
        try {
            GenericPackager p = new GenericPackager("C:\\temp\\custom.xml");// Your packager xml used here
            m.setPackager(p);
            m.unpack(ISOUtil.hex2byte(hex));
            m.dump(System.out, "Worked");
        }
        catch (ISOException ex) {
            m.dump(System.out, "");// will tell you till where the message was unpacked
            ex.printStackTrace();
        }
    }

Output

<isomsg direction="none">
  <!-- org.jpos.iso.packager.GenericPackager[C:\temp\custom.xml] -->
  <header>49534F373031303030303031323130</header>
  <field id="0" value="þr&#0;!"/>
  <field id="5" value="961600016316"/>
  <field id="7" value="0900000000"/>
  <field id="9" value="00009995"/>
  <field id="10" value="00000000"/>
  <field id="16" value="9995"/>
  <field id="17" value="0000"/>
  <field id="18" value="0000"/>
  <field id="19" value="999"/>
  <field id="23" value="500"/>
  <field id="29" value="160"/>
</isomsg>
org.jpos.iso.ISOException: org.jpos.iso.IFA_LLLBINARY: Problem unpacking field 96 (java.lang.ArrayIndexOutOfBoundsException) unpacking field=96, consumed=94
    at org.jpos.iso.ISOBasePackager.unpack(ISOBasePackager.java:284)
    at org.jpos.iso.ISOMsg.unpack(ISOMsg.java:460)
    at Test.main(Test.java:21)

As you can see that field 0 (MTI is not correct). As Mark had mentioned , your header is including the response MTI 1210.
Which means your bitmap got shifted by 4 bytes as it considers the first 4 bytes of the data as the MTI instead.
So if I change the header length in the packager to 11 the output looks better but still has a problem

<isomsg direction="none">
  <!-- org.jpos.iso.packager.GenericPackager[C:\temp\custom.xml] -->
  <header>49534F3730313030303030</header>
  <field id="0" value="1210"/>
  <field id="2" value="5296160001631609"/>
  <field id="3" value="000000"/>
  <field id="4" value="000000999500"/>
  <field id="5" value="000000999500"/>
  <field id="6" value="000000999500"/>
  <field id="7" value="1607091459"/>
  <field id="10" value="61000000"/>
  <field id="11" value="006432"/>
  <field id="12" value="160709145905"/>
  <field id="15" value="160709"/>
  <field id="27" value="6"/>
  <field id="32" value="00000000000"/>
  <field id="33" value="00000000000"/>
  <field id="37" value="468076345786"/>
  <field id="39" value="909"/>
  <field id="41" value="1000000162705524"/>
  <field id="42" value="1620700045P0900"/>
</isomsg>
org.jpos.iso.ISOException: org.jpos.iso.IFA_LLLCHAR: Problem unpacking field 48 (java.lang.RuntimeException: Required 600 but just got 69 bytes) unpacking field=48, consumed=206
    at org.jpos.iso.ISOBasePackager.unpack(ISOBasePackager.java:284)
    at org.jpos.iso.ISOMsg.unpack(ISOMsg.java:460)
    at Test.main(Test.java:21)

You should go through these fields and check if the data looks correct based on what is expected. So it could parse till 42 but that does not mean the values parsed were correct. Possibly a bad packager in the earlier fields has caused a misalignment later.

I assume pan, field 2 is a test pan and not a live one.

-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
 
Join us in IRC at http://webchat.freenode.net/?channels=jpos
 
You received this message because you are subscribed to the "jPOS Users" group.
Please see http://jpos.org/wiki/JPOS_Mailing_List_Readme_first
To post to this group, send email to jpos-...@googlegroups.com
To unsubscribe, send email to jpos-users+...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/jpos-users
---
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.

DPR

unread,
Jul 11, 2016, 4:19:34 AM7/11/16
to jPOS Users
I have checked your test code in my workspace, I am able to unpack the response as below:

Worked<isomsg>
Worked  <!-- org.jpos.iso.packager.GenericPackager[iso93asciiB-custom.xml] -->
Worked  <header>49534F3730313030303030</header>
Worked  <field id="0" value="1210"/>
Worked  <field id="2" value="5296160001631609"/>
Worked  <field id="3" value="000000"/>
Worked  <field id="4" value="000000999500"/>
Worked  <field id="5" value="000000999500"/>
Worked  <field id="6" value="000000999500"/>
Worked  <field id="7" value="1607091459"/>
Worked  <field id="10" value="61000000"/>
Worked  <field id="11" value="006432"/>
Worked  <field id="12" value="160709145905"/>
Worked  <field id="15" value="160709"/>
Worked  <field id="27" value="6"/>
Worked  <field id="32" value="00000000000"/>
Worked  <field id="33" value="00000000000"/>
Worked  <field id="37" value="468076345786"/>
Worked  <field id="39" value="909"/>
Worked  <field id="41" value="10000001"/>
Worked  <field id="42" value="627055241620700"/>
Worked  <field id="48" value="P09006000190P69015627055241620700P13006006432"/>
Worked  <field id="49" value="045"/>
Worked  <field id="50" value="374"/>
Worked  <field id="51" value="0Re"/>
Worked  <field id="55" value="" type="binary"/>
Worked  <field id="61" value="039003   "/>
Worked  <field id="128" value="XXXX0000"/>
Worked</isomsg>


PAN - Field#2  is live one, but with a test pin number.  But the unpacking does not work in my real application. To explain in detail how my application works. First I have Application "A" which will pack the ISO message (headerLength = 15), it does not pack if I change the headerLength = 11, so I had to stick with headerLength=15 in the xml. There is jPOS application "B" running on server, where the message from application "A" is received as DataInputStream and converted to byteArray, unpacked by
                     packager.unpack(msg, reqBytes);      in this packager of application "B" I am using the same xml that I use in application "A" with headerLength=15.
 and posted  using    ISOMsg  responseMsg = mux.request(msg, 60000);   This all happpens in servlet. Now in the XXXChannel.java class of Application "B", I use the same xml as above      XXXFinalpkgr.unpack (m, b); But you can see in the code taXXXXFinalPackager.java that I sent you earlier in the attachment,


 if (!(fld[0] == null) && !(fld[0] instanceof ISOBitMapPackager) && consumed==15)
            {
            consumed = consumed-4;  // here I am reducing the headerLength to 11
                ISOComponent mti = fld[0].createComponent(0);
                consumed  += fld[0].unpack(mti, h, consumed);  // and unpacking mti from header data
                m.set (mti);
            }
            
            else if (!(fld[0] == null) && !(fld[0] instanceof ISOBitMapPackager))
            {
                ISOComponent mti = fld[0].createComponent(0);
                consumed  += fld[0].unpack(mti, b, consumed);
                m.set (mti);
            }
            BitSet bmap = null;
            int maxField = fld.length;
            if (emitBitMap()) {
            
///////////////////////////////////////////////////////////
Still I am not able to resolve the issue.  Can you please help on this.

Best Regards
DPR

On Saturday, July 9, 2016 at 9:14:32 PM UTC+5:30, DPR wrote:

chhil

unread,
Jul 11, 2016, 4:54:03 AM7/11/16
to jpos-...@googlegroups.com

​​
​​
You should never have to modify the jpos code like you do unless you are using it incorrectly.

 if (!(fld[0] == null) && !(fld[0] instanceof ISOBitMapPackager) && consumed==15)

.....

Below I change the header and pack it and it works fine. On a side note, your field 49/50/51 dont look correct, those need to be ISO Currencies. Your field 55 shows a bit set but no data, which too does not look correct.

import org.jpos.iso.ISOException;
import org.jpos.iso.ISOMsg;
import org.jpos.iso.ISOUtil;
import org.jpos.iso.packager.GenericPackager;

public class Test {

    public static void main(String[] args) {

        String hex = "49534F373031303030303031323130FE7200218AC1E208000000000000000131363532393631363030303136333136303930303030303030303030303039393935303030303030303039393935303030303030303039393935303031363037303931343539363130303030303030303634333231363037303931343539303531363037303936313130303030303030303030303131303030303030303030303034363830373633343537383639303931303030303030313632373035353234313632303730303034355030393030363030303139305036393031353632373035353234313632303730305031333030363030363433323034353337343052653030303030393033393030332020205858585830303030";
        ISOMsg m = new ISOMsg();
        try {

            GenericPackager p = new GenericPackager("C:\\temp\\custom.xml");
            m.setPackager(p);
            m.unpack(ISOUtil.hex2byte(hex));
            m.dump(System.out, "Working"); // after changing definition of field 41 to 8 from 16

            m.setHeader("ISO70122222".getBytes());// test updated  header
            m.set(3, "111111");// test updated processing code
            m.pack(); //packing works fine
            m.dump(System.out, "Update And Pack>");
        }
        catch (ISOException ex) {
            m.dump(System.out, "");
            ex.printStackTrace();
        }

    }

}

Output

Working<isomsg direction="none">
Working  <!-- org.jpos.iso.packager.GenericPackager[C:\temp\custom.xml] -->
Working  <header>49534F3730313030303030</header>
Working  <field id="0" value="1210"/>
Working  <field id="2" value="5296160001631609"/>
Working  <field id="3" value="000000"/>
Working  <field id="4" value="000000999500"/>
Working  <field id="5" value="000000999500"/>
Working  <field id="6" value="000000999500"/>
Working  <field id="7" value="1607091459"/>
Working  <field id="10" value="61000000"/>
Working  <field id="11" value="006432"/>
Working  <field id="12" value="160709145905"/>
Working  <field id="15" value="160709"/>
Working  <field id="27" value="6"/>
Working  <field id="32" value="00000000000"/>
Working  <field id="33" value="00000000000"/>
Working  <field id="37" value="468076345786"/>
Working  <field id="39" value="909"/>
Working  <field id="41" value="10000001"/>
Working  <field id="42" value="627055241620700"/>
Working  <field id="48" value="P09006000190P69015627055241620700P13006006432"/>
Working  <field id="49" value="045"/>
Working  <field id="50" value="374"/>
Working  <field id="51" value="0Re"/>
Working  <field id="55" value="" type="binary"/>
Working  <field id="61" value="039003   "/>
Working  <field id="128" value="XXXX0000"/>
Working</isomsg>
Update And Pack><isomsg direction="none">
Update And Pack>  <!-- org.jpos.iso.packager.GenericPackager[C:\temp\custom.xml] -->
Update And Pack>  <header>49534F3730313232323232</header>
Update And Pack>  <field id="0" value="1210"/>
Update And Pack>  <field id="2" value="5296160001631609"/>
Update And Pack>  <field id="3" value="111111"/>
Update And Pack>  <field id="4" value="000000999500"/>
Update And Pack>  <field id="5" value="000000999500"/>
Update And Pack>  <field id="6" value="000000999500"/>
Update And Pack>  <field id="7" value="1607091459"/>
Update And Pack>  <field id="10" value="61000000"/>
Update And Pack>  <field id="11" value="006432"/>
Update And Pack>  <field id="12" value="160709145905"/>
Update And Pack>  <field id="15" value="160709"/>
Update And Pack>  <field id="27" value="6"/>
Update And Pack>  <field id="32" value="00000000000"/>
Update And Pack>  <field id="33" value="00000000000"/>
Update And Pack>  <field id="37" value="468076345786"/>
Update And Pack>  <field id="39" value="909"/>
Update And Pack>  <field id="41" value="10000001"/>
Update And Pack>  <field id="42" value="627055241620700"/>
Update And Pack>  <field id="48" value="P09006000190P69015627055241620700P13006006432"/>
Update And Pack>  <field id="49" value="045"/>
Update And Pack>  <field id="50" value="374"/>
Update And Pack>  <field id="51" value="0Re"/>
Update And Pack>  <field id="55" value="" type="binary"/>
Update And Pack>  <field id="61" value="039003   "/>
Update And Pack>  <field id="128" value="XXXX0000"/>
Update And Pack></isomsg>

-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
 
Join us in IRC at http://webchat.freenode.net/?channels=jpos
 
You received this message because you are subscribed to the "jPOS Users" group.
Please see http://jpos.org/wiki/JPOS_Mailing_List_Readme_first
To post to this group, send email to jpos-...@googlegroups.com
To unsubscribe, send email to jpos-users+...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/jpos-users
---
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.
Message has been deleted

DPR

unread,
Jul 11, 2016, 6:52:01 AM7/11/16
to jPOS Users
Actually as per the Switch specification document, Field # 41, size=16. But as you suggested I have changed the Field # 41 size=8 from 16. And now I get the following response. Still there is error. How to resolve it. Please help.

<log realm="channel/XXXXXX" at="Mon Jul 11 16:09:13 IST 2016.482" lifespan="133080ms">
  <receive>
    <iso-exception>
      org.jpos.iso.IFA_LLCHAR: Problem unpacking field 35 (org.jpos.iso.ISOException: Field length 61 too long. Max: 37) unpacking field=35, consumed=118
      org.jpos.iso.ISOException: org.jpos.iso.IFA_LLCHAR: Problem unpacking field 35 (org.jpos.iso.ISOException: Field length 61 too long. Max: 37) unpacking field=35, consumed=118
        at com.xx.XXXXFinalPackager.unpack(XXXXFinalPackager.java:654)
        at com.xx.XXXXChannel.receive(XXXXChannel.java:155)
        at org.jpos.q2.iso.ChannelAdaptor$Receiver.run(ChannelAdaptor.java:319)
        at java.lang.Thread.run(Thread.java:744)
    </iso-exception>
    --- header ---
    0000  49 53 4F 37 30 31 30 30  30 30 30 31 32 31 30     ISO701000001210

    --- data ---
    0000  FE 72 00 21 8E C1 E2 08  00 00 00 00 00 00 00 01  .r.!............
0010  31 36 35 32 39 36 31 36  30 30 30 31 36 33 31 36  1652961600016316
0020  30 39 30 30 30 30 30 30  30 30 30 30 30 30 35 39  0900000000000059
0030  35 39 30 30 30 30 30 30  30 30 35 39 35 39 30 30  5900000000595900
0040  30 30 30 30 30 30 35 39  35 39 30 30 31 36 30 37  0000005959001607
0050  31 31 31 30 33 38 36 31  30 30 30 30 30 30 30 30  1110386100000000
0060  36 34 34 30 31 36 30 37  31 31 31 30 33 38 35 35  6440160711103855
0070  31 36 30 37 31 31 36 31  31 30 30 30 30 30 30 30  1607116110000000
0080  30 30 30 30 31 31 30 30  30 30 30 30 30 30 30 30  0000110000000000
0090  30 34 36 38 32 33 33 35  33 35 30 38 35 30 32 31  0468233535085021
00a0  34 33 33 30 30 30 36 32  37 30 35 35 32 34 31 36  4330006270552416
00b0  32 30 37 30 30 30 31 30  30 34 35 33 37 30 38 32  2070001004537082
00c0  50 30 39 30 30 36 30 30  30 31 39 30 50 36 39 30  P09006000190P690
00d0  31 35 31 36 32 30 37 30  30 30 31 30 30 34 35 33  1516207000100453
00e0  37 50 31 33 30 30 36 30  30 36 34 34 30 50 30 32  7P13006006440P02
00f0  30 30 32 4E 52 50 39 34  30 30 36 30 30 30 30 30  002NRP9400600000
0100  31 50 39 37 30 30 34 4F  4E 55 53 50 38 37 30 30  1P97004ONUSP8700
0110  31 34 35 30 34 35 30 34  35 30 34 31 32 32 82 02  14504504504122..
0120  38 00 95 05 00 00 04 80  00 9A 03 16 07 11 9C 01  8...............
0130  00 5F 2A 02 03 56 9F 33  03 E0 F8 C8 5F 34 01 00  ._*..V.3...._4..
0140  9F 34 03 42 03 00 9F 02  06 00 00 00 59 59 00 9F  .4.B........YY..
0150  03 06 00 00 00 00 00 00  9F 10 12 01 10 A0 80 01  ................
0160  22 00 00 5D 76 00 00 00  00 00 00 00 FF 9F 1A 02  "..]v...........
0170  03 56 9F 1E 08 38 33 32  30 31 49 43 43 9F 26 08  .V...83201ICC.&.
0180  46 85 14 87 2A F6 B4 6F  9F 27 01 80 9F 36 02 00  F...*..o.'...6..
0190  DA 9F 37 04 2C 1A 3B 9B  30 30 39 30 33 39 30 30  ..7.,.;.00903900
01a0  33 30 30 30 34 31 32 45  33 30 44 38              3000412E30D8

  </receive>

Best Regards,
DPR

On Saturday, July 9, 2016 at 9:14:32 PM UTC+5:30, DPR wrote:
- show quoted text -

On Saturday, July 9, 2016 at 9:14:32 PM UTC+5:30, DPR wrote:
Message has been deleted

chhil

unread,
Jul 11, 2016, 9:51:09 AM7/11/16
to jpos-...@googlegroups.com
If you are not seeing the response, it might be a good idea to ask the server entity to tell you why the response is not being sent or it could very well be your enhanced channel not interpreting the length correctly and waiting for data to match the length your channel has determined incorrectly.
I do think you have unnecessarily complicated matter by trying to extend the channel to handle your header. It should work out of the box.
My suggestion is to use the standard AsciiChannel and take it from there.

There a threads in the user group on how to set up a constant header. You may want to search for it.

-chhil

p.s. Avoid direct messages.


On Mon, Jul 11, 2016 at 4:29 PM, DPR <dpr2014r...@gmail.com> wrote:
In addition to previous post. I would like to mention that, I forgot to mention that , I tried changing the headerLength = 11, in the xml, but I am not able to see any kind of response in the logs, therefore I am continuing with headerLength=15.


On Saturday, July 9, 2016 at 9:14:32 PM UTC+5:30, DPR wrote:

--
--
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
 
Join us in IRC at http://webchat.freenode.net/?channels=jpos
 
You received this message because you are subscribed to the "jPOS Users" group.
Please see http://jpos.org/wiki/JPOS_Mailing_List_Readme_first
To post to this group, send email to jpos-...@googlegroups.com
To unsubscribe, send email to jpos-users+...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/jpos-users
---
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.

chhil

unread,
Jul 11, 2016, 10:15:49 AM7/11/16
to jpos-...@googlegroups.com

​Test code update to show you that your message doesn’t have a field 35 and your bitmap is getting skewed due to not handling the header correctly.

I am afraid I wont be of much help till you don’t do basic debugging using the hexdump and your continued use of your hacked channel extension.


// Hex data from the error from   org.jpos.iso.IFA_LLCHAR: Problem unpacking field 35 (org.jpos.iso.ISOException: Field length 61 too long. Max: 37) unpacking field=35, consumed=118
        String hex = "49534F373031303030303031323130FE7200218EC1E208000000000000000131363532393631363030303136333136303930303030303030303030303035393539303030303030303035393539303030303030303035393539303031363037313131303338363130303030303030303634343031363037313131303338353531363037313136313130303030303030303030303131303030303030303030303034363832333335333530383530323134333330303036323730353532343136323037303030313030343533373038325030393030363030303139305036393031353136323037303030313030343533375031333030363030363434305030323030324E525039343030363030303030315039373030344F4E55535038373030313435303435303435303431323282023800950500000480009A031607119C01005F2A0203569F3303E0F8C85F3401009F34034203009F02060000005959009F03060000000000009F10120110A080012200005D7600000000000000FF9F1A0203569F1E0838333230314943439F2608468514872AF6B46F9F2701809F360200DA9F37042C1A3B9B3030393033393030333030303431324533304438";
        ISOMsg m = new ISOMsg();
        try {

            GenericPackager p = new GenericPackager("C:\\temp\\custom.xml");
            m.setPackager(p);
            Logger l = new Logger();
            l.addListener(new SimpleLogListener());
            p.setLogger(l,"Test"); // added logger for packager


            m.unpack(ISOUtil.hex2byte(hex));
            m.dump(System.out, "Working"); // after changing definition of field 41 to 8 from 16

        }
        catch (ISOException ex) {
            m.dump(System.out, "");
            ex.printStackTrace();
        }

Output. By adding the logger for the packager, you can see which bits are set in the bitmap.

<log realm="Test" at="Mon Jul 11 19:33:36 IST 2016.343" lifespan="21ms">
  <unpack>
    49534F373031303030303031323130FE7200218EC1E208000000000000000131363532393631363030303136333136303930303030303030303030303035393539303030303030303035393539303030303030303035393539303031363037313131303338363130303030303030303634343031363037313131303338353531363037313136313130303030303030303030303131303030303030303030303034363832333335333530383530323134333330303036323730353532343136323037303030313030343533373038325030393030363030303139305036393031353136323037303030313030343533375031333030363030363434305030323030324E525039343030363030303030315039373030344F4E55535038373030313435303435303435303431323282023800950500000480009A031607119C01005F2A0203569F3303E0F8C85F3401009F34034203009F02060000005959009F03060000000000009F10120110A080012200005D7600000000000000FF9F1A0203569F1E0838333230314943439F2608468514872AF6B46F9F2701809F360200DA9F37042C1A3B9B3030393033393030333030303431324533304438
    <bitmap>{1, 2, 3, 4, 5, 6, 7, 10, 11, 12, 15, 27, 32, 33, 37, 38, 39, 41, 42, 48, 49, 50, 51, 55, 61, 128}</bitmap>
    <unpack fld="2" packager="org.jpos.iso.IFA_LLNUM">
      <value>5296160001631609</value>
    </unpack>
    <unpack fld="3" packager="org.jpos.iso.IFA_NUMERIC">
      <value>000000</value>
    </unpack>
    <unpack fld="4" packager="org.jpos.iso.IFA_NUMERIC">
      <value>000000595900</value>
    </unpack>
    <unpack fld="5" packager="org.jpos.iso.IFA_NUMERIC">
      <value>000000595900</value>
    </unpack>
    <unpack fld="6" packager="org.jpos.iso.IFA_NUMERIC">
      <value>000000595900</value>
    </unpack>
    <unpack fld="7" packager="org.jpos.iso.IFA_NUMERIC">
      <value>1607111038</value>
    </unpack>
    <unpack fld="10" packager="org.jpos.iso.IFA_NUMERIC">
      <value>61000000</value>
    </unpack>
    <unpack fld="11" packager="org.jpos.iso.IFA_NUMERIC">
      <value>006440</value>
    </unpack>
    <unpack fld="12" packager="org.jpos.iso.IFA_NUMERIC">
      <value>160711103855</value>
    </unpack>
    <unpack fld="15" packager="org.jpos.iso.IFA_NUMERIC">
      <value>160711</value>
    </unpack>
    <unpack fld="27" packager="org.jpos.iso.IFA_NUMERIC">
      <value>6</value>
    </unpack>
    <unpack fld="32" packager="org.jpos.iso.IFA_LLNUM">
      <value>00000000000</value>
    </unpack>
    <unpack fld="33" packager="org.jpos.iso.IFA_LLNUM">
      <value>00000000000</value>
    </unpack>
    <unpack fld="37" packager="org.jpos.iso.IF_CHAR">
      <value>468233535085</value>
    </unpack>
    <unpack fld="38" packager="org.jpos.iso.IF_CHAR">
      <value>021433</value>
    </unpack>
    <unpack fld="39" packager="org.jpos.iso.IFA_NUMERIC">
      <value>000</value>
    </unpack>
    <unpack fld="41" packager="org.jpos.iso.IF_CHAR">
      <value>62705524</value>
    </unpack>
    <unpack fld="42" packager="org.jpos.iso.IF_CHAR">
      <value>162070001004537</value>
    </unpack>
    <unpack fld="48" packager="org.jpos.iso.IFA_LLLCHAR">
      <value>P09006000190P69015162070001004537P13006006440P02002NRP94006000001P97004ONUSP870014</value>
    </unpack>
    <unpack fld="49" packager="org.jpos.iso.IF_CHAR">
      <value>504</value>
    </unpack>
    <unpack fld="50" packager="org.jpos.iso.IF_CHAR">
      <value>504</value>
    </unpack>
    <unpack fld="51" packager="org.jpos.iso.IF_CHAR">
      <value>504</value>
    </unpack>
    <unpack fld="55" packager="org.jpos.iso.IFA_LLLBINARY">
      <value type='binary'>82023800950500000480009A031607119C01005F2A0203569F3303E0F8C85F3401009F34034203009F02060000005959009F03060000000000009F10120110A080012200005D7600000000000000FF9F1A0203569F1E0838333230314943439F2608468514872AF6B46F9F2701809F360200DA9F37042C1A3B9B</value>
    </unpack>
    <unpack fld="61" packager="org.jpos.iso.IFA_LLLCHAR">
      <value>039003000</value>
    </unpack>
    <unpack fld="128" packager="org.jpos.iso.IF_CHAR">
      <value>412E30D8</value>
    </unpack>


  </unpack>
</log>
Working<isomsg direction="none">
Working  <!-- org.jpos.iso.packager.GenericPackager[C:\temp\custom.xml] -->
Working  <header>49534F3730313030303030</header>
Working  <field id="0" value="1210"/>
Working  <field id="2" value="5296160001631609"/>
Working  <field id="3" value="000000"/>
Working  <field id="4" value="000000595900"/>
Working  <field id="5" value="000000595900"/>
Working  <field id="6" value="000000595900"/>
Working  <field id="7" value="1607111038"/>
Working  <field id="10" value="61000000"/>
Working  <field id="11" value="006440"/>
Working  <field id="12" value="160711103855"/>
Working  <field id="15" value="160711"/>
Working  <field id="27" value="6"/>
Working  <field id="32" value="00000000000"/>
Working  <field id="33" value="00000000000"/>
Working  <field id="37" value="468233535085"/>
Working  <field id="38" value="021433"/>
Working  <field id="39" value="000"/>
Working  <field id="41" value="62705524"/>
Working  <field id="42" value="162070001004537"/>
Working  <field id="48" value="P09006000190P69015162070001004537P13006006440P02002NRP94006000001P97004ONUSP870014"/>
Working  <field id="49" value="504"/>
Working  <field id="50" value="504"/>
Working  <field id="51" value="504"/>
Working  <field id="55" value="82023800950500000480009A031607119C01005F2A0203569F3303E0F8C85F3401009F34034203009F02060000005959009F03060000000000009F10120110A080012200005D7600000000000000FF9F1A0203569F1E0838333230314943439F2608468514872AF6B46F9F2701809F360200DA9F37042C1A3B9B" type="binary"/>
Working  <field id="61" value="039003000"/>
Working  <field id="128" value="412E30D8"/>
Working</isomsg>

--
--
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
 
Join us in IRC at http://webchat.freenode.net/?channels=jpos
 
You received this message because you are subscribed to the "jPOS Users" group.
Please see http://jpos.org/wiki/JPOS_Mailing_List_Readme_first
To post to this group, send email to jpos-...@googlegroups.com
To unsubscribe, send email to jpos-users+...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/jpos-users
---
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.

Mark Salter

unread,
Jul 11, 2016, 4:49:36 PM7/11/16
to jpos-...@googlegroups.com
On 11/07/16 09:19, DPR wrote:
> Still I am not able to resolve the issue. Can you please help on this.
Please stop.

Get the interface specification(s) you are trying (very inefficiently
and in a public forum) to solve.

Understand that specification(s) and then :-

a-1) Unless you own the card number you are using inform the issue that
you have been using it for testing and have published data on or about
it in the public domain. If in your various hex dumps the real track is
present then it must be considered compromised and treated as such.

a) Pick a Channel or modify one to match the specification
b) Pick a Packager or modify one to match all field specifications
c) Double check both of the above to make sure they match the
specification or specifications you need them too.


You are just wasting your own time with this experiment and you are
making it far harder than it is or needs to be.

Do the leg work indicated above once for all of the fields in the
specification.

Also don't be tempted to share a copy of the specification(s) unless you
own the copyright or have requested and received written permission to
share it.

This may seem harsh, but I am afraid from many years of experience that
there is no quick way to guess at a message format - get the
documentation and work towards it.

Thanks

--
Mark
Reply all
Reply to author
Forward
0 new messages
Search
Clear search
Close search
Google apps
Main menu