field 45 parsing error

39 views
Skip to first unread message

Prem

unread,
Mar 31, 2008, 12:45:34 AM3/31/08
to jPOS Users
Hi,

I am getting error in parsing the field 45, anny one can help me..

<iso-exception>
org.jpos.iso.IFB_LLCHAR: Problem unpacking field 45
<nested-exception>
java.lang.ArrayIndexOutOfBoundsException: 110
at
org.jpos.iso.AsciiInterpreter.uninterpret(AsciiInterpreter.java:88)
at
org.jpos.iso.ISOStringFieldPackager.unpack(ISOStringFieldPackager.jav
04)
at org.jpos.iso.ISOBasePackager.unpack(ISOBasePackager.java:229)
at org.jpos.iso.ISOMsg.unpack(ISOMsg.java:322)
at com.indus.hostsim.packager.Inno.receive(Inno.java:241)
at org.jpos.iso.ISOServer$Session.run(ISOServer.java:123)
at org.jpos.util.ThreadPool$PooledThread.run(ThreadPool.java:100)
</nested-exception>
org.jpos.iso.ISOException: org.jpos.iso.IFB_LLCHAR: Problem
unpacking fiel
5 (java.lang.ArrayIndexOutOfBoundsException: 110)
at
org.jpos.iso.ISOStringFieldPackager.unpack(ISOStringFieldPackager.jav
09)
at org.jpos.iso.ISOBasePackager.unpack(ISOBasePackager.java:229)
at org.jpos.iso.ISOMsg.unpack(ISOMsg.java:322)
at com.indus.hostsim.packager.Inno.receive(inno.java:241)
at org.jpos.iso.ISOServer$Session.run(ISOServer.java:123)
at org.jpos.util.ThreadPool$PooledThread.run(ThreadPool.java:100)
ted:java.lang.ArrayIndexOutOfBoundsException: 110
at
org.jpos.iso.AsciiInterpreter.uninterpret(AsciiInterpreter.java:88)
at
org.jpos.iso.ISOStringFieldPackager.unpack(ISOStringFieldPackager.jav
04)
at org.jpos.iso.ISOBasePackager.unpack(ISOBasePackager.java:229)
at org.jpos.iso.ISOMsg.unpack(ISOMsg.java:322)
at com.indus.hostsim.packager.Inno.receive(Inno.java:241)
at org.jpos.iso.ISOServer$Session.run(ISOServer.java:123)
at org.jpos.util.ThreadPool$PooledThread.run(ThreadPool.java:100)
</iso-exception>
/receive>

Miguel Angel Iglesias

unread,
Mar 31, 2008, 12:51:49 AM3/31/08
to jpos-...@googlegroups.com
well, that usually means that in some previous field you are setting a value to big, check the packager that you are using, and then check the values you are setting...


2008/3/30, Prem <prem...@gmail.com>:
Message has been deleted

Mark Salter

unread,
Mar 31, 2008, 2:47:13 AM3/31/08
to jpos-...@googlegroups.com
Miguel Angel Iglesias wrote:
> well, that usually means that in some previous field you are setting a
> value to big, check the packager that you are using, and then check the
> values you are setting...
Or a previous field is too small.

Either way, the position derived for the start of your field 45 is out,
meaning that jPOS has picked up a length which means it exceeds the
available bytes left in the raw bytes delivered over the network.

Add a logger to the packager, and the extra logging may help you find
the problem, which is likely a field or fields in your packager that do
not match the structure of the message being received.

--
Mark

Prem Gupta

unread,
Mar 31, 2008, 2:52:48 AM3/31/08
to jpos-...@googlegroups.com
Hi Miguel,
 
I am sending the packet in the form of stnadard ISO8583 and the field are the combination of BCD and Ans as per ISO.
I have seen the pakager , All fields defined there in as iso stnadard but the meanning is diffrent from my understanding.
as processing code written is 6 bytes and it will go in 3 bytes (BCD) .
 
so can you advice me, should i send the packet as ISO (mix of BCD and ascii ) or all in Ascii?
 
Regards,
Prem

Mark Salter

unread,
Mar 31, 2008, 6:29:25 AM3/31/08
to jPOS Users
On Mar 31, 7:52 am, "Prem Gupta" <prem.h...@gmail.com> wrote:

> I am sending the packet in the form of stnadard ISO8583 and the field are
> the combination of BCD and Ans as per ISO.
Don't worry too much about the ISO specification, it is the
specification of the interface you are traversing that matters more.

> I have seen the pakager , All fields defined there in as iso stnadard but
> the meanning is diffrent from my understanding.
Of a different interface perhaps?

> as processing code written is 6 bytes and it will go in 3 bytes (BCD) .
IFB_NUMERIC is 6 BCD numerics and thus 3 bytes.

>
> so can you advice me, should i send the packet as ISO (mix of BCD and ascii
> ) or all in Ascii?
This depends on the interface spec, but the message is a mix of ACSII
and BCD.

You have also taken the jPOS code (copyright inplace?) and placed in
under your company package - indus.com which is owned by a company
called "ventyx". This doesn't feel too appropriate, or is my general
bad mood affecting my judgement this morning?

--
Mark

Mark Salter

unread,
Mar 31, 2008, 6:33:11 AM3/31/08
to jPOS Users


On Mar 31, 11:29 am, Mark Salter <marksal...@dsl.pipex.com> wrote:

> You have also taken the jPOS code (copyright inplace?) and placed in
> under your company package - indus.com which is owned by a company
> called "ventyx".  This doesn't feel too appropriate, or is my general
> bad mood affecting my judgement this morning?
After brief consideration, I think my general bad mood is at fault
here!

8)

--
Mark

David Bergert

unread,
Mar 31, 2008, 10:44:41 AM3/31/08
to jpos-...@googlegroups.com

Let's see -- this was done quick so there could be errors:

 

0200  - MTI

30 38 05 80 00 c8 00 04 - BITMAP

 

0  0011 0000    3,4

8  0011 1000    10,11,13

16 0000 0101    22,34

24 1000 0000    25

32 0000 0000

40 1100 1000    41,42,45

48 0000 0000

56 0000 0100    62

 

3) 003000

4) 0000000000f0

11) 001597

12) 100755

13) 3103

22) 020

34) 00 1000031323334353637383032303    (Looks like you're not setting the length here for LLCHAR) or set it to 0 ?

35) 00 0000000000000000000007642313233343536  no length for LLNUM field or set to 0 ?

41) 3738393837363534 = 78989654

42) 33323132335e6e6964686970617468 = 32123^nidhipath

45) 61 6b202020205e3033303931323334350006333435363738  IFA_LLCHAR   -- length is sent to: 97 and your only sending 46 bytes, and we have fills left to populate below

62)

 

Check the above message --- look like you are not setting any LL values which stand for length in 2 bytes according to your packager for these fields.

This is best guess with the info you provided... BTW, If you haven't bought the programmers guide yet, what it did is illustrated in chapter 2 - an ISO Primer.

 

David Bergert

http://www.paymentsystemsblog.com

 

 

From: jpos-...@googlegroups.com [mailto:jpos-...@googlegroups.com] On Behalf Of Prem Gupta
Sent: Monday, March 31, 2008 1:47 AM
To: jpos-...@googlegroups.com
Subject: Re: field 45 parsing error

 

Hi,

 

 

Please check my send packet

 

 02003038058000c800040030000000000000f00015971007553103020001000031323334353637383032303000000000000000000000007642313233343536373839383736353433323132335e6e6964686970617468616b202020205e3033303931323334350006333435363738
  </FINAL_PACKET>
  <RAW_PACKET>
  02003038058000c800040030000000000000f00015971007553103020001000031323334353637383032303000000000000000000000007642313233343536373839383736353433323132335e6e6964686970617468616b202020205e3033303931323334350006333435363738

 

and the pakager code..

 

