[plt-scheme] Confusing web-server interaction

From: Matt Jadud (jadudm at gmail.com)
Date: Sun Apr 5 08:55:43 EDT 2009

Hi all,

(This is probably a question for Jay, though...)

I don't update the XML-RPC library as often as I should. Perhaps if I
was more diligent, it would be easier to keep up on how the internals
have changed.

On the server side, I apparently no longer need "response.ss" from the
"private" portion of the web-server. After getting rid of this require
from "server-core.ss" in the library, things run, but I get the
following error from within the web-server:

../apps/plt413/collects/web-server/dispatchers/dispatch-files.ss:27:18:
string-ref: expects type <non-negative exact integer> as 2nd argument,
given: -1; other arguments were: ""

I haven't really dug into things since the insta and dispatch
libraries were rolled into the web-server collection itself. I'm not
sure what I should be doing in the XML-RPC library to avoid this
error.

What follows are my server and client code. I'm wondering: do I need a
custom dispatcher, or should I be able to run the XML-RPC library as a
simple servlet, given that it provides "interface-version", "manager",
"timeout", and  "start"? Either way, I thought asking a question would
be the quicker route to getting things rolling again, as there are
enough new things that I'm not quite sure where best to start.

Cheers,
Matt

[BEGIN SERVER]
#lang scheme

(require (planet schematics/xmlrpc:4:0/xmlrpc-module-servlet)
         web-server/servlet
         web-server/servlet-env)

(define (add x y) (+ x y))
(add-handler 'math.add add)

(serve/servlet start
               #:port 9000
               #:servlet-path "/RPC"
               #:launch-browser? false
               )
[END SERVER]

[BEGIN CLIENT]
#lang scheme
(require (planet schematics/xmlrpc:4:0/xmlrpc))

(define local (xmlrpc-server "localhost" 9000 "/RPC"))
(define remote-add (local 'math.add))

(remote-add 3 5)
[END CLIENT]


Posted on the users mailing list.