XML-RPC
(require net/xml-rpc) | package: xml-rpc |
This package is based on the XML-RPC package by Matt Jadud and Noel Welsh of Untyped
This library implements the XML-RPC protocol, a popular protocol for interface to Internet services such as blog engines, as specified at http://www.xmlrpc.com/spec.
1 Clients
(require net/xml-rpc/client) | package: xml-rpc |
The client library provides a few forms for defining servers and their supported endpoints.
procedure
((xml-rpc-server url) method) → procedure?
url : url? method : symbol?
This example calls the examples.getStateName method on the server betty.userland.com:
(define betty (xml-rpc-server (string->url "http://betty.userland.com/RPC2")))
(define get-state-name (betty 'examples.getStateName)) > (get-state-name 42) tcp-connect: connection failed;
host not found
address: betty.userland.com
port number: 80
system error: Temporary failure in name resolution;
gai_err=-3
2 Servers
(require net/xml-rpc/server) | package: xml-rpc |
The server library provides
procedure
(make-handle-xml-rpc exports) → (request? . -> . response/c)
exports : (hash/c symbol? procedure?)
(define (add x y) (+ x y))
(define xml-rpc-adder (make-handle-xml-rpc (hasheq 'math.add add 'math.+ + 'addFun add)))
(define (run-server!) (serve/servlet xml-rpc-adder #:port 8080 #:servlet-path "/" #:command-line? #t))
(define (test-server) (define adder (xml-rpc-server (string->url "http://localhost:8080/"))) (define math.add (adder 'math.add)) (math.add 3 4))
3 Errors
struct
(struct exn:xml-rpc exn (message continuation-marks))
message : string? continuation-marks : continuation-mark-set?
A subtype of exn, this exception is raised whenever the XML-RPC library encounters an error.
struct
(struct exn:xml-rpc:fault exn:xml-rpc ( message continuation-marks code)) message : string? continuation-marks : continuation-mark-set? code : integer?