Problem testing example msg

134 views
Skip to first unread message

Luiz Felipph

unread,
Mar 13, 2016, 9:43:27 AM3/13/16
to jpos-...@googlegroups.com
Greatings,

I'm trying to unpack a example msg but no success, What I'm doing wrong?

example:
0200B238440020C0000820000000000000000030000000000010000525181822284406181822052500020212200190162957680020620122019163900000000021301700300101

bitmap:
B238440020C000082000000000000000

Bits: 10110010001110000100010000000000001000001100000000000000000010000010000000000000000000000000000000000000000000000000000000000000

expected resul:

BIT [003] 003000
BIT [004] 000000001000
BIT [007] 0525181822
BIT [011] 284406
BIT [012] 181822
BIT [013] 0525
BIT [018] 0002
BIT [022] 021
BIT [035] (22) 0019016295768002062012
BIT [041] 20191639
BIT [042] 000000000213017
BIT [061] (003) 001
BIT [067] 01



String msg = "0200B238440020C0000820000000000000000030000000000010000525181822284406181822052500020212200190162957680020620122019163900000000021301700300101";
        byte[] bMsg = ISOUtil.hex2byte(msg);
        ISOMsg reqMsg = new ISOMsg();
        GenericPackager gp = new GenericPackager("packager/test.xml");      
        reqMsg.setPackager(gp);
        reqMsg.unpack(bMsg);



I'm getting exception:
Exception in thread "main" org.jpos.iso.ISOException: org.jpos.iso.IF_CHAR: Problem unpacking field 41 (java.lang.StringIndexOutOfBoundsException: String index out of range: 73) unpacking field=41, consumed=65
at org.jpos.iso.ISOBasePackager.unpack(ISOBasePackager.java:268)
at org.jpos.iso.ISOMsg.unpack(ISOMsg.java:454)

Using this XML as base:

ISO 8583:1987 (BINARY) field descriptions for GenericPackager

BIT 41:

  <isofield
      id="41"
      length="8"
      name="CARD ACCEPTOR TERMINAL IDENTIFICACION"
      class="org.jpos.iso.IF_CHAR"/>

From specs:

Bit 41: AN(Aphanumeric) size: 8

Thank you

Felipph

chhil

unread,
Mar 13, 2016, 10:25:37 AM3/13/16
to jpos-...@googlegroups.com


What you can also do is wrap the unpack call in a try catch block. In the catch block dump the isomsg,  it will show you the isomsg in xml format to the point it was unpacked.

You can compare the field definitions and see if expected match what you are seeing. You will see some field that may have data but it will still be incorrect due to the packager. What I am trying to say is field 41 may not be the problem and an earlier field unpack due to a wrong definition caused it to get misaligned and eventually got caught up at field 41.

If you still can't figure it out, please share the entire of test.xml.

-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/CABCV0cyO1kBBUJKZARthZ3zP_YaV-bCg3A7ujO38DNTyGOhcbg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Luiz Felipph

unread,
Mar 13, 2016, 12:02:04 PM3/13/16
to jpos-...@googlegroups.com
Thank you Chill,

Still getting error. Field 35 has another zero at begining . Field 22, I fixed defining pad=false, but 25 not.



----ISO MESSAGE-----
mar 13, 2016 12:36:30 PM com.maxxcard.testes.Test main
  MTI : 0200
GRAVE: null
    Field-3 : 003000
    Field-4 : 000000001000
    Field-7 : 0525181822
    Field-11 : 284406
    Field-12 : 181822
org.jpos.iso.ISOException: org.jpos.iso.IF_CHAR: Problem unpacking field 42 (java.lang.StringIndexOutOfBoundsException: String index out of range: 74) unpacking field=42, consumed=59
    Field-13 : 0525
    Field-18 : 0002
    Field-22 : 021
    Field-35 : 01901629576800206201
    Field-41 : 22019163


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

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

<isopackager>
  <isofield
      id="0"
      length="4"
      name="MESSAGE TYPE INDICATOR"
      pad="false"
      class="org.jpos.iso.IFB_NUMERIC"/>
  <isofield
      id="1"
      length="16"
      name="BIT MAP"
      class="org.jpos.iso.IFB_BITMAP"/>
  <isofield
      id="2"
      length="19"
      name="PAN - PRIMARY ACCOUNT NUMBER"
      pad="false"
      class="org.jpos.iso.IFB_NUMERIC"/>

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

The iso SPECs say: 
BIt 35 Track 2 format: LLVAR type: z size: 37

z type: track2 and track3 characters.


Thank you


Felipph

Mark Salter

unread,
Mar 13, 2016, 1:44:52 PM3/13/16
to jpos-...@googlegroups.com
On 13/03/16 13:42, Luiz Felipph wrote:
>
> I'm trying to unpack a example msg but no success, What I'm doing wrong
You have not asked a smart question:-

http://www.catb.org/esr/faqs/smart-questions.html



Showing us want you want without any other information is just pointless.

