Strings and Byte Arrays

All Services can use byte arrays (byte[]s) interchangeably with Strings as arguments. Conversions use UTF-8 encoding. For example, if an argument is of type String, and the client passes in a byte[], the byte[] is UTF-8 encoded and passed into the method as a String.

Because a C++ Service always returns a string/char*, you must convert the returned type of an invocation to a String or byte[]. The first argument to the invocation determines the type of conversion:

A string first argument returns a string.
An argument of byte[] returns a byte[].
If you pass no arguments to the invocation, it returns a byte[].

This is most relevant for a .NET, as string I/O must be ASCII. If you are returning binary data, make sure that the first argument is a byte[].

A Command Service converts the output data to a String only if the first argument is a String and the appendArgsToCommandline option is false.

Java and .NET Services do not convert return values if they are Strings or byte[]s.

In the case where a parameterType value is specified, GridServer converts to the specified value. For example, if parameterType is set as string, GridServer returns strings. If set to byte[], GridServer converts the return value to byte[]. This applies to both the C++ Service and the Command Service. You can specify the parameterType value for DynamicLibrary and Command Services on the Service Type Registry page.