bixmlrpc.html

来自「ajax 框价.是个好工具.javascript 矿家.可以用在任何平台.」· HTML 代码 · 共 825 行 · 第 1/2 页

HTML
825
字号
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html><!--Generated using api.website.xsl version 2003-07-17--><head><META http-equiv="Content-Type" content="text/html; charset=utf-8"><title>BiXmlRpc</title><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><link type="text/css" rel="stylesheet" href="api.css"><script type="text/javascript">				function showDerivedClasses() {					var ul = document.getElementById("api-derived-classes");					var lis = ul.childNodes;					var l = lis.length;					for (var i = 1; i < l; i++)						lis[i].style.display = "";					lis[0].style.display = "none";				}			</script></head><body><h1 id="BiXmlRpc">BiXmlRpc</h1><p>This is a class that implements an XML-RPC client. The XML-RPC specifcation can be found at <a href="http://www.xmlrpc.com/spec">http://www.xmlrpc.com/spec</a>. For more info and XML-RPC server implementations see <a href="http://www.xmlrpc.com/">http://www.xmlrpc.com/</a>.</p><p>This class extends		<code><a href="BiEventTarget.html">BiEventTarget</a></code>		and therefore all methods and fields available for		<code><a href="BiEventTarget.html">BiEventTarget</a></code>		are also available for <code>BiXmlRpc</code>.</p><ul class="partial-class-tree"><li><code><a href="BiObject.html">BiObject</a></code><ul><li><code><a href="BiEventTarget.html">BiEventTarget</a></code><ul><li><code>BiXmlRpc</code><ul id="api-derived-classes"></ul></li></ul></li></ul></li></ul><h2>Constructor</h2><p><code>	new BiXmlRpc([<span class="methodArgument">oUri</span>])</code></p><h3>Parameters</h3><table><thead><tr><td>Name</td><td>Type</td><td class="optional-header">Optional</td><td>Default</td><td>Descripton</td></tr></thead><tbody><tr><td><code>oUri</code></td><td><code class="type">				<code><a href="BiUri.html">BiUri</a></code>/String</code></td><td class="optional-column"><img src="check.png" alt="checked"></td><td></td><td>Optional URI where the XMP-RPC server resides</td></tr></tbody></table><h2>Properties</h2><table><thead><tr><td>Name</td><td>Type</td><td class="get-header">get</td><td class="set-header">set</td><td>Descripton</td></tr></thead><tbody><tr><td><a name="async"></a><code>async</code></td><td><code class="type">Boolean</code></td><td class="get-column"><img src="check.png" alt="checked"></td><td class="set-column"><img src="check.png" alt="checked"></td><td>Whether to use asynchronous method call. If this is <code>false</code> then the call to <code><a href="#callMethod">callMethod</a></code> returns instantly. When using asynchronous calling use the <code><a href="#result">result</a></code> event for the call back</td></tr><tr><td><a name="loaded"></a><code>loaded</code></td><td><code class="type">Boolean</code></td><td class="get-column"><img src="check.png" alt="checked"></td><td class="set-column"></td><td>Returns true if the XMP-RPC has finished loading the reply from the server</td></tr><tr><td><a name="loading"></a><code>loading</code></td><td><code class="type">Boolean</code></td><td class="get-column"><img src="check.png" alt="checked"></td><td class="set-column"></td><td>Returns true if the XMP-RPC is currently loading the reply from the server</td></tr><tr><td><a name="password"></a><code>password</code></td><td><code class="type">String</code></td><td class="get-column"><img src="check.png" alt="checked"></td><td class="set-column"><img src="check.png" alt="checked"></td><td>The password to pass to the server when calling the remote procedure</td></tr><tr><td><a name="result"></a><code>result</code></td><td><code class="type">Object</code></td><td class="get-column"><img src="check.png" alt="checked"></td><td class="set-column"></td><td>Returns the result value. This is only available during the load event. If there was an error receiving the result from the server an exception is thrown.</td></tr><tr><td><a name="uri"></a><code>uri</code></td><td><code class="type">				<code><a href="BiUri.html">BiUri</a></code>			</code></td><td class="get-column"><img src="check.png" alt="checked"></td><td class="set-column"><img src="check.png" alt="checked"></td><td>The URI where to find the remote procedure</td></tr><tr><td><a name="user"></a><code>user</code></td><td><code class="type">String</code></td><td class="get-column"><img src="check.png" alt="checked"></td><td class="set-column"><img src="check.png" alt="checked"></td><td>The user name to pass to the server when calling the remote procedure</td></tr><tr><td><a name="xmlLoader"></a><code>xmlLoader</code></td><td><code class="type">				<code><a href="BiXmlLoader.html">BiXmlLoader</a></code>			</code></td><td class="get-column"><img src="check.png" alt="checked"></td><td class="set-column"></td><td>This returns the XML loader that was used in the last method call</td></tr></tbody></table><h2>Methods</h2><table><thead><tr><td>Name</td><td>Description</td></tr></thead><tbody><tr><td><code><a href="#asyncInvoke">asyncInvoke</a></code></td><td>Calls the method with the given name and arguments. This uses asynchronous loading and to get the result listen to the callcomplete event. Arguments 1 to n are passed to the XML-RPC method. If a method call is already in progress it will be aborted before this new call is invoked.</td></tr><tr><td><code><a href="#callMethod">callMethod</a></code></td><td>Calls the method with the given name and arguments. If the XML-RPC client is using synchronous loading the thread is halted until a response is received from the server. If using <code><a href="#async">async</a></code> loading use the <code><a href="#load">load</a></code> event to get the <code><a href="#result">result</a></code>. Arguments 1 to n are passed to the XML-RPC method. If a method call is already in progress it will be aborted before this new call is invoked.</td></tr><tr><td><code><a href="#syncInvoke">syncInvoke</a></code></td><td>Calls the method with the given name and arguments. This uses synchronous loading and will therefore lock the js thread while it is waiting for the reply from the server. Arguments 1 to n are passed to the XML-RPC method. If the server generated an error a<code><a href="BiXmlRpcError.html">BiXmlRpcError</a></code> is thrown. If a method call is already in progress it will be aborted before this new call is invoked.</td></tr><tr><td><code><a href="#useService">useService</a></code></td><td>Tells the XLM-RPC client where the server is located</td></tr></tbody></table><h2>Events</h2><table><thead><tr><td>Name</td><td>Type</td><td class="bubbles-header">Bubbles</td><td>Descripton</td></tr></thead><tbody><tr><td><a name="callcomplete"></a><code>callcomplete</code></td><td><code class="type">				<code><a href="BiXmlRpcCallCompleteEvent.html">BiXmlRpcCallCompleteEvent</a></code>			</code></td><td class="bubbles-column"></td><td>This event is fired when 													a method call is complete.</td></tr><tr><td><a name="load"></a><code>load</code></td><td><code class="type">				<code><a href="BiEvent.html">BiEvent</a></code>			</code></td><td class="bubbles-column"></td><td>This event is fired when a method call 								response is received from the server.</td></tr></tbody></table><h2>Static Methods</h2><table><thead><tr><td>Name</td><td>Description</td></tr></thead><tbody><tr><td><code><a href="#getJsType">getJsType</a></code></td><td>This takes a javascript value and returns the XML-RPC type name.<br>								<br>				 Possible return valuse are:<br>								<br>				 string<br>				 boolean<br>				 int<br>				 double<br>				 dateTime.iso8601<br>				 array<br>				 base64<br>				 struct<br>							</td></tr><tr><td><code><a href="#iso8601ToJsDate">iso8601ToJsDate</a></code></td><td>This takes a date string formatted according to ISO 8601 and returns a javascript Date object to ISO 8601</td></tr><tr><td><code><a href="#jsDateToIso8601">jsDateToIso8601</a></code></td><td>This takes a javascript Date object and returns a string formatted according to ISO 8601</td></tr><tr><td><code><a href="#jsFieldToXmlMemberNode">jsFieldToXmlMemberNode</a></code></td><td>This creates a &lt;member&gt; element that is used with XML-RPC structs</td></tr><tr><td><code><a href="#jsToXmlNode">jsToXmlNode</a></code></td><td>This encodes a javascript value as an XML node.</td></tr><tr><td><code><a href="#jsToXmlValueNode">jsToXmlValueNode</a></code></td><td>This creates a &lt;value&gt; element that contains the XML-RPC value</td></tr><tr><td><code><a href="#makeXmlRpcMessage">makeXmlRpcMessage</a></code></td><td>This returns an XML document containing the XML-RPC method call body</td></tr><tr><td><code><a href="#parseXmlRpcResponse">parseXmlRpcResponse</a></code></td><td>This takes an XML document and returns a javascript value. If there was an error a<code><a href="BiXmlRpcError.html">BiXmlRpcError</a></code> is thrown</td></tr><tr><td><code><a href="#xmlNodeToJs">xmlNodeToJs</a></code></td><td>Returns the javascript value that the XML node describes</td></tr><tr><td><code><a href="#xmlValueNodeToJs">xmlValueNodeToJs</a></code></td><td>Decodes an RPC XML &lt;value&gt; element to a javascript value</td></tr></tbody></table><h2>Static Fields</h2><table><thead><tr><td>Name</td><td>Type</td><td>Descripton</td></tr></thead><tbody><tr><td><code>MAX_INT</code></td><td><code class="type">Number</code></td><td>The max value for a 4 byte integer</td></tr></tbody></table><h2>Remarks</h2><p>The struct type is represented by the Object type<br>				<br>		             The base64 type is represented by the<code><a href="BiBase64.html">BiBase64</a></code> class.<br>				<br>		 			To ensure that a number is encoded as a double you can use 		<code><a href="BiXmlRpcDouble.html">BiXmlRpcDouble</a></code>.<br>				<br>		             If you want to ensure that a number is encoded             as an int you can either use<code><a href="BiXmlRpcInt.html">BiXmlRpcInt</a></code> or make sure that the             the number does not have any decimals (using Math.floor,             Math.ceil or Math.round).<br>				<br>		             The XML-RPC client only supports one call at a time. If a call             is in progress and another call is made the first one is aborted.</p><h2>Method Details</h2><h3><a name="asyncInvoke"></a>asyncInvoke</h3><p>Calls the method with the given name and arguments. This uses asynchronous loading and to get the result listen to the callcomplete event. Arguments 1 to n are passed to the XML-RPC method. If a method call is already in progress it will be aborted before this new call is invoked.</p><h4>Syntax</h4><pre class="method-syntax">object.asyncInvoke(<span class="methodArgument">sMethodName</span> [, <span class="methodArgument">oArg</span>])</pre><h4>Parameters</h4><table><thead><tr><td>Name</td><td>Type</td><td class="optional-header">Optional</td><td>Default</td><td>Descripton</td></tr></thead><tbody><tr><td><code>sMethodName</code></td><td><code class="type">String</code></td><td class="optional-column"></td><td></td><td>The name of the method to call</td></tr><tr><td><code>oArg</code></td><td><code class="type">Object</code></td><td class="optional-column"><img src="check.png" alt="checked"></td><td></td><td>One or more arguments that are passed to to the method.</td></tr></tbody></table><h4>Return Type</h4><p><code class="type">void</code></p><h3><a name="callMethod"></a>callMethod</h3><p>Calls the method with the given name and arguments. If the XML-RPC client is using synchronous loading the thread is halted until a response is received from the server. If using <code><a href="#async">async</a></code> loading use the <code><a href="#load">load</a></code> event to get the <code><a href="#result">result</a></code>. Arguments 1 to n are passed to the XML-RPC method. If a method call is already in progress it will be aborted before this new call is invoked.</p><h4>Syntax</h4><pre class="method-syntax">object.callMethod(<span class="methodArgument">sMethodName</span> [, <span class="methodArgument">oArg</span>])</pre><h4>Parameters</h4><table><thead><tr><td>Name</td><td>Type</td><td class="optional-header">Optional</td><td>Default</td><td>Descripton</td></tr></thead><tbody><tr><td><code>sMethodName</code></td><td><code class="type">String</code></td><td class="optional-column"></td><td></td><td>The name of the method to call</td></tr><tr><td><code>oArg</code></td><td><code class="type">Object</code></td><td class="optional-column"><img src="check.png" alt="checked"></td><td></td><td>One or more arguments that are passed to to the method.</td></tr></tbody></table><h4>Return Type</h4><p><code class="type">Object</code></p><h3><a name="syncInvoke"></a>syncInvoke</h3><p>Calls the method with the given name and arguments. This uses synchronous loading and will therefore lock the js thread while it is waiting for the reply from the server. Arguments 1 to n are passed to the XML-RPC method. If the server generated an error a<code><a href="BiXmlRpcError.html">BiXmlRpcError</a></code> is thrown. If a method call is already in progress it will be aborted before this new

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?