package com.indus.hostsim.packager;
/*
 * Copyright (c) 2000 jPOS.org.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *
 * 3. The end-user documentation included with the redistribution,
 *    if any, must include the following acknowledgment:
 *    "This product includes software developed by the jPOS project
 *    (http://www.jpos.org/)". Alternately, this acknowledgment may
 *    appear in the software itself, if and wherever such third-party
 *    acknowledgments normally appear.
 *
 * 4. The names "jPOS" and "jPOS.org" must not be used to endorse
 *    or promote products derived from this software without prior
 *    written permission. For written permission, please contact
 *    lic...@jpos.org.
 *
 * 5. Products derived from this software may not be called "jPOS",
 *    nor may "jPOS" appear in their name, without prior written
 *    permission of the jPOS project.
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
 * IN NO EVENT SHALL THE JPOS PROJECT OR ITS CONTRIBUTORS BE LIABLE FOR
 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 * ====================================================================
 *
 * This software consists of voluntary contributions made by many
 * individuals on behalf of the jPOS Project.  For more
 * information please see <http://www.jpos.org/>.
 */


import org.jpos.iso.*;
import org.jpos.iso.ISOBasePackager;
import org.jpos.iso.ISOFieldPackager;

/**
 * BASE24 Packager made from ISO 8583 v1987 ASCII Packager
 *
 * @author Mike Trank <mi...@netcomsa.com>
 * @version $Id: PlutusB24Packager.java,v 1.1 2005/07/02 05:43:24 amit.mohan Exp $
 * @see ISOPackager
 * @see ISOBasePackager
 * @see ISOComponent
 */
 /*
 * This is almost the same as ISO87A packager, just a few of the
 *  field lengths are different, and I changed some stuff in the
 *  private fields from S-121 to S-128 that ACI BASE24 uses.
 *  There are notes where the comments are........ Mike.
 */
