?? index.html
字號:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html lang="en"><head> <title></title><meta http-equiv="content-type" content="text/html; charset=utf-8"><meta name="author" content="Eldan Ben-Haim"><!-- TODO: Change to relative URLs --><link type="text/css" rel="stylesheet" media="screen, projection, print" href="http://www.bindows.net//css/style.css"><script type="text/javascript" src="http://www.bindows.net/js/include.js"></script><script type="text/javascript">layout.init("../");</script><style type="text/css">.SampleTrail { border: 1px solid black; background: LightYellow;}.SampleTrail p,.SampleTrail pre{ margin: 1ex;}.CmdTranscript { border-left: 2px solid gray; margin: 2ex 4ex; padding-left: 1ex;}em.underline { font-style: normal; text-decoration: underline;} </style></head><body><script type="text/javascript">layout.writeNavigationBar();</script><script type="text/javascript">layout.writeHeader("WSDL2BiWs Manual");</script><div class="main"><h2>Contents</h2><ul class="toc"> <li><a href="#1">1 Introduction</a> </li> <li><a href="#2">2 User's Guide and Tutorial</a> <ul> <li><a href="#2.1">2.1 Overview</a></li> <li><a href="#2.2">2.2 Web Services Background</a></li> <li><a href="#2.3">2.3 Preparing to Develop a Web Service Client</a></li> <li><a href="#2.4">2.4 Generating Code Using Wsdl2BiWs</a></li> <li><a href="#2.5">2.5 Testing the Web Service Stub</a></li> <li><a href="#2.6">2.6 Writing an Application Using the Web Service Stub</a></li> </ul> </li> <li><a href="#3">3 Reference Information</a> <ul> <li><a href="#3.1">3.1 Wsdl2BiWs Command Line Options</a></li> <li><a href="#3.2">3.2 Wsdl2BiWs Generated Stub Structure</a></li> </ul> </li></ul><h2><a name="1"></a>1 Introduction</h2><p> <strong>Wsdl2BiWs</strong> is a Bindows™ utility for generating Bindows™ JavaScript classesthat provide access to existing web-services. Wsdl2BiWs receives, as an input, a<a href="http://www.w3.org/TR/wsdl">WSDL</a> file -- which describes the accessedweb-service. Analyzing this file, it generates JavaScript code based on the Bindows™ frameworkwhich allows a client application to invoke operations offered by this service -- as they're described in the WSDL file. The generated code consists of a single class, called the <strong>web-service stub</strong>, which includes functions corresponding to operations offeredby the service.</p><p> In addition to generating the web-service stub, Wsdl2BiWs can also generate a complete Bindows™ application that can be used to test the stub and the web-service. This test application enables the user to invoke web-service operations with arbitrary parameters and view the web-service response. The test application uses the web-service stub to communicate with the web-service. In additionto testing purposes, it can also serve as a sample application demonstrating use of the generated web-service stub.</p><p> This document provides a guide to using Wsdl2BiWs for developing and testing web-service clients with little effort, utilizing automated processes.</p><h2><a name="2"></a>2 User's Guide and Tutorial</h2><h3><a name="2.1"></a>2.1 Overview</h3><p> Chapter 2 of this document provides step-by-step instructions for using Wsdl2BiWs. Throughout thischapter we create a Bindows™ application to work with the <a href="$BindowsCenterDescription">Bindows™ Center</a> web service. The Bindows™ Center web service provides the Bindows™developer community with tools to stay up-to-date with current Bindows™ platform advances. Our application will use the service to display product news and provide means to download the latest versionof Bindows™. notice that the Bindows™ Center web service provides additional functionality,which our application won't utilize.</p><p>The step-by-step guide assumes basic knowledge of the Bindows™ framework. Aspectsof the application development that don't directly relate to using web services aren't discussedhere. The developed application is based on a skeleton application taking care of theseissues, available for download <a href="resources/W2WS_sample_skel.zip">here.</a></p><div class="SampleTrail"><p>Each step in the guide starts with a general discussion of its purpose and how it can be carried out.Following this discussion, the concrete actions to be carried out in order to complete the step for theBindows™ Center client application are provided in boxes like this one. If you want to followthese actions to actually build your own Bindows™ Center client application, you should first dothe following:</p><ul><li>Make sure you have a Bindows™ framework installation. This guide assumes that you haveinstalled Bindows™ on a Windows PC, to <code>c:\bindows</code>.</li><li>Download the <a href="resources/W2WS_sample_skel.zip">skeleton application ZIP file</a>, and unzip itto your preferred location. This guide assumes that you have unzipped the skeleton to<code>c:\bindows\samples\BindowsCenter</code>.</li></ul><p>The Bindows™ Center sample application can be launched by opening file<code>c:\bindows\samples\BindowsCenter</code> in a browser. We recommend launching the sample skeleton once before youcontinue -- to gain a general idea of what the application should look like.</p></div><h3><a name="2.2"></a>2.2 Web Services Background</h3><h4><a name="2.2.1"></a>2.2.1 Web services, SOAP, and WSDL</h4><p>Generally speaking, web services are server applications that communicate with clients using the HTTPprotocol. Most web services rely on an XML-based protocol called <!--LINK-->SOAP (Simple Object AccessProtocol) to encode requests and responses sent over HTTP. SOAP defines an XML document structurefor the request and response -- including request parameter encoding, protocol administrative information,etc. A SOAP web service supports one or more <strong>operations</strong> ("functions"), grouped into <strong>ports</strong> ("interfaces").Each operation has a unique XML namespace-qualified name used to identify it; the same applies to ports.</p><p>A client wishing to interact with a server through SOAP will generally issue an HTTP POST request to theservice URL, with the POSTed content consisting of a SOAP request XML. This will generally look like thefollowing:</p><pre><code><SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:xsd="http://www.w3.org/1999/XMLSchema" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> <SOAP-ENV:Body> <m:sayHello xmlns:m="http://tempuri.org"> <who xsi:type="xsd:string">Bob</who> </m:sayHello> </SOAP-ENV:Body></SOAP-ENV:Envelope></code></pre><p>The response to the HTTP request issued by the client will have a SOAP response message as its content.The following is an example response message matching the request described above:</p><pre><code><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/1999/XMLSchema" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"> <SOAP-ENV:Body> <m:sayHelloResponse xmlns:m="http://tempuri.org"> <m:sayHelloReturn>Hello Bob!</m:sayHelloReturn> </m:sayHelloResponse> </SOAP-ENV:Body></SOAP-ENV:Envelope></code></pre><p> These are simplified for brevity. Reading the request and the response, it isquite obvious that the interaction quoted above was an invocation of an operationnamed <code>sayHello</code> (in namespace <code>http://tempuri.org</code>). </p><p> For clients to be able to communicate with web services, knowledge of the interface exposed bythe web service should be available to the client (or its implementor). This knowledge is conveyedin a format called <a href="http://www.w3.org/TR/wsdl">WSDL</a>. A WSDL file is an XML filedescribing one or more services or ports. It includes the following information:</p><ul><li><strong>Port and Operation definitions:</strong> These definitions include the logical structure of eachoperation's request and response (including parameter names, etc.) and their grouping into ports.</li><li><strong>Binding definitions:</strong> These assert how ports and operations are actually accessed. For instance,a binding definition may indicate that a port is accessible using the SOAP-protocol.</li><li><strong>Service definitions:</strong> Provide information on services, their available ports (and bindings),and additional information required to access them, such as URLs.</li></ul><p>By examining a WSDL file, the client gains full understanding of how interaction with a web serviceshould be structured. In the context of SOAP-based web services, this includes the exact structure ofSOAP requests and responses, the URL to which HTTP requests should be issued, and more.</p><p>Notice that a WSDL file doesn't necessarily specify <em class="underline">semantics</em> of the web service interface.Semantics may be embedded in free-form language in the WSDL, or otherwise expressed -- in a manner externalto the WSDL mechanism.</p><h4><a name="2.2.2"></a>2.2.2 Web services in Bindows™</h4><p>In Bindows™, web services are accessed through the <!--LINK--><code>BiWebService</code> class. Thisclass allows programmatic access to SOAP-based web services. Using <code>BiWebService</code> always startswith providing it a WSDL file describing the accessed web service. Once a WSDL file was read, access to theweb service can be made in several ways, among which:</p><ul><li><strong>Web service object:</strong> <code>BiWebService</code> creates, in runtime, an object which includesmethods corresponding each web service operation. Invoking these methods will issue a SOAP request toinvoke the corresponding web service operation; the method will return the value returned from theweb service. Example:<pre><code>var lService = BiWebService();lService.useService("$BindowsCenterWsdl", "BindowsCenter");alert(lService.BindowsCenter.GetLatestVersionId("bindows"));</code></pre>This code will invoke the <code>GetLatestVersionId</code> operation of the Bindows™ Center webservice.<br>Notice that since the web service object is created from the WSDL in runtime, no actual JavaScript codedefinition of the web service methods is available to the developer. The only documentation of the serviceAPI is available from the service WSDL.</li><li><strong>Direct call:</strong> Using <code>BiWebService</code> methods, the developer can call a web serviceoperation identified by its string name. Example:
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -