xmlrpc-server.lsp

Module index

source

Module: Xmlrpc-server

Author: Jeff Ober
Version: 1.0
Location: http://static.artfulcode.net/newlisp/xmlrpc-server.lsp

A simple XML-RPC server.

Xmlrpc-server implements a basic XML-RPC server using the SocketServer and Http modules (also requires the general util module).

Xmlrpc-server is able to convert data between xmlrpc and newLISP. Any uncaught errors that occur during the loading of a response are handled by returning a fault response. Fault codes are gleaned from Dan Libby's specifications.

The server is used by registering handler functions that handle requests to a specific path. Only one introspection function, system.listMethods, is included.

example:
 (load "xmlrpc-server.lsp")
 
 (define (get-time)
   (date (date-value)))
 
 (Xmlrpc-server:add-to-registry "myapp.getTime" get-time)
 (Xmlrpc-server:run-server 8080 "/RPC2")

- § -

Xmlrpc-server:add-to-registry

syntax: (Xmlrpc-server:add-to-registry str-path lambda-func)
parameter: str-path - the path which will respond to the passed function
parameter: lambda-func - the function which will be applied to requests on str-path

Registers a function to respond when requests are sent to str-path. The function will be passed a lisp representation of the XML-RPC request.

- § -

Xmlrpc-server:run-server

syntax: (Xmlrpc-server:run-server [int-port [str-path]])
parameter: int-port - port on which to listen; defaults to 8080
parameter: str-path - path on which to response; defaults to "/RPC2"

Initializes and starts server. Server will block unless started in a child process.

- ∂ -

Artful Code

generated with newLISP  and newLISPdoc
eXTReMe Tracker