public class PlutusB24Packager extends ISOBasePackager {    
 private static final boolean pad = true;   
    protected ISOFieldPackager fld[] = {
     
            new IFB_NUMERIC (  4, "MESSAGE TYPE INDICATOR",pad),                       //0  
            new IFB_BITMAP  ( 8, "BIT MAP"),                                                   //1        
            new IFB_LLNUM   ( 20, "PAN - PRIMARY ACCOUNT NUMBER",pad),                              //2        
            new IFB_NUMERIC (  6, "PROCESSING CODE",pad),                                           //3        
            new IFB_NUMERIC ( 12, "AMOUNT, TRANSACTION",pad),                                       //4        
            new IFB_NUMERIC ( 12, "AMOUNT, SETTLEMENT",pad),                                        //5        
            new IFB_NUMERIC ( 12, "AMOUNT, CARDHOLDER BILLING",pad),                                //6        
            new IFB_NUMERIC ( 10, "TRANSMISSION DATE AND TIME",pad),                                //7        
            new IFA_NUMERIC (  8, "AMOUNT, CARDHOLDER BILLING FEE"),                            //8        
            new IFA_NUMERIC (  8, "CONVERSION RATE, SETTLEMENT"),                               //9        
            new IFA_NUMERIC (  8, "CONVERSION RATE, CARDHOLDER BILLING"),                       //10       
            new IFB_NUMERIC (  6, "SYSTEM TRACE AUDIT NUMBER",pad),                                 //11       
            new IFB_NUMERIC (  6, "TIME, LOCAL TRANSACTION",pad),                                   //12       
            new IFB_NUMERIC (  4, "DATE, LOCAL TRANSACTION",pad),                                   //13       
            new IFB_NUMERIC (  4, "DATE, EXPIRATION",pad),                                          //14       
            new IFB_NUMERIC (  4, "DATE, SETTLEMENT",pad),                                          //15       
            new IFA_NUMERIC (  4, "DATE, CONVERSION"),                                          //16       
            new IFB_NUMERIC (  4, "DATE, CAPTURE",pad),                                             //17       
            new IFB_NUMERIC (  4, "MERCHANTS TYPE",pad),                                            //18       
            new IFA_NUMERIC (  3, "ACQUIRING INSTITUTION COUNTRY CODE"),                        //19       
            new IFA_NUMERIC (  3, "PAN EXTENDED COUNTRY CODE"),                                 //20       
            new IFA_NUMERIC (  3, "FORWARDING INSTITUTION COUNTRY CODE"),                       //21       
            new IFB_NUMERIC (  3, "POINT OF SERVICE ENTRY MODE",pad),                               //22       
            new IFA_NUMERIC (  3, "CARD SEQUENCE NUMBER"),                                      //23       
            new IFB_NUMERIC (  3, "NETWORK INTERNATIONAL IDENTIFIEER",pad),                         //24       
            new IFB_NUMERIC (  2, "POINT OF SERVICE CONDITION CODE",pad),                           //25       
            new IFA_NUMERIC (  2, "POINT OF SERVICE PIN CAPTURE CODE"),                         //26       
            new IFA_NUMERIC (  1, "AUTHORIZATION IDENTIFICATION RESP LEN"),                     //27       
            new IFA_AMOUNT  (  9, "AMOUNT, TRANSACTION FEE"),                                   //28       
            new IFA_AMOUNT  (  9, "AMOUNT, SETTLEMENT FEE"),                                    //29       
            new IFA_AMOUNT  (  9, "AMOUNT, TRANSACTION PROCESSING FEE"),                        //30       
            new IFA_AMOUNT  (  9, "AMOUNT, SETTLEMENT PROCESSING FEE"),                         //31       
            new IFA_LLNUM   ( 11, "ACQUIRING INSTITUTION IDENT CODE"),                          //32       
            new IFA_LLNUM   ( 11, "FORWARDING INSTITUTION IDENT CODE"),                         //33       
            new IFA_LLCHAR  ( 28, "PAN EXTENDED"),                                              //34       
            new IFB_LLNUM   ( 37, "TRACK 2 DATA",pad),                                              //35       
            new IFA_LLLCHAR (104, "TRACK 3 DATA"),                                              //36       
            new IF_CHAR     ( 12, "RETRIEVAL REFERENCE NUMBER"),                                //37       
            new IF_CHAR     (  6, "AUTHORIZATION IDENTIFICATION RESPONSE"),                     //38       
            new IF_CHAR     (  2, "RESPONSE CODE"),                                             //39       
            new IF_CHAR     (  3, "SERVICE RESTRICTION CODE"),                                  //40       
            new IF_CHAR     ( 8, "CARD ACCEPTOR TERMINAL IDENTIFICACION"),                     //41       
            new IF_CHAR     ( 15, "CARD ACCEPTOR IDENTIFICATION CODE" ),                        //42       
            new IF_CHAR     ( 40, "CARD ACCEPTOR NAME/LOCATION"),                               //43       
            new IFA_LLCHAR  ( 25, "ADITIONAL RESPONSE DATA"),                                   //44       
            new IFA_LLCHAR  ( 76, "TRACK 1 DATA"),                                              //45       
            new IFA_LLLCHAR (999, "ADITIONAL DATA - ISO"),                                      //46       
            new IFA_LLLCHAR (999, "ADITIONAL DATA - NATIONAL"),                                 //47       
            new IFA_LLLCHAR (999, "ADITIONAL DATA - PRIVATE"),                                  //48       
            new IF_CHAR     (  3, "CURRENCY CODE, TRANSACTION"),                                //49       
            new IF_CHAR     (  3, "CURRENCY CODE, SETTLEMENT"),                                 //50       
            new IF_CHAR     (  3, "CURRENCY CODE, CARDHOLDER BILLING"   ),                      //51       
            new IFA_BINARY  (  8, "PIN DATA"   ),                                               //52       
            new IFA_NUMERIC ( 16, "SECURITY RELATED CONTROL INFORMATION"),                      //53       
            new IFB_LLLBINARY (12, "ADDITIONAL AMOUNTS"),                                        //54                   
            new IF_CHAR (4, "RESERVED ISO"),                                              //55       
            new IFB_LLLCHAR (999, "RESERVED ISO"),                                              //56       
            new IFB_LLLCHAR (999, "RESERVED NATIONAL"),                                         //57       
            new IFB_LLLCHAR (999, "RESERVED NATIONAL"),                                         //58       
            new IFB_LLLCHAR (999, "RESERVED NATIONAL"),                                         //59       
          new IFB_LLLBINARY (999, "RESERVED PRIVATE"),
            new IFB_LLLBINARY (999, "RESERVED PRIVATE"),                                          //61       
            new IFB_LLLBINARY (999, "RESERVED PRIVATE"),                                          //62       
            new IFB_LLLBINARY (999, "RESERVED PRIVATE"),                                          //63       
            new IFB_NUMERIC  ( 16, "MESSAGE AUTHENTICATION CODE FIELD",pad),                         //64       
            new IFA_BINARY  (  1, "BITMAP, EXTENDED"),                                          //       
            new IFA_NUMERIC (  1, "SETTLEMENT CODE"),                                           //       
            new IFA_NUMERIC (  2, "EXTENDED PAYMENT CODE"),                                     //       
            new IFA_NUMERIC (  3, "RECEIVING INSTITUTION COUNTRY CODE"),                        //       
            new IFA_NUMERIC (  3, "SETTLEMENT INSTITUTION COUNTRY CODE"),                       //       
            new IFA_NUMERIC (  3, "NETWORK MANAGEMENT INFORMATION CODE"),                       //       
            new IFA_NUMERIC (  4, "MESSAGE NUMBER"),                                            //       
            new IFA_NUMERIC (  4, "MESSAGE NUMBER LAST"),                                       //       
            new IFA_NUMERIC (  6, "DATE ACTION"),                                               //       
            new IFA_NUMERIC ( 10, "CREDITS NUMBER"),                                            //       
            new IFA_NUMERIC ( 10, "CREDITS REVERSAL NUMBER"),                                   //       
            new IFA_NUMERIC ( 10, "DEBITS NUMBER"),                                             //       
            new IFA_NUMERIC ( 10, "DEBITS REVERSAL NUMBER"),                                    //       
            new IFA_NUMERIC ( 10, "TRANSFER NUMBER"),                                           //       
            new IFA_NUMERIC ( 10, "TRANSFER REVERSAL NUMBER"),                                  //       
            new IFA_NUMERIC ( 10, "INQUIRIES NUMBER"),                                          //       
            new IFA_NUMERIC ( 10, "AUTHORIZATION NUMBER"),                                      //       
            new IFA_NUMERIC ( 12, "CREDITS, PROCESSING FEE AMOUNT"),                            //       
            new IFA_NUMERIC ( 12, "CREDITS, TRANSACTION FEE AMOUNT"),                           //       
            new IFA_NUMERIC ( 12, "DEBITS, PROCESSING FEE AMOUNT"),                             //       
            new IFA_NUMERIC ( 12, "DEBITS, TRANSACTION FEE AMOUNT"),                            //       
            new IFA_NUMERIC ( 16, "CREDITS, AMOUNT"),                                           //       
            new IFA_NUMERIC ( 16, "CREDITS, REVERSAL AMOUNT"),                                  //       
            new IFA_NUMERIC ( 16, "DEBITS, AMOUNT"),                                            //       
            new IFA_NUMERIC ( 16, "DEBITS, REVERSAL AMOUNT"),                                   //       
            new IFA_NUMERIC ( 42, "ORIGINAL DATA ELEMENTS"),                                    //       
            new IF_CHAR     (  1, "FILE UPDATE CODE"),                                          //       
            new IF_CHAR     (  2, "FILE SECURITY CODE"),                                        //       
            new IF_CHAR     (  6, "RESPONSE INDICATOR"),                                        //       
            new IF_CHAR     (  7, "SERVICE INDICATOR"),                                         //       
            new IF_CHAR     ( 42, "REPLACEMENT AMOUNTS"),                                       //       
            new IFA_BINARY  ( 16, "MESSAGE SECURITY CODE"),                                     //       
            new IFA_AMOUNT  ( 17, "AMOUNT, NET SETTLEMENT"),                                    //       
            new IF_CHAR     ( 25, "PAYEE"),                                                     //       
            new IFA_LLNUM   ( 11, "SETTLEMENT INSTITUTION IDENT CODE"),                         //       
            new IFA_LLNUM   ( 11, "RECEIVING INSTITUTION IDENT CODE"),                          //       
            new IFA_LLCHAR  ( 17, "FILE NAME"),                                                 //       
            new IFA_LLCHAR  ( 28, "ACCOUNT IDENTIFICATION 1"),                                  //       
            new IFA_LLCHAR  ( 28, "ACCOUNT IDENTIFICATION 2"),                                  //       
            new IFA_LLLCHAR (100, "TRANSACTION DESCRIPTION"),                                   //       
            new IFA_LLLCHAR (999, "RESERVED ISO USE"),                                          //       
            new IFA_LLLCHAR (999, "RESERVED ISO USE"),                                          //       
            new IFA_LLLCHAR (999, "RESERVED ISO USE"),                                          //       
            new IFA_LLLCHAR (999, "RESERVED ISO USE"),                                          //       
            new IFA_LLLCHAR (999, "RESERVED ISO USE"),                                          //       
            new IFA_LLLCHAR (999, "RESERVED ISO USE"),                                          //       
            new IFA_LLLCHAR (999, "RESERVED ISO USE"),                                          //       
            new IFA_LLLCHAR (999, "RESERVED NATIONAL USE"),                                     //       
            new IFA_LLLCHAR (999, "RESERVED NATIONAL USE"),                                     //       
            new IFA_LLLCHAR (999, "RESERVED NATIONAL USE"   ),                                  //       
            new IFA_LLLCHAR (999, "RESERVED NATIONAL USE"),                                     //       
            new IFA_LLLCHAR (999, "RESERVED NATIONAL USE"  ),                                   //       
            new IFA_LLLCHAR (999, "RESERVED NATIONAL USE"),                                     //       
            new IFA_LLLCHAR (999, "RESERVED NATIONAL USE"),                                     //       
            new IFA_LLLCHAR (999, "RESERVED NATIONAL USE"),                                     //       
            new IFA_LLLCHAR (999, "RESERVED PRIVATE USE"),                                      //       
            new IFA_LLLCHAR (23, "S-121 BASE24-POS AUTH INDICATORS"),                           //       

new IFA_LLLCHAR (999, "S-126 ATM ADDIC. DATA OR POS PRE-AUTH/CHARGEBACK"),          //       
            new IFA_LLCHAR (99, "BASE24-POS User Data"),                                       //       
            new IFA_NUMERIC (16, "MAC 2")                                                       //       
        };
    public InnoB24Packager() {
        super();
        setFieldPackager(fld);
    }
}