The first this you should have done is match the packager to the
interface specification...

... field lengths and formats.

>
> example:
> 0200B238440020C0000820000000000000000030000000000010000525181822284406181822052500020212200190162957680020620122019163900000000021301700300101
Is this a Character hex representation or a character example - useful
to be sure.

> expected resul:
>
[snip]
> BIT [035] (22) 0019016295768002062012
[snip]
> BIT [061] (003) 001
[snip]

Given these are the only fields present that have a length - get the
definitions for these perfect first - any problems in extracting their
lengths (wrong start location or wrong format) will send everything else
out.

> I'm getting exception:
> Exception in thread "main" org.jpos.iso.ISOException:
> org.jpos.iso.IF_CHAR: Problem unpacking field 41
> (java.lang.StringIndexOutOfBoundsException: String index out of range:
> 73) unpacking field=41, consumed=65
The parse has flown off the end of the available data as it tries to
parse field 41 - your packager selection is bad; assuming the example
is meant to parse cleanly - so the problem is *before* 41.

Check all field definitions in your interface specification match the
packager chosen. Do this first/now.

--
Mark

Luiz Felipph

unread,
Mar 14, 2016, 2:22:46 AM3/14/16
to jpos-...@googlegroups.com
Hi Mark, good morning,

> I'm trying to unpack a example msg but no success, What I'm doing wrong
You have not asked a smart question:-
http://www.catb.org/esr/faqs/smart-questions.html

Agreed

The first this you should have done is match the packager to the
interface specification...
... field lengths and formats.

Yes, I revised many times to search what I missed.


> expected resul:
>
[snip]
> BIT [035] (22) 0019016295768002062012
[snip]
> BIT [061] (003) 001
[snip]

Check, but one zero at begninng is missing. Then whole field should be:
220019016295768002062012

Why is jumping the first zero?

I got the message unpacked but is not correct because the missing zero at bit 35

----ISO MESSAGE-----
  MTI : 0200
    Field-3 : 003000
    Field-4 : 000000001000
    Field-7 : 0525181822
    Field-11 : 284406
    Field-12 : 181822
    Field-13 : 0525
    Field-18 : 0002
    Field-22 : 021
    Field-35 : 01901629576800206201
    Field-41 : 22019163
    Field-42 : 900000000021301
    Field-61 : 
    Field-67 : 30

Changing a little bit the rest of elements:

 MTI : 0200
    Field-3 : 003000
    Field-4 : 000000001000
    Field-7 : 0525181822
    Field-11 : 284406
    Field-12 : 181822
    Field-13 : 0525
    Field-18 : 0002
    Field-22 : 021
    Field-35 : 01901629576800206201 <- missing a zero at begnning
    Field-41 : 22019163
    Field-42 : 9000000000213017 <- ADDED 1 to size to show 61 right
    Field-61 : 003001 <- ajusted to show size and value.It is a LLLVAR BINARY(IFB_LLLBINARY) when I put the right type I get a exception: Problem unpacking field 61 (org.jpos.iso.ISOException: Field length 30 too long. Max: 16

    Field-67 : 01

Probaly a elementary question, but why 003 is interpreted as 30?

Thank you


Felipph

--
--
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,
Mar 14, 2016, 2:46:22 AM3/14/16
to jpos-...@googlegroups.com
​​
​​
​​From Marks earlier response.​


On Sun, Mar 13, 2016 at 11:14 PM, Mark Salter <marks...@talktalk.net> wrote:
> example:
> 0200B238440020C0000820000000000000000030000000000010000525181822284406181822052500020212200190162957680020620122019163900000000021301700300101
Is this a Character hex representation or a character example - useful
to be sure.

​Basically a byte array obtained from a pack operation should be able to unpack it also. So if you set your ISOMsg with data that you expect, you should get the same hexdump as what was



        String hex = "0200B238440020C0000820000000000000000030000000000010000525181822284406181822052500020212200190162957680020620122019163900000000021301700300101";
        byte[] b = ISOUtil.hex2byte(hex);;
        Logger l = new Logger();
        l.addListener(new SimpleLogListener(System.out));
        GenericPackager p;
        ISOMsg m = new ISOMsg();

        try {


            System.out.println(ISOUtil.hexdump(hex.getBytes()));
            p = new GenericPackager(
                    "C:\\SourceRepo\\OII\\Incomm\\build\\cfg\\test.xml");

            p.setLogger(l, "");

            m.set(0,"0200");

            m.set(3,"003000");
            m.set(4,"000000001000");
            m.set(7,"0525181822");
            m.set(11, "284406");
            m.set(12, "181822");
            m.set(13,"0525");
            m.set(18,"0002");
            m.set(22,"021");
            m.set(35,"0019016295768002062012");
            m.set(41,"20191639");
            m.set(42,"000000000213017");
            m.set(61,"001");
            m.set(67,"01");
            m.setPackager(p);
           System.out.println(ISOUtil.hexdump(m.pack()));


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

    



​The output of            System.out.println(ISOUtil.hexdump(m.pack()));

0000  02 00 B2 38 44 00 20 C0  00 08 20 00 00 00 00 00  ...8D. ... .....
0010  00 00 00 30 00 00 00 00  00 10 00 05 25 18 18 22  ...0........%.."
0020  28 44 06 18 18 22 05 25  00 02 02 10 22 00 19 01  (D...".%...."...
0030  62 95 76 80 02 06 20 12  20 19 16 39 30 30 30 30  b.v... . ..90000
0040  30 30 30 30 30 32 31 33  30 31 37 03 30 30 31 01  00000213017.001.


Modifeid test.xml

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE isopackager SYSTEM "genericpackager_pci.dtd">
      pad="true"
      class="org.jpos.iso.IFB_NUMERIC"/>
  <isofield
      id="19"
      length="3"
      name="ACQUIRING INSTITUTION COUNTRY CODE"
      pad="false"
      class="org.jpos.iso.IFB_NUMERIC"/>
  <isofield
      id="20"
      length="3"
      name="PAN EXTENDED COUNTRY CODE"
      pad="false"
      class="org.jpos.iso.IFB_NUMERIC"/>
  <isofield
      id="21"
      length="3"
      name="FORWARDING INSTITUTION COUNTRY CODE"
      pad="false"
      class="org.jpos.iso.IFB_NUMERIC"/>
  <isofield
      id="22"
      length="3"
      pad="false"
      name="POINT OF SERVICE ENTRY MODE"
      
  <isofield
      id="41"
      length="8"
      name="CARD ACCEPTOR TERMINAL IDENTIFICACION"
      class="org.jpos.iso.IFB_NUMERIC"/>
  <isofield
      id="42"
      length="15"
      name="CARD ACCEPTOR IDENTIFICATION CODE"
      class="org.jpos.iso.IFB_NUMERIC"/>
  <isofield
      id="43"
      length="40"
      name="CARD ACCEPTOR NAME/LOCATION"
      class="org.jpos.iso.IFB_NUMERIC"/>
      pad="false"
      class="org.jpos.iso.IFB_LLNUM"/>
  <isofield

Your hex
```
0200B238440020C000082000000000000000003000000000001000052518182228440618182205250002021 22001901629576800206201220191639000000000213017003001 01
```
My hex after setting field and updated packager
```
0200B238440020C000082000000000000000003000000000001000052518182228440618182205250002021022001901629576800206201220191639000000000213017003001001
```
There is some misalignement and it most probably dude to padding byte. I have left spaces intentionally in your hex to show that the packager is almost there. Hopefully you can figure out whats missing or someone can assist you to take it forward.

-chhil




Luiz Felipph

unread,
Mar 14, 2016, 8:36:37 AM3/14/16
to jpos-...@googlegroups.com
Good Morning,

Please, correct me if I'm wrong:

ISO87APackager should reflect the same effect of GenericPackager + iso87ascii.xml?

I made some modifications on ISO87APackager to fit the interface( basically fields lengths(didn't changed any data type)) and worked.

MTI = 0200
Field (3) = 003000
Field (4) = 000000001000
Field (7) = 0525181822
Field (11) = 284406
Field (12) = 181822
Field (13) = 0525
Field (18) = 0002
Field (22) = 021
Field (35) = 0019016295768002062012
Field (41) = 20191639
Field (42) = 000000000213017
Field (61) = 001
Field (67) = 01

Thank you.

Felipph

--
--
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.

Alejandro Revilla

unread,
Mar 14, 2016, 12:13:58 PM3/14/16
to jPOS Users


ISO87APackager should reflect the same effect of GenericPackager + iso87ascii.xml?


​Correct.
 
I made some modifications on ISO87APackager to fit the interface( basically fields lengths(didn't changed any data type)) and worked.

MTI = 0200
Field (3) = 003000
Field (4) = 000000001000
Field (7) = 0525181822
Field (11) = 284406
Field (12) = 181822
Field (13) = 0525
Field (18) = 0002
Field (22) = 021
Field (35) = 0019016295768002062012
Field (41) = 20191639
Field (42) = 000000000213017
Field (61) = 001
Field (67) = 01


​Which field length did you have to fix?
 

Luiz Felipph

unread,
Mar 14, 2016, 1:28:31 PM3/14/16
to jpos-...@googlegroups.com
Hi,

After code revision, both ways worked just as expected. The error was converting the msg from HEX to Byte. :

Wrong:
byte[] bMsg = ISOUtil.hex2byte(msg);
reqMsg.unpack(bMsg );

Correct:
reqMsg.unpack(msg.getBytes());

The sizes mentioned was fields 12 and 22 from ISO93APackager. No needed to ISO87APackager(worked out of box).

Thank you for your atention.

Felipph

--
--
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.

Alejandro Revilla

unread,
Mar 14, 2016, 1:44:49 PM3/14/16
to jPOS Users
Perfect. Thank you for the confirmation.


Reply all
Reply to author
Forward
0 new messages