Qore YamlRpcClient Module Reference  1.1
 All Classes Namespaces Functions Variables Pages
YamlRpcClient::YamlRpcClient Class Reference

defines a YAML-RPC client class More...

Inherits HTTPClient.

Public Member Functions

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

Static Public Member Functions

static string makeRequest (string method, any 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

any 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)
any YamlRpcClient::YamlRpcClient::callArgs ( string  method,
any  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
any YamlRpcClient::YamlRpcClient::callArgsWithInfo ( reference  info,
string  method,
any  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
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
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