Regards,

Prem

2008/3/30, Prem <prem...@gmail.com>:

</div

David Bergert

unread,
Mar 31, 2008, 1:59:12 PM3/31/08
to jpos-...@googlegroups.com
Prem:

(read this without wordwrap...)

This is a good exercise on the basic's of troubleshooting ISO8583 messages,
so: (and I screwed up in my other mail and transposed some fields :))

1) Let's parse your message with some beanshell scripts:

import java.io.*;
import java.util.StringTokenizer;
import org.jpos.iso.*;
import org.jpos.util.*;
import org.jpos.iso.packager.*;

Logger logger = new Logger();
logger.addListener (new SimpleLogListener (System.out));
ISOPackager p = new GenericPackager ("build/cfg/packager/iso87binary.xml");
p.setLogger (logger, "test");

String hexData = new String(
"02 00 30 38 05 80 00 c8 00 04 00 30 00 00 00 00"
+"00 00 f0 00 15 97 10 07 55 31 03 02 00 01 00 00"
+"31 32 33 34 35 36 37 38 30 32 30 30 00 00 00 00"
+"00 00 00 00 00 00 00 76 42 31 32 33 34 35 36 37"
+"38 39 38 37 36 35 34 33 32 31 32 33 5e 6e 69 64"
+"68 69 70 61 74 68 61 6b 20 20 20 20 5e 30 33 30"
+"39 31 32 33 34 35 00 06 33 34 35 36 37 38");

StringTokenizer st = new StringTokenizer (hexData);
StringBuffer sb = new StringBuffer();
while (st.hasMoreTokens())
sb.append (st.nextToken());
byte[] b = ISOUtil.hex2byte(sb.toString());

ISOMsg m = new ISOMsg();
m.setPackager (p);
m.unpack (b);


This gives us:

<log realm="test" at="Mon Mar 31 11:53:10 GMT-06:00 2008.560">
<unpack>

02003038058000C800040030000000000000F000159710075531030200010000313233343536
3738303230300000000000000000000000764231323334353637383938373635343332313233
5E6E6964686970617468616B202020205E3033303931323334350006333435363738
<bitmap>{3, 4, 11, 12, 13, 22, 24, 25, 41, 42, 45, 62}</bitmap>
<unpack fld="3" packager="org.jpos.iso.IFB_NUMERIC">
<value>003000</value>
</unpack>
<unpack fld="4" packager="org.jpos.iso.IFB_NUMERIC">
<value>0000000000F0</value>
</unpack>
<unpack fld="11" packager="org.jpos.iso.IFB_NUMERIC">
<value>001597</value>
</unpack>
<unpack fld="12" packager="org.jpos.iso.IFB_NUMERIC">
<value>100755</value>
</unpack>
<unpack fld="13" packager="org.jpos.iso.IFB_NUMERIC">
<value>3103</value>
</unpack>
<unpack fld="22" packager="org.jpos.iso.IFB_NUMERIC">
<value>200</value>
</unpack>
<unpack fld="24" packager="org.jpos.iso.IFB_NUMERIC">
<value>100</value>
</unpack>
<unpack fld="25" packager="org.jpos.iso.IFB_NUMERIC">
<value>00</value>
</unpack>
<unpack fld="41" packager="org.jpos.iso.IF_CHAR">
<value>12345678</value>
</unpack>
<unpack fld="42" packager="org.jpos.iso.IF_CHAR">
<value>0200</value>
</unpack>


