caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* ANN: XmlRpc-Light 0.5
@ 2007-09-15 21:55 Dave Benjamin
  0 siblings, 0 replies; only message in thread
From: Dave Benjamin @ 2007-09-15 21:55 UTC (permalink / raw)
  To: caml-list

I'm happy to announce the release of version 0.5 of XmlRpc-Light. 
XmlRpc-Light is an XmlRpc library written in OCaml. It requires 
Xml-Light and Ocamlnet 2.

http://code.google.com/p/xmlrpc-light/

New in version 0.5

     * client: configurable socket timeouts
     * client: basic authentication
     * client: custom HTTP headers
     * client: SSL support (requires command-line "curl" program)
     * client: multicall class with optional lazy call behavior
     * client: better interoperability with Apache XMLRPC
     * client: code generation tool based on introspection functions
     * server: methodHelp and methodSignature introspection functions
     * server: shallow type checking of method signatures
     * server: multiple signatures per method (overloading)
     * both: proper text/xml Content-Type header and xml preamble
     * both: 32-bit integer support

This version features a convenience class for "multicall", a de-facto 
standard protocol for packaging multiple method calls together into a 
single request. It uses OCaml's lazy type to keep the interface very 
similar to regular method calls. Use of the lazy behavior is optional.

Instances take an XmlRpc.client as an argument:

         # let mc = new XmlRpc.multicall client;;
         val mc : XmlRpc.multicall = <obj>

The "call" method works like client#call, but it returns a lazy value:

         # let a = mc#call "demo.addTwoNumbers" [`Int 3; `Int 4];;
         val a : XmlRpc.value Lazy.t = <lazy>
         # let b = mc#call "demo.addTwoNumbers" [`Int 42; `String "oh 
noes!"];;
         val b : XmlRpc.value Lazy.t = <lazy>
         # let c = mc#call "demo.addTwoNumbers" [`Double 3.0; `Double 4.0];;
         val c : XmlRpc.value Lazy.t = <lazy>

At this point, the call has not been executed yet:

         # mc#executed;;
         - : bool = false

As soon as one of the return values is forced, the call is executed:

         # Lazy.force a;;
         -- : XmlRpc.value = `Int 7
         # mc#executed;;
         - : bool = true

Once a call has been executed, this instance cannot be used to make any 
further calls; instead, a new multicall instance must be created:

         # mc#call "demo.addTwoNumbers" [`Int 2; `Int 2];;
         Exception: Failure "multicall#call: already executed".

If an XmlRpc fault occurred, the exception will be thrown when the lazy 
value is forced: # Lazy.force b;; Exception: XmlRpc.Error (-32602, 
"server error. invalid method parameters"). ]} This will not prevent 
further methods from executing successfully:

         # Lazy.force c;;
         - : XmlRpc.value = `Double 7.

It is possible for a multicall to be executed but not completed, for 
example if a transport occurs. Aside from catching the exception, the 
completed property indicates if the call actually went through or not:

         # mc#completed;;
         - : bool = true

It is not necessary to use lazy values. Instead, the call can be 
executed explicitly, and the results can be retrieved by number:

         # let mc = new XmlRpc.multicall client;;
         val mc : XmlRpc.multicall = <obj>
         # ignore (mc#call "demo.addTwoNumbers" [`Int 2; `Int 2]);;
         -- : unit = ()
         # ignore (mc#call "demo.addTwoNumbers" [`Int 3; `Int 3]);;
         -- : unit = ()
         # mc#result 1;;
         -- : XmlRpc.value = `Int 6

This release also includes a fix to the WordPress example code, thanks 
to Janne Hellsten. It has been tested with Ocamlnet 2.2.7 and 2.2.8, 
though the use of 2.2.8 or newer is recommended for correct behavior of 
the Netplex server.

Best wishes,
Dave


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-09-15 21:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-09-15 21:55 ANN: XmlRpc-Light 0.5 Dave Benjamin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).