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[].
.png)
Thank you,
Ravi
Comments
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
Use any of the Binary streams:
- %Stream.FileBinary - If you store files on disk
- %Stream.GlobalBinary - if you store files in globals
To send a stream just fill EntityBody property of a request object by calling it's CopyFrom method.
Thank you Eduard and Robert.
Do i have to encode this to base64 prior to the WS call?
Depends on what WS expects, really.