Qore JSON Module
1.1
|
The JsonRpcClient class provides easy access to JSON-RPC web services. More...
Public Member Functions | |
hash | call (string method,...) |
Calls a remote method taking all arguments after the method name for the method arguments and returns the response as qore data structure. | |
hash | callArgs (string method, any args) |
Calls a remote method using a single value after the method name for the method arguments and returns the response as qore data structure. | |
hash | callArgsWithInfo (reference info, string method, any args) |
Calls a remote method using a single value after the method name for the method arguments and returns the response as qore data structure, accepts a reference to a hash as the first argument to give technical information about the call. | |
hash | callWithInfo (reference info, string method,...) |
Calls a remote method taking all arguments after the method name for the method arguments and returns the response as qore data structure, accepts a reference to a hash as the first argument to give technical information about the call. | |
constructor () | |
Creates the JsonRpcClient object with no arguments. | |
constructor (hash opts, softbool no_connect=False) | |
Creates the JsonRpcClient object based on the parameters passed. | |
copy () | |
Throws an exception; copying JsonRpcClient objects is currently not supported. | |
nothing | setEventQueue () |
clears the event queue for the JsonRpcClient object | |
nothing | setEventQueue (Queue queue) |
sets the event queue for the JsonRpcClient object |
The JsonRpcClient class provides easy access to JSON-RPC web services.
This class inherits all public methods of the HTTPClient class. The inherited HTTPClient methods are not listed in this section, see the documentation for the HTTPClient class for more information on methods provided by the parent class. For a list of low-level JSON-RPC functions, see JSON-RPC.
The JsonRpcClient class understands the following protocols in addition to the protocols supported by the HTTPClient class:
JsonRpcClient Class Protocols
Protocol | Default Port | SSL? | Description |
jsonrpc | 80 | No | Unencrypted JSON-RPC protocol over HTTP |
jsonrpcs | 443 | Yes | JSON-RPC protocol over HTTP with SSL/TLS encryption |
The JsonRpcClient supplies default values for HTTP headers as follows:
JsonRpcClient Default, but Overridable Headers
Header | Default Value |
Accept | text/json |
Content-Type | text/json |
User-Agent | Qore-JSON-RPC-Client/1.1 |
Connection | Keep-Alive |
PO_NO_NETWORK
parse option. hash Qore::Json::JsonRpcClient::call | ( | string | method, |
... | |||
) |
Calls a remote method taking all arguments after the method name for the method arguments and returns the response as qore data structure.
method | The JSON-RPC method name to call |
... | the arguments to the call |
JSON-SERIALIZATION-ERROR | cannot serialize value passed (ex: binary, object) |
JSON-PARSE-ERROR | syntax error parsing JSON string |
HTTP-CLIENT-TIMEOUT | timeout on response from HTTP server |
HTTP-CLIENT-RECEIVE-ERROR | error communicating with HTTP server |
hash Qore::Json::JsonRpcClient::callArgs | ( | string | method, |
any | args | ||
) |
Calls a remote method using a single value after the method name for the method arguments and returns the response as qore data structure.
$method | The JSON-RPC method name to call |
$args | An optional list of arguments (or single argument) for the method |
JSON-SERIALIZATION-ERROR | cannot serialize value passed (ex: binary, object) |
JSON-PARSE-ERROR | syntax error parsing JSON string |
HTTP-CLIENT-TIMEOUT | timeout on response from HTTP server |
HTTP-CLIENT-RECEIVE-ERROR | error communicating with HTTP server |
hash Qore::Json::JsonRpcClient::callArgsWithInfo | ( | reference | info, |
string | method, | ||
any | args | ||
) |
Calls a remote method using a single value after the method name for the method arguments and returns the response as qore data structure, accepts a reference to a hash as the first argument to give technical information about the call.
$info | a reference to a hash that provides the following keys on output giving technical information about the HTTP call:
|
$method | The JSON-RPC method name to call |
$args | An optional list of arguments (or single argument) for the method |
JSON-SERIALIZATION-ERROR | cannot serialize value passed (ex: binary, object) |
JSON-PARSE-ERROR | syntax error parsing JSON string |
HTTP-CLIENT-TIMEOUT | timeout on response from HTTP server |
HTTP-CLIENT-RECEIVE-ERROR | error communicating with HTTP server |
hash Qore::Json::JsonRpcClient::callWithInfo | ( | reference | info, |
string | method, | ||
... | |||
) |
Calls a remote method taking all arguments after the method name for the method arguments and returns the response as qore data structure, accepts a reference to a hash as the first argument to give technical information about the call.
$info | a reference to a hash that provides the following keys on output giving technical information about the HTTP call:
|
$method | The JSON-RPC method name to call |
JSON-SERIALIZATION-ERROR | cannot serialize value passed (ex: binary, object) |
JSON-PARSE-ERROR | syntax error parsing JSON string |
HTTP-CLIENT-TIMEOUT | timeout on response from HTTP server |
HTTP-CLIENT-RECEIVE-ERROR | error communicating with HTTP server |
Qore::Json::JsonRpcClient::constructor | ( | ) |
Creates the JsonRpcClient object with no arguments.
No connection is made because no connection parameters are set with this call; connection parameters must be set afterwards using the appropriate HTTPClient methods.
Qore::Json::JsonRpcClient::constructor | ( | hash | opts, |
softbool | no_connect = False |
||
) |
Creates the JsonRpcClient object based on the parameters passed.
By default the object will immediately attempt to establish a connection to the server
$opts | HTTPClient constructor options:
|
$no_connect | pass a boolean True value argument to suppress the automatic connection and establish a connection on demand with the first request |
Qore::Json::JsonRpcClient::copy | ( | ) |
Throws an exception; copying JsonRpcClient objects is currently not supported.
JSONRPCCLIENT-COPY-ERROR | copying JsonRpcClient objects is currently not supported |
nothing Qore::Json::JsonRpcClient::setEventQueue | ( | ) |
clears the event queue for the JsonRpcClient object
nothing Qore::Json::JsonRpcClient::setEventQueue | ( | Queue | queue | ) |
sets the event queue for the JsonRpcClient object
$queue | the Queue object to receive network events from the JsonRpcClient object |