Qore xml Module 1.8.1
Loading...
Searching...
No Matches

Introduction to the XmlRpcHandler Module

This module implements server-side support for the XML-RPC protocol for serialization/deserialization of message data.

This module provides the XmlRpcHandler class which can be used to provide an RPC handler for the HttpServer class provided by the HttpServer module.

Example Usage

%requires HttpServer
%requires XmlRpcHandler
%requires Mime
const ApiMethods = (
("name": "^sys\\.shutdown\$",
"text": "sys.shutdown",
"function": sub () { background http.stop(); return "OK"; },
"help": "shuts down this server",
"logopt": 0,
),
);
# a logging closure
code log = sub (string fmt) {printf("%y: %s\n", now_us(), vsprintf(fmt, argv));};
# our bind address
const Bind = 8888;
XmlRpcHandler xmlRpcHandler(new AbstractAuthenticator(), ApiMethods);
our HttpServer http(log, log);
http.addListener(Bind);
http.setHandler("xmlrpc", "", MimeTypeXmlRpc, xmlRpcHandler);
http.setDefaultHandler("xmlrpc", xmlRpcHandler);
log("now listening on %s\n", Bind);
http.waitStop();
the XmlRpcHandler namespace holds all public definitions in the XmlRpcHandler module
Definition: XmlRpcHandler.qm.dox.h:83