Question
Ravi Akkiraju · Mar 14, 2021

Byte[] property type

One of the REST APIs we need to call takes one of request parameter as a byte array. I am trying to create a message class and couldnt figure out which is equivalent type that corresponds to Byte[]. I need to read from a jpg file and then convert it to byte[] before i invoke this webservice. Appreciate if anyone can point me in the right direction. I can use %Stream.FileBinary class to store the jpg file after loading from a file. trying to figure out how to convert that to byte[].

Thank you,

Ravi

$ZV: IRIS for UNIX (IBM AIX for System Power System-64) 2019.1 (Build 510_4_19056U) Fri Jun 28 2019 16:23:09 EDT
Product version:
IRIS 2019.1
00
1 0 4 84
Log in or sign up to continue

Replies

There is no explicit type Byte .  In IRIS it's just an %Integer <256.
The equivalent to a byte[] array is a String of data type %Binary 
To access the Byte values of the "array" use $A(your_binstring, position)   
Attention: position starts with 1

Thank you Eduard and Robert. 

Do i have to encode this to base64 prior to the WS call?

Depends on what WS expects, really.