Qore YamlRpcClient Module Reference 1.0
This module implements client-side support for a proprietary RPC-based protocol using YAML for serialization/deserialization of message data.
All the functionality in this module is accessible with the YamlRpcClient class.
YAML-RPC has some technical advantages over JSON-RPC and XML-RPC when developing in Qore:
The major drawback is that it is a proprietary protocol, which is why Qore will continue to support XML-RPC and JSON-RPC alongside YAML-RPC.
The information below provides technical information about how this proprietary YAML-RPC protocol is implemented; details which are not normally visible when using the YamlRpcClient class.
Request messages are sent as a YAML-encoded request string as the message body of an HTTP POST message. The
"Content-Type" header should be set to
MimeTypeYamlRpc (from Mime.qm), otherwise there are no special restrictions on the message headers.
Request and response message bodies must always be encoded with UTF-8 encoding.
YAML-RPC request strings are constructed as a simple YAML map with the following keys:
method:the string method name to call
params:any value giving the arguments for the method; if the method takes more than one argument, then the
"params"key will hold a list of the arguments. The YamlRpcClient class will always package a single argument in a list.
Note that this YAML-RPC implementation uses the Qore YAML module to encode and decode YAML strings; this ensures maximum data fidelity when serializaing data; note that the Qore yaml module uses the proprietary
!duration tag for durations, otherwise all other tags are standard YAML tags. For details on how Qore data is serialized and deserialized by the yaml module, please see the yaml module documentation.
The following is an example of a simple request message with headers:
Normal (non-error) responses are returned as a YAML map as well with the following key:
result:a map where the only key is the method name and the value is the value returned by the method.
For example, for the message above, the response message would be:
Error responses are also returned as a YAML map with a single key,
error, which is itself a map with the following keys:
code:an integer error code
message:an error message
error:an optional error value of any format
The following is an example error response message: