[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

xmlrpc module

From: Aleix Conchillo Flaqué
Subject: xmlrpc module
Date: Fri, 14 Jan 2011 00:19:59 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv: Gecko/20101227 Iceowl/1.0b1 Icedove/3.0.11


two weeks ago I decided to start my path to practical Scheme by adding
new features to an existing project. This would help me seeing how
experimented Scheme programmers work and also safe me from finding a new
idea and start from scratch, which sometimes is a bit discouraging.

I took tekuti, Andy Wingo's blog software, and I'm having lots of fun
with it. One of the features I added was the support of the Movable
Type XMLRPC API, so I could post and edit articles from a desktop

After a few tries I thought I could create a generic XMLRPC library for
Guile, and this is what's this post about, the (tekuti xmlrpc) module.

I would be very happy to receive your inputs so I can improve it in all
senses. Note that the library does not support error handling yet.

(tekuti xmlrpc) attached and basic documentation below.

Best regards and thanks in advance.



*** XMLRPC requests ***

- xml->sxmlrpc-request str

  Given an XML string return an association list representing an
  XMLRPC request with two pairs:

    '((method . methodName)
      (params . (param1 param2 ... paramN)))

  param is the ordered list of the XMLRPC function call
  parameters. XMLRPC parameters are mapped to Scheme types as follows:

      boolean          -> boolean
      i4 / int         -> number
      double           -> number
      string           -> string
      base64           -> string (base64 kept)
      structure        -> association list
      array            -> list
      dateTime.iso8601 -> date

- sxmlrpc-request-method req

  Return the method of an XMLRPC request.

- sxmlrpc-request-params req

  Return the parameters of an XMLRPC request.

*** XMLRPC responses ***

- sxmlrpc-integer v

  Create an XMLRPC integer.

  (sxmlrpc-integer 34) -> <int>34</int>

- sxmlrpc-boolean b

  Create an XMLRPC boolean.

  (sxmlrpc-boolean #t) -> <boolean>1</boolean>

- sxmlrpc-string s

  Create an XMLRPC string.

  (sxmlrpc-string "Hello!") -> <string>Hello!</string>

- sxmlrpc-base64 b64

  Create an XMLRPC Base64 string.

(sxmlrpc-base64 "eWHJlYWQgdGhpcyE=") -> <base64>eWHJlYWQgdGhpcyE=</base64>

- sxmlrpc-date d

  Create an XMLRPC date.

  (sxmlrpc-date (current-date)) ->

- sxmlrpc-array data f-type

  Create an XMLRPC array for the given data list. Each item in the list
  will be of the XMLRPC type obtained from the f-type procedure.

  (sxmlrpc-array '(1 2 3) sxmlrpc-integer)


- sxmlrpc-struct members

  Create an XMLRPC structure where each entry is a pair from the given

  (sxmlrpc-struct `((blogId . ,(sxmlrpc-integer 14))
                    (blogName . ,(sxmlrpc-string "Just another blog")))

                <value><string>Just another blog</string></value>

- sxmlrpc-fault code message

  Create an XMLRPC fault message.

  (sxmlrpc-fault 23 "Authorization required")

                   <value>Authorization required</value>

- sxmlrpc-fault->xml fault port

  Create an XMLRPC response fault string with the given fault (obtained
  with sxmlrpc-fault) and write it to the given port.

- sxmlrpc-response->xml param port

  Create an XMLRPC response string with the given XMLRPC parameter and
  write it to the specified port.

  XMLRPC parameter is one obtained from: sxmlrpc-string, sxmlrpc-struct,

Attachment: xmlrpc.scm
Description: Text Data

reply via email to

[Prev in Thread] Current Thread [Next in Thread]