java - j8583 library - how to convert value into hex -


I am using to create the iso8583 message. I want to set DE96 element value as hexadecimals of binary data. According to my understanding, the value should be converted into binary and after that hexadecimal is not getting any way to use this bit like bitmap value j8583 API i have tried ISOType. The original type but does not give it the required value.

Please see the following code

  package j8583.example; Import java.io.IOException; Import java.util.Date; Import com.solab.iso8583.IsoMessage; Import com.solab.iso8583.IsoType; Import com.solab.iso8583.MessageFactory; Import com.solab.iso8583.parse.ConfigParser; Import com.solab.iso8583.util.HexCodec; Public square messenger 0800 {public static zero main (string [] args) {try {MessageFactory mfact = ConfigParser.createFromClasspathConfig ("j8583 / example / config.xml"); IsoMessage msg = mfact.newMessage (0x800); Msg.setValue (7, New Date), ISO Type. Dated 10, 10); Msg.setValue (96, "123456", IsoType.BINARY, 6); / * I want the output of the D 96 96 code as string test = "123456"; String encoded = hexcode Hex encoded (test.getBytes (), 0, test.length ()); Println (encoding); System.out.println (new string (hexoded.hexedcode (encoded)); * / String strMsg = new string (msg.writeData ()); Println (strMsg); } Hold (IOException e) {e.printStackTrace (); }}   

}

The above code prints the following ISO message

  08008200000000000000000000000000000000000000000000219092608000000000000000000000001234560000000123456000000   < P> Please refer to the previous 12 bytes, which is produced by  msg.setValue (96, "123456", IsoType.BINARY, 6); , I want to make the following message instead of the above message  
  0800820000000000080004000001000000000219092608000000000000000000000313233343536   

The last 6 bytes are hex encoded values.

ISO.BINAY also additional '0' ie the msg.setValue (96, "123456", IsoType.BINARY, 6); By adding , it produces 123456000000 instead of 123456

I'm thinking That someone has done this using this API. Otherwise, I have to add some type of cover to add to this function.

The following is the XML configuration

  & lt; Template Type = "0800" & gt; & Lt; Field num = "53" type = "NUMERIC" length = "16" & gt; 00 & lt; / Field & gt; & Lt; Field num = "70" type = "NUMERIC" length = "3" & gt; 000 & lt; / Field & gt; & Lt; / Template & gt;   

I am quite new in the library. Anyone can help me understand.

Thanks

For IsoType. The value should be a byte [] and then the byte array is converted to hex while writing that.

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -