xmlrpc-server.lsp

Module index



Module: Xmlrpc-server

Author: Jeff Ober
Version: 1.1
Original location: http://static.artfulcode.net/newlisp/xmlrpc-server.lsp
Source: xmlrpc-server.lsp
Package definition: xmlrpc-server.qwerty

A simple XML-RPC server (updated for newlisp 10).

Xmlrpc-server implements a basic XML-RPC server. It requires the element, http, sockets, and util modules, and newlisp 10.

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.

Version history

1.1 • updated for newlisp 10 • updated to use element module for faster xml serialization

1.0 • initial release

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 if-not started in a child process.

- ∂ -

Artful Code

generated with newLISP  and newLISPdoc