Qore yaml Module 1.0.0
Loading...
Searching...
No Matches
YamlRpcClient::YamlRpcClient Class Reference

defines a YAML-RPC client class More...

#include <YamlRpcClient.qm.dox.h>

Inherits Qore::HTTPClient.

Public Member Methods

 constructor (hash opts=hash(), bool do_not_connect=False)
 calls the base class HTTPClient constructor, overrides the "protocols" key to "yamlrpc"
 
 constructor (bool do_not_connect=False)
 simple constructor using default arguments
 
auto callArgs (string method, auto args)
 makes a call to the YAML-RPC server using the second argument as the list of arguments to send
 
auto callArgsWithInfo (reference< auto > info, string method, auto args)
 makes a call to the YAML-RPC server using the third argument as the list of arguments to send
 
auto call (string method)
 makes a method call to the YAML-RPC server using the remaining arguments after the method name as the list of arguments to send
 

Static Public Member Methods

static string makeRequest (string method, auto arg, int flags=YAML::None)
 makes a YAML-RPC request string
 

Public Attributes

const Version = "1.0"
 YAML-RPC Client Version.
 
const DefaultOptions = ...
 default options for the YamlRpcClient::constructor()
 
const VersionString = sprintf("Qore-YAML-RPC-Client/%s", YamlRpcClient::Version)
 YAML-RPC Client Version String.
 
const DefaultHeaders = ...
 default HTTP headers
 

Detailed Description

defines a YAML-RPC client class

The YamlRpcClient class will correctly serialize YAML-RPC messages, send them to the server, deserialize the responses and return a Qore-language data structure for the response.

YAML-RPC is a proprietary HTTP-based RPC protocol; for a description of the YAML-RPC protocol implemented by the YamlRpcClient class, see YAML-RPC Protocol Implementation.

Note
  • if no URI path is given in the constructor(), the default path used is "/YAML"
  • subclassed from Qore''s HTTPClient class

Member Function Documentation

◆ call()

auto YamlRpcClient::YamlRpcClient::call ( string  method)

makes a method call to the YAML-RPC server using the remaining arguments after the method name as the list of arguments to send

Parameters
methodthe remote method to call
Returns
the value returned from the server; if no error occurred, then a hash is returned with a result key (see YAML-RPC Non-Error Responses), otherwise a hash is returned with an error key containing the error information (see YAML-RPC Error Responses)

◆ callArgs()

auto YamlRpcClient::YamlRpcClient::callArgs ( string  method,
auto  args 
)

makes a call to the YAML-RPC server using the second argument as the list of arguments to send

Parameters
methodthe remote method to call
argsthe argument(s) to the call
Returns
the value returned from the server; if an error response is returned, an exception is raised

◆ callArgsWithInfo()

auto YamlRpcClient::YamlRpcClient::callArgsWithInfo ( reference< auto >  info,
string  method,
auto  args 
)

makes a call to the YAML-RPC server using the third argument as the list of arguments to send

Parameters
infoa reference to a hash with technical information about the call
methodthe remote method to call
argsthe argument(s) to the call
Returns
the value returned from the server; if an error response is returned, an exception is raised

◆ constructor() [1/2]

YamlRpcClient::YamlRpcClient::constructor ( bool  do_not_connect = False)

simple constructor using default arguments

Parameters
do_not_connectif False (the default), then a connection will be immediately established to the remote server

◆ constructor() [2/2]

YamlRpcClient::YamlRpcClient::constructor ( hash  opts = hash(),
bool  do_not_connect = False 
)

calls the base class HTTPClient constructor, overrides the "protocols" key to "yamlrpc"

Parameters
optsvalid options are:
  • url: A string giving the URL to connect to
    • default_port: The default port number to connect to if none is given in the URL
    • http_version: Either '1.0' or '1.1' for the claimed HTTP protocol version compliancy in outgoing message headers
    • default_path: The default path to use for new connections if a path is not otherwise specified in the connection URL
    • max_redirects: The maximum number of redirects before throwing an exception (the default is 5)
    • proxy: The proxy URL for connecting through a proxy
    • timeout: The timeout value in milliseconds (also can be a relative date-time value for clarity, ex: 5m)
    • connect_timeout: The timeout value in milliseconds for establishing a new socket connection (also can be a relative date-time value for clarity, ex: 30s)
do_not_connectif False (the default), then a connection will be immediately established to the remote server

The documentation for this class was generated from the following file: