From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.1.3 Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 22B2CBC6C for ; Sat, 15 Sep 2007 23:56:52 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ao8CAM7x60ZA9hw0/2dsb2JhbAA X-IronPort-AV: E=Sophos;i="4.20,259,1186351200"; d="scan'208";a="1243668" Received: from tenhost.net ([64.246.28.52]) by mail2-smtp-roc.national.inria.fr with SMTP; 15 Sep 2007 23:57:35 +0200 Received: (qmail 18129 invoked from network); 15 Sep 2007 16:29:00 -0500 Received: from ip72-208-52-84.ph.ph.cox.net (HELO ?192.168.1.99?) (72.208.52.84) by tenhost.net with SMTP; 15 Sep 2007 16:29:00 -0500 Message-ID: <46EC54EB.8010909@ramenlabs.com> Date: Sat, 15 Sep 2007 14:55:55 -0700 From: Dave Benjamin User-Agent: Mozilla-Thunderbird 2.0.0.4 (X11/20070828) MIME-Version: 1.0 To: caml-list@yquem.inria.fr Subject: ANN: XmlRpc-Light 0.5 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; xmlrpc:01 ocaml:01 ocamlnet:01 command-line:01 xmlrpc:01 overloading:01 de-facto:01 ocaml's:01 val:01 val:01 bool:01 bool:01 ocamlnet:01 curl:98 3.0:98 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 = 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 = # let b = mc#call "demo.addTwoNumbers" [`Int 42; `String "oh noes!"];; val b : XmlRpc.value Lazy.t = # let c = mc#call "demo.addTwoNumbers" [`Double 3.0; `Double 4.0];; val c : XmlRpc.value Lazy.t = 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 = # 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