⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 index.html

📁 ajax 框价.是个好工具.javascript 矿家.可以用在任何平台.
💻 HTML
📖 第 1 页 / 共 4 页
字号:
<p>To invoke a service operation asynchronously, use the <code>async_</code> method. The asynchronous invocation methodreceives the soap operation parameters, prefixed by two additional parameters: a callback method, and a <code>this</code>value for the callback method. When called, the asynchronous invocation method will send the web service an invocationrequest for the operation and parameters it received, and return immediately. When the web service responds, thecallback method passed to the call is executed, with <code>this</code> set to the value specified in the service operationinvocation call.</p><p>The asynchronous callback method receives a single parameter, which contains the web service invocation result object -- asreturned by <code>BiWebService</code>. Two important members of this result object are <code>error</code>, which indicateswhether an error ocurred during the invocation, and <code>value</code> which contains the actual value returned fromthe service (unless an error occurred).<br>Code for asynchronous service operation invocation will typically look like the following example:</p><pre><code>MyApp.protoype.showFooValue = function (){  var lRes;  lRes = this._sampleService.async_BarPort_FooOperation(this.handleFooValueResult, this, "Hello", "World!");}MyApp.protoype.handleFooValueResult = function (aResult){  if(!aResult.error)  {     alert('Result: ' + aResult.result);  } else  {     alert('Error invoking FooValue.');  }}</code></pre><div class="SampleTrail"><p>We will deal with loading the Bindows&trade; Center news into our application. Since the news content may be quite long,we want our application to asynchronously invoke the GetNews operation, and when a response news XML is received,transform it and display it in the news section of the UI.We first asynchronously invoke the GetNews operation upon a click on the <strong>Get Data</strong> button. To do this, add thebold lines in the following sample:</p><pre><code>BindowsCenterApp.prototype.onGetDataClick = function(){  // Implement behavior of GetData buton here.  // Get the Bindows latest version and URL for download from the web service  var lLatestVer = this._bindowsCenter.sync_BindowsCenterSoap_GetLatestVersionId("bindows");  var lLatestVerUrl = this._bindowsCenter.sync_BindowsCenterSoap_GetProductDownloadUrl("bindows", lLatestVer);  // Build link at bottom of screen  var lLinkHtml = '&lt;p align="center"&gt;&lt;a href="' + lLatestVerUrl + '"&gt;Latest Bindows&amp;trade; Version is ' + lLatestVer + '.&lt;/a&gt;&lt;/p&gt;';  this._versionLabel.setHtml(lLinkHtml);  // Start async load of news  this._bindowsCenter.async_BindowsCenterSoap_GetNews(this.handleNewsReceived, this, ["release", "kb"]);}</code></pre><p>Now, we should only implement the asynchronous invocation completion function, <code>handleNewsReceived</code>. Append the following lines to our application file:</p><pre><code>BindowsCenterApp.prototype.handleNewsReceived = function(aResult){  if(aResult.error)  {    this._newsSection.setText("Error obtaining news: " + aResult.errorDetail.string);  } else  {    this._loadNewsXml(aResult.value);  }}</code></pre><p>Notice that this code uses method <code>_loadNewsXml</code> implemented in the skeleton to transform the newsXML to an HTML fragment and display it.</p><p>This concludes the development of our sample web service client. Feel free to enhance it!</p></div><h2><a name="3"></a>3 Reference Information</h2><h3><a name="3.1"></a>3.1 Wsdl2BiWs Command Line Options</h3><h3><a name="3.1.1"></a>3.1.1 General Syntax</h3><p>The general syntax of Wsdl2BiWs is as follows:</p><p class="CmdTranscript"><code>Wsdl2BiWs.py</code> <strong>[options]</strong> <strong>[wsdl-url]</strong></p><p>Where <strong>[options]</strong> are any of the command-line options described below, and <strong>[wsdl-url]</strong> is a URL to theWSDL from which the stubs are to be generated.</p><h3><a name="3.1.2"></a>3.1.2 General Options</h3><table border="1"><thead><tr><th>Option</th><th>Description</th></tr></thead><tr>   <td><code>--version</code></td>   <td>Show Wsdl2BiWs version information, then quit.</td></tr><tr>   <td><code>-v</code>,<br><code>--verbose</code></td>   <td>Display additional information to the user during code generation.</td></tr><tr>   <td><code>-h</code>,<br><code>--help</code></td>   <td>Display a help message, containing a summary of available options.</td></tr></table><h3><a name="3.1.3"></a>3.1.3 Stub Generation Options</h3><table border="1"><thead><tr><th>Option</th><th>Description</th></tr></thead><tr>   <td><code>-c</code><strong>[comments]</strong>,<br><code>--comments </code><strong>[comments]</strong></td>   <td>Select type of comments to be generated in stub code. Also affects sample application. Can either be   <code>default</code> or <code>none</code>. Default is <code>default</code>.</td></tr><tr>   <td><code>-t</code><strong>[call-type]</strong>,<br><code>--calltype </code><strong>[call-type]</strong></td>   <td>Select type of methods to be generated in stub code. Also affects sample application. Can either be   <code>async</code> for asynchronous operation invocation methods, <code>sync</code> for synchronous   opration invocation methods, or <code>both</code> for both. Default is <code>both</code>.</td></tr><tr>   <td><code>-o</code><strong>[output-file-name]</strong>,<br><code>--output </code><strong>[output-file-name]</strong></td>   <td>Specify a non-default filename for the generated stub source code. </td></tr><tr>   <td><code>-s</code><strong>[service-name]</strong>,<br><code>--service </code><strong>[service-name]</strong></td>   <td>Generate stub only for service identified by <strong>[service-name]</strong>. If multiple instances of this option are    specified, all specified services will be generated. If this option is not specified at all, all services in the    processed WSDL file will be generated. Service name format is    <code>[</code><strong>[namespace-uri]</strong><code>]</code><strong>[name]</strong> where <strong>[namespace-uri]</strong> is the URI of the    namespace within which the service is defined, and <strong>[name]</strong> is the service's local name within that namespace.</td></tr></table><h3><a name="3.1.4"></a>3.1.4 Sample Application Generation Options</h3><table border="1"><thead><tr><th>Option</th><th>Description</th></tr></thead><tr>   <td><code>-a</code><strong>[app-name]</strong>,<br><code>--app </code><strong>[app-name]</strong></td>   <td>Request that a sample application be generated for the generated stub. The sample application consists of threefiles: a JavaScript file named <strong>[app-name]</strong>, an ADF file named the same with the suffix replaced by .xml, and anHTML file named the same with the suffix replaced by .html.</td></tr><tr>   <td><code>-b</code><strong>[bindows-path]</strong>,<br><code>--bindows </code><strong>[bindows-path]</strong></td>   <td>Request that the sample application be generated using a version of Bindows&trade; other than that of the Wsdl2BiWs.<strong>[bindows-path]</strong> is the path to the Bindows&trade; installation the sample application should use.</td></tr><tr>   <td><code>--nolaunch</code></td>   <td>Don't launch the generated sample application.</td></tr></table><h3><a name="3.2"></a>3.2 Generated Stub Structure</h3><p>The source code file generated by Wsdl2BiWs for the web service stubs consists of a series of stub classes, one for eachweb service. Each class is named as the local name of the service it connects to. For instance, for service<code>[http://tempuri.org]Sample</code> this will be <code>Sample</code>. The stub class is derived from<code>BiObject</code>, and consists of the following <strong>public</strong> methods:<h4>Constructor</h4><code>function Stub(aWebService, aWsdl)</code><p>The stub constructor receives two parameters: </p><ul><li><code>aWebService</code>: a BiWebService object to use for interacting with the web service. This must be in acompleted <code>readyState</code>.</li><li><code>aWsdl</code>: a URL to the WSDL defining the service. This will typically link to the same WSDL used to generatethe service.</li></ul><h4>Synchronous Operation Invocation Methods</h4><code>Stub.prototype.sync_<strong>PortName</strong>_<strong>OperationName</strong>(<strong>operation_parameter1, ...</strong>)</code><p>Synchronous operation invocation methods are used to synchronously invoke an operation of the web service.They return only after receiving a response from the web service. The return code from these methods is the resultreturned by the web service. If the web service returned a SOAP fault response, or any error occurred during communicationwith the service, an exception will be thrown.</p><p>Synchronous operation invocation methods are named after their operation and the operation's port. An operation'sinvocation method is obtained by replacing <strong>PortName</strong> above with the local name of the operation's portand <strong>OperationName</strong> with the operation's local name.</p><p>All parameters passed to  synchronous operation invocation methods are defined by the operation's message parts.</p><h4>Asynchronous Operation Invocation Methods</h4><code>Stub.prototype.async_<strong>PortName</strong>_<strong>OperationName</strong>(aCallback, aCallbackThis, <strong>operation_parameter1, ...</strong>)</code><p>Asynchronous operation invocation methods are used to asynchronously invoke an operation of the web service.They return immediately and handle the invocation in the background. When an error occurs or a response is retrievedfrom the web service, a callback function passed to the invocation method is called, with an object describing the resultor the error.</p><p>Asynchronous operation invocation methods are named after their operation and the operation's port. An operation'sinvocation method is obtained by replacing <strong>PortName</strong> above with the local name of the operation's portand <strong>OperationName</strong> with the operation's local name.</p><p>The following parameters are passed to asynchronous operation invocation methods:</p><ul><li><code>aCallback</code>: A callback function to be called when a result for the operation is available. This functionreceives a single parameter, through which the result object as defined for <code>BiWebService</code> is returned.</li><li><code>aCallbackThis</code>: An object to be used as the <code>this</code> value for the callback call. This can benull if <code>aCallback</code> doesn't require a target instance.</li><li>All other parameters are defined by the web service operation's message parts.</li></ul></div><script type="text/javascript">layout.writeFooter()</script></body></html>

⌨️ 快捷键说明

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