<iso-exception>
org.jpos.iso.IFB_LLCHAR: Problem unpacking field 45
<nested-exception>
java.lang.ArrayIndexOutOfBoundsException: 110

...
...
Bunch of errors:


2) Let's try to build a iso message based on these fields and with manual
parsing:


import java.io.*;
import java.util.StringTokenizer;
import org.jpos.iso.*;
import org.jpos.util.*;
import org.jpos.iso.packager.*;

Logger logger = new Logger();
logger.addListener (new SimpleLogListener (System.out));
ISOPackager p = new GenericPackager ("build/cfg/packager/iso87binary.xml");
p.setLogger (logger, "test");

ISOMsg m = new ISOMsg();

m.setMTI("0200");
m.set(3,"003000");
m.set(4,"0000000000F0");
m.set(11,"001597");
m.set(12,"100755");
m.set(13,"3103");
m.set(22,"200");
m.set(24,"100");
m.set(25,"00");
m.set(41,"12345678");
m.set(42,"200");
m.set(45,"B1234567898765432123^nidhipathak ^030912345");
m.set(62,"345678");

m.setPackager (p);
m.pack ();

<log realm="test" at="Mon Mar 31 11:20:24 GMT-06:00 2008.885">
<pack>

02003038058000C8000400300000000000006000159710075531030200010000313233343536
3738323030202020202020202020202020464231323334353637383938373635343332313233
5E6E6964686970617468616B202020205E3033303931323334350006333435363738
</pack>
</log>


Let's compare the messages:


My Message:
02003038058000C8000400300000000000006000159710075531030200010000313233343536
3738323030202020202020202020202020464231323334353637383938373635343332313233
5E6E6964686970617468616B202020205E3033303931323334350006333435363738
Your Message: ^
^^
02003038058000C800040030000000000000F000159710075531030200010000313233343536
3738303230300000000000000000000000764231323334353637383938373635343332313233
5E6E6964686970617468616B202020205E3033303931323334350006333435363738
^ who cares :)
^^

