Reputation: 1491
I need to unpack and get the MTI , present data element values of
303831308220000002000000040000000000000031313233303930323333303733313536303033303
1 message string .So as you can see MTI should be 3038
.But When I get the MTI value using the isoMsg.getMTI();
statement it gives 0810
as the output.So What's the issue of my code? Please see this tutorial.https://kodejava.org/how-do-i-unpack-an-iso-8583-message/ In there first four fields coming as MTI but I am not getting my first four fields as the MTI .Please provide a detailed answer.
public class IsoUnpacker {
public static void main(String[] args) {
String message = "3038313082200000020000000400000000000000313132333039303233333037333135363030333031";
IsoUnpacker iso = new IsoUnpacker();
try {
ISOMsg isoMsg = iso.parseISOMessage(message);
iso.printISOMessage(isoMsg);
} catch (Exception e) {
e.printStackTrace();
}
}
private ISOMsg parseISOMessage(String message) throws Exception {
System.out.printf("Message = %s%n", message);
try {
ISOMsg isoMsg= new ISOMsg();
GenericValidatingPackager packager = new GenericValidatingPackager();
packager.readFile("C:\\Users\\Hasindu\\Documents\\ISO_Unpacker\\iso_unpacking\\src\\resources\\fields.xml");
isoMsg.setPackager(packager);
isoMsg.unpack(ISOUtil.hex2byte(message));
return isoMsg;
} catch (ISOException e) {
System.out.println(e.getMessage());
}
return null ;
}
private void printISOMessage(ISOMsg isoMsg) {
try {
System.out.printf("MTI = %s%n", isoMsg.getMTI());
for (int i = 1; i <= isoMsg.getMaxField(); i++) {
if (isoMsg.hasField(i)) {
System.out.printf("Field (%s) = %s%n", i, isoMsg.getString(i));
}
}
} catch (ISOException e) {
e.printStackTrace();
}
}
}
fields.xml file
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE isopackager PUBLIC
"-//jPOS/jPOS Generic Packager DTD 1.0//EN"
"http://jpos.org/dtd/generic-packager-1.0.dtd">
<!-- ISO 8583:1987 (ASCII) field descriptions for GenericPackager -->
<!-- Bitmap is BINARY in this case -->
<isopackager>
<isofield
id="0"
length="4"
name="MESSAGE TYPE INDICATOR"
class="org.jpos.iso.IFA_NUMERIC"/>
<isofield
id="1"
length="16"
name="BIT MAP"
class="org.jpos.iso.IFB_BITMAP"/>
<isofield
id="2"
length="19"
name="PAN - PRIMARY ACCOUNT NUMBER"
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, SETTLEMENT"
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="TRANSMISSION DATE AND TIME"
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, SETTLEMENT"
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="SYSTEM TRACE AUDIT NUMBER"
class="org.jpos.iso.IFA_NUMERIC"/>
<isofield
id="12"
length="6"
name="TIME, LOCAL TRANSACTION"
class="org.jpos.iso.IFA_NUMERIC"/>
<isofield
id="13"
length="4"
name="DATE, LOCAL TRANSACTION"
class="org.jpos.iso.IFA_NUMERIC"/>
<isofield
id="14"
length="4"
name="DATE, EXPIRATION"
class="org.jpos.iso.IFA_NUMERIC"/>
<isofield
id="15"
length="4"
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="MERCHANTS TYPE"
class="org.jpos.iso.IFA_NUMERIC"/>
<isofield
id="19"
length="3"
name="ACQUIRING INSTITUTION COUNTRY CODE"
class="org.jpos.iso.IFA_NUMERIC"/>
<isofield
id="20"
length="3"
name="PAN EXTENDED COUNTRY CODE"
class="org.jpos.iso.IFA_NUMERIC"/>
<isofield
id="21"
length="3"
name="FORWARDING INSTITUTION COUNTRY CODE"
class="org.jpos.iso.IFA_NUMERIC"/>
<isofield
id="22"
length="3"
name="POINT OF SERVICE ENTRY MODE"
class="org.jpos.iso.IFA_NUMERIC"/>
<isofield
id="23"
length="3"
name="CARD SEQUENCE NUMBER"
class="org.jpos.iso.IFA_NUMERIC"/>
<isofield
id="24"
length="3"
name="NETWORK INTERNATIONAL IDENTIFIEER"
class="org.jpos.iso.IFA_NUMERIC"/>
<isofield
id="25"
length="2"
name="POINT OF SERVICE CONDITION CODE"
class="org.jpos.iso.IFA_NUMERIC"/>
<isofield
id="26"
length="2"
name="POINT OF SERVICE PIN CAPTURE CODE"
class="org.jpos.iso.IFA_NUMERIC"/>
<isofield
id="27"
length="1"
name="AUTHORIZATION IDENTIFICATION RESP LEN"
class="org.jpos.iso.IFA_NUMERIC"/>
<isofield
id="28"
length="9"
name="AMOUNT, TRANSACTION FEE"
class="org.jpos.iso.IFA_AMOUNT"/>
<isofield
id="29"
length="9"
name="AMOUNT, SETTLEMENT FEE"
class="org.jpos.iso.IFA_AMOUNT"/>
<isofield
id="30"
length="9"
name="AMOUNT, TRANSACTION PROCESSING FEE"
class="org.jpos.iso.IFA_AMOUNT"/>
<isofield
id="31"
length="9"
name="AMOUNT, SETTLEMENT PROCESSING FEE"
class="org.jpos.iso.IFA_AMOUNT"/>
<isofield
id="32"
length="11"
name="ACQUIRING INSTITUTION IDENT CODE"
class="org.jpos.iso.IFA_LLNUM"/>
<isofield
id="33"
length="11"
name="FORWARDING INSTITUTION IDENT CODE"
class="org.jpos.iso.IFA_LLNUM"/>
<isofield
id="34"
length="28"
name="PAN EXTENDED"
class="org.jpos.iso.IFA_LLCHAR"/>
<isofield
id="35"
length="37"
name="TRACK 2 DATA"
class="org.jpos.iso.IFA_LLNUM"/>
<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="AUTHORIZATION IDENTIFICATION RESPONSE"
class="org.jpos.iso.IF_CHAR"/>
<isofield
id="39"
length="2"
name="RESPONSE CODE"
class="org.jpos.iso.IF_CHAR"/>
<isofield
id="40"
length="3"
name="SERVICE RESTRICTION CODE"
class="org.jpos.iso.IF_CHAR"/>
<isofield
id="41"
length="8"
name="CARD ACCEPTOR TERMINAL IDENTIFICACION"
class="org.jpos.iso.IF_CHAR"/>
<isofield
id="42"
length="15"
name="CARD ACCEPTOR IDENTIFICATION CODE"
class="org.jpos.iso.IF_CHAR"/>
<isofield
id="43"
length="40"
name="CARD ACCEPTOR NAME/LOCATION"
class="org.jpos.iso.IF_CHAR"/>
<isofield
id="44"
length="25"
name="ADITIONAL RESPONSE DATA"
class="org.jpos.iso.IFA_LLCHAR"/>
<isofield
id="45"
length="76"
name="TRACK 1 DATA"
class="org.jpos.iso.IFA_LLCHAR"/>
<isofield
id="46"
length="999"
name="ADITIONAL DATA - ISO"
class="org.jpos.iso.IFA_LLLCHAR"/>
<isofield
id="47"
length="999"
name="ADITIONAL DATA - NATIONAL"
class="org.jpos.iso.IFA_LLLCHAR"/>
<isofield
id="48"
length="999"
name="ADITIONAL 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, 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.IFA_BINARY"/>
<isofield
id="53"
length="16"
name="SECURITY RELATED CONTROL INFORMATION"
class="org.jpos.iso.IFA_NUMERIC"/>
<isofield
id="54"
length="120"
name="ADDITIONAL AMOUNTS"
class="org.jpos.iso.IFA_LLLCHAR"/>
<isofield
id="55"
length="999"
name="RESERVED ISO"
class="org.jpos.iso.IFA_LLLCHAR"/>
<isofield
id="56"
length="999"
name="RESERVED ISO"
class="org.jpos.iso.IFA_LLLCHAR"/>
<isofield
id="57"
length="999"
name="RESERVED NATIONAL"
class="org.jpos.iso.IFA_LLLCHAR"/>
<isofield
id="58"
length="999"
name="RESERVED NATIONAL"
class="org.jpos.iso.IFA_LLLCHAR"/>
<isofield
id="59"
length="999"
name="RESERVED NATIONAL"
class="org.jpos.iso.IFA_LLLCHAR"/>
<isofield
id="60"
length="999"
name="RESERVED PRIVATE"
class="org.jpos.iso.IFA_LLLCHAR"/>
<isofield
id="61"
length="999"
name="RESERVED PRIVATE"
class="org.jpos.iso.IFA_LLLCHAR"/>
<isofield
id="62"
length="999"
name="RESERVED PRIVATE"
class="org.jpos.iso.IFA_LLLCHAR"/>
<isofield
id="63"
length="999"
name="RESERVED PRIVATE"
class="org.jpos.iso.IFA_LLLCHAR"/>
<isofield
id="64"
length="8"
name="MESSAGE AUTHENTICATION CODE FIELD"
class="org.jpos.iso.IFA_BINARY"/>
<isofield
id="65"
length="1"
name="BITMAP, EXTENDED"
class="org.jpos.iso.IFA_BINARY"/>
<isofield
id="66"
length="1"
name="SETTLEMENT CODE"
class="org.jpos.iso.IFA_NUMERIC"/>
<isofield
id="67"
length="2"
name="EXTENDED PAYMENT CODE"
class="org.jpos.iso.IFA_NUMERIC"/>
<isofield
id="68"
length="3"
name="RECEIVING INSTITUTION COUNTRY CODE"
class="org.jpos.iso.IFA_NUMERIC"/>
<isofield
id="69"
length="3"
name="SETTLEMENT INSTITUTION COUNTRY CODE"
class="org.jpos.iso.IFA_NUMERIC"/>
<isofield
id="70"
length="3"
name="NETWORK MANAGEMENT INFORMATION CODE"
class="org.jpos.iso.IFA_NUMERIC"/>
<isofield
id="71"
length="4"
name="MESSAGE NUMBER"
class="org.jpos.iso.IFA_NUMERIC"/>
<isofield
id="72"
length="4"
name="MESSAGE NUMBER LAST"
class="org.jpos.iso.IFA_NUMERIC"/>
<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="AUTHORIZATION NUMBER"
class="org.jpos.iso.IFA_NUMERIC"/>
<isofield
id="82"
length="12"
name="CREDITS, PROCESSING FEE AMOUNT"
class="org.jpos.iso.IFA_NUMERIC"/>
<isofield
id="83"
length="12"
name="CREDITS, TRANSACTION FEE AMOUNT"
class="org.jpos.iso.IFA_NUMERIC"/>
<isofield
id="84"
length="12"
name="DEBITS, PROCESSING FEE AMOUNT"
class="org.jpos.iso.IFA_NUMERIC"/>
<isofield
id="85"
length="12"
name="DEBITS, TRANSACTION FEE AMOUNT"
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="42"
name="ORIGINAL DATA ELEMENTS"
class="org.jpos.iso.IFA_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.IFA_BINARY"/>
<isofield
id="97"
length="17"
name="AMOUNT, NET SETTLEMENT"
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 IDENT CODE"
class="org.jpos.iso.IFA_LLNUM"/>
<isofield
id="100"
length="11"
name="RECEIVING INSTITUTION IDENT 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="999"
name="RESERVED ISO USE"
class="org.jpos.iso.IFA_LLLCHAR"/>
<isofield
id="106"
length="999"
name="RESERVED ISO USE"
class="org.jpos.iso.IFA_LLLCHAR"/>
<isofield
id="107"
length="999"
name="RESERVED ISO USE"
class="org.jpos.iso.IFA_LLLCHAR"/>
<isofield
id="108"
length="999"
name="RESERVED ISO USE"
class="org.jpos.iso.IFA_LLLCHAR"/>
<isofield
id="109"
length="999"
name="RESERVED ISO USE"
class="org.jpos.iso.IFA_LLLCHAR"/>
<isofield
id="110"
length="999"
name="RESERVED ISO USE"
class="org.jpos.iso.IFA_LLLCHAR"/>
<isofield
id="111"
length="999"
name="RESERVED ISO USE"
class="org.jpos.iso.IFA_LLLCHAR"/>
<isofield
id="112"
length="999"
name="RESERVED NATIONAL USE"
class="org.jpos.iso.IFA_LLLCHAR"/>
<isofield
id="113"
length="999"
name="RESERVED NATIONAL USE"
class="org.jpos.iso.IFA_LLLCHAR"/>
<isofield
id="114"
length="999"
name="RESERVED NATIONAL USE"
class="org.jpos.iso.IFA_LLLCHAR"/>
<isofield
id="115"
length="999"
name="RESERVED NATIONAL USE"
class="org.jpos.iso.IFA_LLLCHAR"/>
<isofield
id="116"
length="999"
name="RESERVED NATIONAL USE"
class="org.jpos.iso.IFA_LLLCHAR"/>
<isofield
id="117"
length="999"
name="RESERVED NATIONAL USE"
class="org.jpos.iso.IFA_LLLCHAR"/>
<isofield
id="118"
length="999"
name="RESERVED NATIONAL USE"
class="org.jpos.iso.IFA_LLLCHAR"/>
<isofield
id="119"
length="999"
name="RESERVED NATIONAL USE"
class="org.jpos.iso.IFA_LLLCHAR"/>
<isofield
id="120"
length="999"
name="RESERVED PRIVATE USE"
class="org.jpos.iso.IFA_LLLCHAR"/>
<isofield
id="121"
length="999"
name="RESERVED PRIVATE USE"
class="org.jpos.iso.IFA_LLLCHAR"/>
<isofield
id="122"
length="999"
name="RESERVED PRIVATE USE"
class="org.jpos.iso.IFA_LLLCHAR"/>
<isofield
id="123"
length="999"
name="RESERVED PRIVATE USE"
class="org.jpos.iso.IFA_LLLCHAR"/>
<isofield
id="124"
length="999"
name="RESERVED PRIVATE USE"
class="org.jpos.iso.IFA_LLLCHAR"/>
<isofield
id="125"
length="999"
name="RESERVED PRIVATE USE"
class="org.jpos.iso.IFA_LLLCHAR"/>
<isofield
id="126"
length="999"
name="RESERVED PRIVATE USE"
class="org.jpos.iso.IFA_LLLCHAR"/>
<isofield
id="127"
length="999"
name="RESERVED PRIVATE USE"
class="org.jpos.iso.IFA_LLLCHAR"/>
<isofield
id="128"
length="8"
name="MAC 2"
class="org.jpos.iso.IFA_BINARY"/>
</isopackager>
Output:
Message = 3038313082200000020000000400000000000000313132333039303233333037333135363030333031
MTI = 0810
Field (7) = 1123090233
Field (11) = 073156
Field (39) = 00
Field (70) = 301
Upvotes: 1
Views: 3304
Reputation: 1125
Everything is OK in your approach, everyone tried explaining the same, but allow me to clear first basics for you and then will try to answer all your questions which either you have asked in OP or in comments.
Understand ISO 8583 (Disclaimer : my words & from Wikipedia)
It is an international standard for financial transaction messaging. It comes with a defined format and many big Schemes like MasterCard, Visa make use of it. By definition, first 4 places is MTI -> Message Type Indicator. And so on there digits with their places have a defined meaning.
Basically Defining what kind of message is this? Now, as mentioned this a standard protocol that means even valid MTI's are defined. So while learning or understanding ISO 8583 you should start learning what are valid MTIs are?
Now I strongly suggest to read this section before reading further : MTI_Wiki
After reading you might have understood that - a message type indicator includes the ISO 8583 version, the Message Class, the Message Function and the Message Origin. That is : those 4 digits explains above 3 things.
Taking an example of your message : 303831xxxxxxxxxxxxxxxxxxxxxx
Now if we go by your message and also look at the link I shared above, the first digit 3 in 3038xx
as per ISO 8583 is not available for use and rather is reserved by ISO itself.
That means - what you were expecting initially as MTI 3038
- is not even a valid MTI !!
which further should have made you realized that this is either a wrong message or an encoded message in by some means.
And in your case it is the latter, as it is Hexadecimal encoded message which totally ok as many business entities can have any type of agreement of choosing.
Having said that, you must understand in order to use any ISO library to pack or unpack or anything else you must first translate your message in valid ISO 8583 format.
So your decision to use isoMsg.unpack(ISOUtil.hex2byte(message));
is absolutely valid in this situation and of course this isoMsg.unpack(message.getBytes());
is bound to fail because when you say message.getBytes()
you are not passing a valid ISO 8583 message to the standard unpack function.
So in your message :
Message = 3038313082200000020000000400000000000000313132333039303233333037333135363030333031
Having 30383130 (hex encoded) is
MTI = 0810
How to know if message is base-16 (Hex encoded)?
For this highly recommended to have an agreement from the initiator acquirer/terminal/anyInterface to let the consumer/bank/anyInterface know what format the message will arrive in.
These are standard practices across organization, this way responders are then configured. And I am sure, from this initiator where you are receiving 303831xxxxxxxxxx , it will not be that tomorrow you'll start receiving 0810xxxx (like in ASCII) unless they change there configuration/set up at their end for which you/your company must be informed. As for a financial transaction to be successful all binding parties have a role to play.
I am not able to recollect any library to detect encoding, of course , you can have some thing which can detect but still I would request to get this standardized as an agreement between the parties like I said above.
Pro tip : Over time, you'll yourself will be able to tell the encoding or what kind of message it is, by just looking at MTI ;) ! Trust me!
Hope I answered all your doubts, if anymore do not hesitate to ask. Good luck!
Upvotes: 1
Reputation: 684
Try this:
package org.kodejava.example.jpos;
import org.jpos.iso.ISOException;
import org.jpos.iso.ISOMsg;
import org.jpos.iso.packager.GenericPackager;
import java.io.InputStream;
public class IsoUnpacker {
public static void main(String[] args) {
IsoUnpacker iso = new IsoUnpacker();
try {
String message = "02003220000000808000000010000000001500120604120000000112340001840";
ISOMsg isoMsg = iso.parseISOMessage(message);
iso.printISOMessage(isoMsg);
} catch (Exception e) {
e.printStackTrace();
}
}
private ISOMsg parseISOMessage(String message) throws Exception {
System.out.printf("Message = %s%n", message);
try {
// Load package from resources directory.
InputStream is = getClass().getResourceAsStream("C:\\Users\\Hasindu\\Documents\\ISO_Unpacker\\iso_unpacking\\src\\resources\\fields.xm");
GenericPackager packager = new GenericPackager(is);
ISOMsg isoMsg = new ISOMsg();
isoMsg.setPackager(packager);
isoMsg.unpack(message.getBytes());
return isoMsg;
} catch (ISOException e) {
throw new Exception(e);
}
}
private void printISOMessage(ISOMsg isoMsg) {
try {
System.out.printf("MTI = %s%n", isoMsg.getMTI());
for (int i = 1; i <= isoMsg.getMaxField(); i++) {
if (isoMsg.hasField(i)) {
System.out.printf("Field (%s) = %s%n", i, isoMsg.getString(i));
}
}
} catch (ISOException e) {
e.printStackTrace();
}
}
}
Upvotes: 0
Reputation: 2217
This is a valid and well formed message. MTI 0810 = Network Management Response, field 70, the network management information code, 301 means echo test, field 39 = 00 means OK, field 11 is the system trace audit number, an id of the message that ties the response to the request, and field 7 is the date and time, 23 November, 09:02:33.
The bit map is 82200000020000000400000000000000. Count the bits, starting with 1, and you get 1, 7, 11, 39 and 70. Field 1 is the second bit map.
ISO 8583 is a rather loose standard, and each implementation is slightly different. For example, each card brand has their own version. But this particular example is standard.
I did not compare it with the reference you gave but with a version of the standard.
Upvotes: 0
Reputation: 86774
This isn't a complete answer but it's too big for a comment, and may help you figure out the issue.
Note:
3038313082200000020000000400000000000000313132333039303233333037333135363030333031
This appears to be a hex-encoded ASCII string with some binary stuff near the beginning
If I convert to ASCII while guessing that the binary bits are 32-bit little-endian integers I get
"0810" ASCII
0x00002082
0x00000002
0x00000004
0x00000000
"112309023307315600301" ASCII
I hope this helps you figure out the problem.
Upvotes: 0