<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <link rel="stylesheet" href="style.css" type="text/css"> <meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type"> <link rel="Start" href="index.html"> <link rel="previous" href="XmlRpc.client.html"> <link rel="Up" href="XmlRpc.html"> <link title="Index of types" rel=Appendix href="index_types.html"> <link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> <link title="Index of values" rel=Appendix href="index_values.html"> <link title="Index of class attributes" rel=Appendix href="index_attributes.html"> <link title="Index of class methods" rel=Appendix href="index_methods.html"> <link title="Index of classes" rel=Appendix href="index_classes.html"> <link title="Index of class types" rel=Appendix href="index_class_types.html"> <link title="Index of modules" rel=Appendix href="index_modules.html"> <link title="XmlRpc" rel="Chapter" href="XmlRpc.html"> <link title="XmlRpcServer" rel="Chapter" href="XmlRpcServer.html"> <link title="XmlRpcDateTime" rel="Chapter" href="XmlRpcDateTime.html"> <link title="XmlRpcBase64" rel="Chapter" href="XmlRpcBase64.html"><title>XmlRpc.multicall</title> </head> <body> <div class="navbar"><a href="XmlRpc.client.html">Previous</a> <a href="XmlRpc.html">Up</a> </div> <center><h1>Class <a href="type_XmlRpc.multicall.html">XmlRpc.multicall</a></h1></center> <br> <pre><span class="keyword">class</span> <a name="TYPEmulticall"></a>multicall : <code class="type"><a href="XmlRpc.client.html">client</a> -> </code><code class="code">object</code> <a href="XmlRpc.multicall.html">..</a> <code class="code">end</code></pre>Convenience class for <code class="code">system.multicall</code> calls. <p> Instances take an <a href="XmlRpc.client.html"><code class="code">XmlRpc.client</code></a> as an argument: <pre><code class="code"> # let mc = new XmlRpc.multicall client;; val mc : XmlRpc.multicall = <obj> </code></pre> The "call" method works like <code class="code">client#call</code>, but it returns a lazy value: <pre><code class="code"> # 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> </code></pre> At this point, the call has not been executed yet: <pre><code class="code"> # mc#executed;; -- : bool = false </code></pre> As soon as one of the return values is forced, the call is executed: <pre><code class="code"> # Lazy.force a;; -- : XmlRpc.value = `Int 7 # mc#executed;; -- : bool = true </code></pre> Once a call has been executed, this instance cannot be used to make any further calls; instead, a new <code class="code">multicall</code> instance must be created: <pre><code class="code"> # mc#call "demo.addTwoNumbers" [`Int 2; `Int 2];; Exception: Failure "multicall#call: already executed". </code></pre> If an XmlRpc fault occurred, the exception will be thrown when the lazy value is forced: <pre><code class="code"> # Lazy.force b;; Exception: XmlRpc.Error (-32602, "server error. invalid method parameters"). </code></pre> This will not prevent further methods from executing successfully: <pre><code class="code"> # Lazy.force c;; -- : XmlRpc.value = `Double 7. </code></pre> It is possible for a <code class="code">multicall</code> to be executed but not completed, for example if a transport error occurs. Aside from catching the exception, the <code class="code">completed</code> property indicates if the call actually went through or not: <pre><code class="code"> # mc#completed;; -- : bool = true </code></pre> It is not necessary to use lazy values. Instead, the call can be executed explicitly, and the results can be retrieved by number: <pre><code class="code"> # 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 </code></pre><br> <hr width="100%"> <pre><span class="keyword">method</span> <a name="METHODcall"></a>call : <code class="type">string -> <a href="XmlRpc.html#TYPEvalue">value</a> list -> <a href="XmlRpc.html#TYPEvalue">value</a> Lazy.t</code></pre><div class="info"> Adds a call to this <code class="code">multicall</code> instance. If the call has already executed, the following exception will be raised: Failure "multicall#call: already executed".<br> </div> <pre><span class="keyword">method</span> <a name="METHODexecute"></a>execute : <code class="type">unit -> unit</code></pre><div class="info"> Forces the call to execute immediately. If the call has already executed and completed successfully, the following exception will be raised: Failure "multicall#execute: already completed".<br> </div> <pre><span class="keyword">method</span> <a name="METHODresult"></a>result : <code class="type">int -> <a href="XmlRpc.html#TYPEvalue">value</a></code></pre><div class="info"> Returns a <code class="code">multicall</code> result, executing the call if necessary. The results are numbered starting with zero.<br> </div> <pre><span class="keyword">method</span> <a name="METHODexecuted"></a>executed : <code class="type">bool</code></pre><div class="info"> True if the call has executed, whether or not it succeeded.<br> </div> <pre><span class="keyword">method</span> <a name="METHODcompleted"></a>completed : <code class="type">bool</code></pre><div class="info"> True of the call has executed and completed successfully.<br> </div> </body></html>