Nsxmlrpc

From AOLserver Wiki
Revision as of 00:45, 13 April 2017 by Dossy (talk | contribs) (Update links to code.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

A module for XML-RPC is currently under development.

Code:


XML-RPC Client

  • ns_xmlrpc queue url method ?arg arg ...?
Queues an XML-RPC request and returns an ID to the ns_http handle for later ns_xmlrpc wait.
  • ns_xmlrpc wait id ?timeout?
Waits for an XML-RPC request to finish, then parse the XML-RPC response and return a Tcl list containing the results as a Tcl list of key-value pairs. Optional timeout (default 1 second) specifies how long to wait for the XML-RPC response.
  • ns_xmlrpc call ?-timeout timeout? url method ?arg arg ...?
Short-hand that combines ns_xmlrpc queue and ns_xmlrpc wait.

XML-RPC Server

  • ns_xmlrpc bind url method proc
Registers a XML-RPC endpoint at url and binds proc for method.
  • ns_xmlrpc fault ?-indent indent? ?-types types? code string
Formats an XML <methodResponse> fault response. code is the numeric faultCode, and string is the faultString. indent is either "none" for no whitespace between nodes (default), or 0..N spaces and newlines for pretty-printing. types is a boolean which defaults to "yes" whether the child of a <value> node should be a node describing the datatype (string, int, struct, array, etc.) or not.
  • ns_xmlrpc format ?-indent indent? ?-types types? ?arg arg ...?
Formats an XML <methodResponse> document. Each arg represents a <param> node within the <params> node, and must be a Tcl list of two elements: type, and value. e.g.: ns_xmlrpc format {string "hello world"} {i4 42}. See ns_xmlrpc fault for description of indent and types.

Feature Requests:

Nathaniel Haggard asks for HTTPS support for the XML-RPC client side. Currently the code only supports HTTP using ns_http.



Category Documentation