Look at the length in your message -- 76-- when the actual track 1 data
field 45. is on 46. LLCHAR is not a fixed width field...


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

Let's change the length from 76 to 46:


import java.io.*;
import java.util.StringTokenizer;
import org.jpos.iso.*;
import org.jpos.util.*;
import org.jpos.iso.packager.*;

Logger logger = new Logger();
logger.addListener (new SimpleLogListener (System.out));
ISOPackager p = new GenericPackager ("build/cfg/packager/iso87binary.xml");
p.setLogger (logger, "test");

String hexData = new String(
"02 00 30 38 05 80 00 c8 00 04 00 30 00 00 00 00"
+"00 00 f0 00 15 97 10 07 55 31 03 02 00 01 00 00"
+"31 32 33 34 35 36 37 38 30 32 30 30 00 00 00 00"
+"00 00 00 00 00 00 00 46 42 31 32 33 34 35 36 37"
^^ - changed this
+"38 39 38 37 36 35 34 33 32 31 32 33 5e 6e 69 64"
+"68 69 70 61 74 68 61 6b 20 20 20 20 5e 30 33 30"
+"39 31 32 33 34 35 00 06 33 34 35 36 37 38");

StringTokenizer st = new StringTokenizer (hexData);
StringBuffer sb = new StringBuffer();
while (st.hasMoreTokens())
sb.append (st.nextToken());
byte[] b = ISOUtil.hex2byte(sb.toString());

ISOMsg m = new ISOMsg();
m.setPackager (p);
m.unpack (b);


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

<log realm="test" at="Mon Mar 31 11:23:28 GMT-06:00 2008.705">
<unpack>

02003038058000C800040030000000000000F000159710075531030200010000313233343536
3738303230300000000000000000000000464231323334353637383938373635343332313233
5E6E6964686970617468616B202020205E3033303931323334350006333435363738
<bitmap>{3, 4, 11, 12, 13, 22, 24, 25, 41, 42, 45, 62}</bitmap>
<unpack fld="3" packager="org.jpos.iso.IFB_NUMERIC">
<value>003000</value>
</unpack>
<unpack fld="4" packager="org.jpos.iso.IFB_NUMERIC">
<value>0000000000F0</value>
</unpack>
<unpack fld="11" packager="org.jpos.iso.IFB_NUMERIC">
<value>001597</value>
</unpack>
<unpack fld="12" packager="org.jpos.iso.IFB_NUMERIC">
<value>100755</value>
</unpack>
<unpack fld="13" packager="org.jpos.iso.IFB_NUMERIC">
<value>3103</value>
</unpack>
<unpack fld="22" packager="org.jpos.iso.IFB_NUMERIC">
<value>200</value>
</unpack>
<unpack fld="24" packager="org.jpos.iso.IFB_NUMERIC">
<value>100</value>
</unpack>
<unpack fld="25" packager="org.jpos.iso.IFB_NUMERIC">
<value>00</value>
</unpack>
<unpack fld="41" packager="org.jpos.iso.IF_CHAR">
<value>12345678</value>
</unpack>
<unpack fld="42" packager="org.jpos.iso.IF_CHAR">
<value>0200</value>
</unpack>
<unpack fld="45" packager="org.jpos.iso.IFB_LLCHAR">
<value>B1234567898765432123^nidhipathak ^030912345</value>
</unpack>
<unpack fld="62" packager="org.jpos.iso.IFB_LLLCHAR">
<value>345678</value>
</unpack>
</unpack>
</log>

Volia :)

David Bergert
http://www.paymentsystemsblog.com

Prem Gupta

unread,
Apr 1, 2008, 10:11:54 AM4/1/08
to jpos-...@googlegroups.com
Thank you so much..
 
I have resolved hte prblem with your explanations....

Reply all
Reply to author
Forward
0 new messages