Defining BYREF Parameters
A JSON-RPC request does not have the concept of BYREF parameters. Parameters are passed only “by value,” and values are returned only through the result within the response.
However, 4GL procedures in existing OpenROAD server applications, which were called from a remote client (for example, SCPs—Service Call Procedures), could not have a return value. All values to be passed back therefore had to be provided as BYREF parameters. Then the caller decides what can be used as BYREF.
To enable access to existing procedures that make use of BYREF parameters, a pseudo-parameter “$byref_params” must be passed within the “params” object of an JSON-RPC request. The value of the “$byref_params” parameter is a comma-separated string of the BYREF parameter names. Any procedure parameter contained in the “$byref_params” pseudo-parameter must have been registered with “byref_use” property set to true when the 4GL procedure was registered.
If “$byref_params” is provided, the result of the response is a structure in the following form:
"result": {
"result": returnvalue
"byref_results": {
"paramname": paramvalue
}
}
Example JSON-RPC request of the “helloworld” procedure
{
"jsonrpc": "2.0",
"method": "helloworld",
"params": {
"hellostring": "HELLO",
"counter": 0,
"$byref_params": "hellostring,counter"
},
"id": 1
}
Response:
{
"result": {
"result": null
"byref_results": {
"hellostring": "Well \"HELLO\" to you too.",
"counter": 1
}
},
"id": 1,
"jsonrpc": "2.0"
}