Qore XmlRpcHandler Module Reference: XmlRpcHandler::XmlRpcHandler Class Reference

Qore XmlRpcHandler Module Reference 1.0

- Main Page
- Namespaces
- Classes

- Class List
- Class Index
- Class Members

All Classes Namespaces Functions Variables Pages
Public Member Functions | Public Attributes | List of all members
XmlRpcHandler::XmlRpcHandler Class Reference

XML-RPC Handler implementation; to be registered as a request handler in the HttpServer class. More...

Inherits AbstractHttpRequestHandler.

## Public Member Functions
| constructor (AbstractAuthenticator auth, list methods, *code getLogMessage, bool dbg=False, *string get_prefix, *code log)
| creates the handler with the given method list More...
| addMethod (string name, code func, string text, string help, int logopt, any cmark)
| adds a method to the handler dynamically More...
| setDebug (bool dbg=True)
| turns on or off debugging; when debugging is enabled more verbose error messages are reported
bool | getDebug ()
| returns the current status of the debug flag

## Public Attributes
const | Version = "1.0"
| version of the implementation
const | InternalMethods
| internal methods (for introspection)
const | XMLRPC_INVALID_XML = 2001
| error code for invalid XML-RPC

## Detailed Description

XML-RPC Handler implementation; to be registered as a request handler in the HttpServer class.

## Member Function Documentation

XmlRpcHandler::XmlRpcHandler::addMethod | ( | string | name,
|  | code | func,
|  | string | text,
|  | string | help,
|  | int | logopt,
|  | any | cmark
| ) |  |

adds a method to the handler dynamically

Parameters

  name | a regular expression to use for matching the method name
  func | a string (giving a function name to call), a call reference, or a closure to call with the deserialized arguments to the method; the return value will be serialized to XML-RPC and sent back to the caller
  text | the human-readable name of the method
  help | help text for the method
  logopt | log options which can be used by a custom logger (see the getLogMessage parameter)
  cmark | any value that will be added in the method hash under the `"cmark"` key

XmlRpcHandler::XmlRpcHandler::constructor | ( | AbstractAuthenticator | auth,
|  | list | methods,
|  | *code | getLogMessage,
|  | bool | dbg = `False`,
|  | *string | get_prefix,
|  | *code | log
| ) |  |

creates the handler with the given method list

Parameters

  auth | an authentication object (use new AbstractAuthenticator() for no authentication)
  methods | a list of hashes with the following keys: `name:` a regular expression to use for matching the method name `function:` a string (giving a function name to call), a call reference, or a closure to call with the deserialized arguments to the method; the return value will be serialized to XML-RPC and sent back to the caller `text:` the human-readable name of the method `help:` help text for the method `logopt:` (optional - by convention) log options which can be used by a custom logger (see the getLogMessage parameter)
  getLogMessage | an optional closure or call reference to be called when an incoming request is received; if this is set then it will be called with the following arguments: a context hash (see HttpServer::AbstractHttpRequestHandler::handleRequest() for a description of the context h ash), the method definition as passed in the methods argument to this constructor, and a reference to the arguments in this call
  dbg | this parameter is set to True, then additional information will be logged when errors occur
  get_prefix | prefix to add to derived methods with GET requests if no "." characters are in the path
  log | an optional closure or call reference to be called when logging
  cx | an optional closure or call reference to set the call context before calling APIs

Exceptions

  XML-RPC-CONSTRUCTOR-ERROR | missing `"name"`, `"function"`, or "text" key in method hash, \c "function" key not assigned to a callable value