1

I am writing application for ISO8583 financial transaction.

When I send the ISO string to the corresponding client server then I am getting same response (15-03-00-00-02-02-0A) even for dummy data.

finally Client advised me to send ISO request in HEX format instead of ISO string format

my ISO string: Service Charge Inquiry Stirng(Req)

ISOString = 01002020058020C0800E4600000005480022000500374588609902000124D15081211000047500000F30303035303632372020202020203933363139343030303738340061525331544F5055502D37313030373130302D53434F444530303030303030303132303030303030303120202020202020202020202020202020202020200043554930303035303632373030303030303933363139343030303030303030353438313930383135313630380080004849503137322E32322E38302E39382020202C30303A34303A45463A46333A30423A36322C3730313438303034323336390010494475736572202020200009424E5430303030303200054156303352

I have converted the above string into HEX by,

  byte[] Hexdata = Enumerable.Range(0, hex.Length)
                             .Where(x => x % 2 == 0)
                             .Select(x => Convert.ToByte(hex.Substring(x, 2), 16))
                             .ToArray();

when i print in console i got, (looks same string im getting back)

01002020058020C0800E4600000005480022000500374588609902000124D15081211000047500000F30303035303632372020202020203933363139343030303738340061525331544F5055502D37313030373130302D53434F444530303030303030303132303030303030303120202020202020202020202020202020202020200043554930303035303632373030303030303933363139343030303030303030353438313930383135313630380080004849503137322E32322E38302E39382020202C30303A34303A45463A46333A30423A36322C3730313438303034323336390010494475736572202020200009424E5430303030303200054156303352

OR

when i convert via Notepad++ (Hexeditor) i am getting like this

30 31 30 30 32 30 32 30 30 35 38 30 32 30 43 30 38 30 30 45 34 36 30 30 30 30 30 30 30 35 34 38 30 30 32 32 30 30 30 35 30 30 33 37 34 35 38 38 36 30 39 39 30 32 30 30 30 31 32 34 44 31 35 30 38 31 32 31 31 30 30 30 30 34 37 35 30 30 30 30 30 46 33 30 33 30 33 30 33 35 33 30 33 36 33 32 33 37 32 30 32 30 32 30 32 30 32 30 32 30 33 39 33 33 33 36 33 31 33 39 33 34 33 30 33 30 33 30 33 37 33 38 33 34 30 30 36 31 35 32 35 33 33 31 35 34 34 46 35 30 35 35 35 30 32 44 33 37 33 31 33 30 33 30 33 37 33 31 33 30 33 30 32 44 35 33 34 33 34 46 34 34 34 35 33 30 33 30 33 30 33 30 33 30 33 30 33 30 33 30 33 31 33 32 33 30 33 30 33 30 33 30 33 30 33 30 33 30 33 31 32 30 32 30 32 30 32 30 32 30 32 30 32 30 32 30 32 30 32 30 32 30 32 30 32 30 32 30 32 30 32 30 32 30 32 30 32 30 32 30 30 30 34 33 35 35 34 39 33 30 33 30 33 30 33 35 33 30 33 36 33 32 33 37 33 30 33 30 33 30 33 30 33 30 33 30 33 39 33 33 33 36 33 31 33 39 33 34 33 30 33 30 33 30 33 30 33 30 33 30 33 30 33 30 33 35 33 34 33 38 33 31 33 39 33 30 33 38 33 31 33 35 33 31 33 36 33 30 33 38 30 30 38 30 30 30 34 38 34 39 35 30 33 31 33 37 33 32 32 45 33 32 33 32 32 45 33 38 33 30 32 45 33 39 33 38 32 30 32 30 32 30 32 43 33 30 33 30 33 41 33 34 33 30 33 41 34 35 34 36 33 41 34 36 33 33 33 41 33 30 34 32 33 41 33 36 33 32 32 43 33 37 33 30 33 31 33 34 33 38 33 30 33 30 33 34 33 32 33 33 33 36 33 39 30 30 31 30 34 39 34 34 37 35 37 33 36 35 37 32 32 30 32 30 32 30 32 30 30 30 30 39 34 32 34 45 35 34 33 30 33 30 33 30 33 30 33 30 33 32 30 30 30 35 34 31 35 36 33 30 33 33 35 32

Is this conversion correct?

Please advise me.

Thank you.

SaddamBinSyed
  • 553
  • 3
  • 17
  • Does https://social.msdn.microsoft.com/Forums/vstudio/en-US/f6d71c07-2348-479e-8110-96a09f49e08e/iso-8583-in-net?forum=netfxbcl help? – mjwills Jul 16 '17 at 13:32
  • @mjwills, Thanks for your reply i need to confirm that the ASCII conversion from ISO string to Byte array (HEX format) is correct or not? So that i can proceed further. – SaddamBinSyed Jul 16 '17 at 13:52
  • 3
    No its not correct, your output is the conversion of the character codes not the hexadecimal values they represent, you need this: [How can I convert a hex string to a byte array?](https://stackoverflow.com/questions/321370/how-can-i-convert-a-hex-string-to-a-byte-array) – Alex K. Jul 16 '17 at 14:31
  • @AlexK. Thanks for reply. I followed the above link and converted using Enumerable.Range() method. I have pasted my output in the question above . could you please check the same? – SaddamBinSyed Jul 17 '17 at 05:50
  • That is the way to get the data from your hex string. I have no idea if the output is what its supposed to be, `Console.WriteLine( Encoding.UTF8.GetString( Hexdata ) );` yields some legitimate looking text anongst the other binary data. – Alex K. Jul 17 '17 at 10:03

0 Answers0