8.18
top
← prev up next →

XML-RPCπŸ”— i

Jay McCarthy <jay@racket-lang.org>

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.

1ClientsπŸ”— i

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?
Returns a function configured to make XML-RPC requests to the given URL. The function accepts a string, the name of the method, and returns a function of any arguments which calls the method with the given arguments.

This example calls the examples.getStateName method on the server betty.userland.com:

Examples:
(define betty
(xml-rpc-server (string->url "http://betty.userland.com/RPC2")))
(define get-state-name(betty'examples.getStateName))
> (get-state-name42)

tcp-connect: host not found

hostname: betty.userland.com

port number: 80

system error: Temporary failure in name resolution;

gai_err=-3

2ServersπŸ”— i

The server library provides

procedure

( make-handle-xml-rpc exports)(request? . -> .response/c)

Returns a function from HTTP requests encoding XML-RPC queries to HTTP responses encoding XML-RPC answers that computes answers by calling the procedure associated with the XML-RPC method name in the exports hash table.

Examples:
(define (addxy)(+ xy))
(define xml-rpc-adder
(hasheq 'math.addadd
'math.++
'addFunadd)))
(define (run-server!)
(serve/servlet xml-rpc-adder
#:port8080
#: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.add34))

3ErrorsπŸ”— i

struct

(struct exn:xml-rpc exn (messagecontinuation-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

continuation-marks
code))
message:string?
continuation-marks:continuation-mark-set?
code:integer?
A subtype of exn:xml-rpc , this exception is raised when the XML-RPC server responds to the client with a fault. The code is an integer containing the fault code returned by the server. The fault message returned by the server is contained in the exception message.

top
← prev up next →

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /