using the webservice behavior
the following topics are discussed in this document. 【程序编程相关:利用JDBC编写能实现数据库连接与断开的】
internet development indexthis article explains how to use the webservice behavior to call remote methods from web services. the webservice behavior is implemented with an html component (htc) file as an attached behavior, so it can be used in microsoft internet explorer 5 and later versions. most of this article focuses on how to use the webservice behavior, but it also touches briefly on web services that are used by the webservice behavior. the about the webservice behavior provides additional discussion and information on the main benefits and features of the webservice behavior; it also provides numerous links to related web sites. 【推荐阅读:单击菜单只运行一个子窗体实例的简单方法】
this section defines certain terms that are used frequently in this article. 【扩展信息:FreeMarker设计指南(2) 】
terminology attaching the webservice behavior identifying web services calling methods on web services handling results from webservice calls the call object ssl authentication calling methods on remote servers related topicsterminology
web service programmable application logic accessible using standard internet protocols. web services provide well-defined interfaces, or contracts, that describe the services provided. the webservice behavior uses web services. webservice behavior the primary subject of this article. a reusable dhtml component that uses web services by communicating over http using soap. callservice method one of the methods exposed by the webservice behavior. method call the invocation of a method.attaching the webservice behavior
the first step in using the webservice behavior is to attach it to an element using the style attribute. it is also necessary to set the id attribute so that this element can be easily referenced in script, as shown in the following example.
<body> <div id="service" style="behavior:url(webservice.htc)"></div> </body>this is all that´s needed to attach the behavior to the document. the behavior can also be applied using other variations of cascading style sheets (css) style sheet syntax. to begin working with the webservice behavior, it is easiest to download the webservice htc file and copy it to the same directory as the web page that uses the behavior. by referencing a local file, any dynamic html (dhtml) behavior-related cross-domain security issues are avoided, and the webservice htc file download is invisible to the client.
the next topic explains how to initialize the behavior and identify any web services that will be used by the web page.
identifying web services
any given web service exists at a specific url, so the webservice behavior provides the useservice method to map the web service url to a friendlyname, which is passed as a parameter to the method. after this method has been called, the friendly name for the web service can be used directly in script to reference the web service url, which helps to keep the script code readable and as simple as possible.
the basic syntax of the useservice method is as follows:
... 下一页