spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

home / experts / javascript / column97


Web Services, Part II: Calling Service Methods

Developer News
Google to Shake Up Browsers With Own Launch
Mozilla's Ubquity Mashup: For The Masses?
iPhone Users Just Want to Have Fun

Attaching the WebService Behavior

In order to call remote methods from Web Services, you need to use the WebService behavior. The WebService behavior is implemented as an HTML Component (HTC), so it can be used in Microsoft Internet Explorer 5 and later versions. The WebService behavior communicates with Web Services over HTTP using Simple Object Access Protocol (SOAP).

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. You can attach the WebService behavior to various types of elements. Here is an example that shows how to attach it to a DIV element:

<DIV ID="webServiceCallerDiv"
  STYLE="behavior:url(webservice.htc)"></DIV>

And here is an example that shows how to attach it to a BODY element:

<BODY ID="webServiceCallerBody"
  STYLE="behavior:url(webservice.htc)"></BODY>

The behavior can also be applied using other variations of Cascading Style Sheets (CSS) syntax.

To begin working with the WebService behavior, download the WebService HTC file and copy it to the same directory as the Web page that uses the behavior. By placing the WebService HTC file in the same directory as your HTML page that calls it, you avoid any DHTML behavior-related cross-domain security issues.

The behavior webservice.htc is the cornerstone for enabling Web service calls from JavaScript. This behavior is rather complicated. It consists of over 2000 lines, divided among more than 75 functions. In general, most of the interface to this behavior is done via its public properties, events, and methods, as defined in the PUBLIC:COMPONENT element:

<PUBLIC:COMPONENT  ID=_webservice  Name="WEBSERVICE" >
  <PUBLIC:PROPERTY NAME="version"
    VALUE="Microsoft WebService Behavior 1.0.1.810" />
  <PUBLIC:PROPERTY NAME="showProgress" VALUE=false />
  <PUBLIC:METHOD   NAME="useService"/>
  <PUBLIC:METHOD   NAME="createCallOptions"/>
  <PUBLIC:METHOD   NAME="createUseOptions"/>
  <PUBLIC:METHOD   NAME="invokeNext"/>
  <PUBLIC:METHOD   NAME="callService"/>
  <PUBLIC:EVENT    ID="eventResult"  NAME="onresult"/>
  <PUBLIC:EVENT    ID="eventService"
    NAME="onserviceavailable"/>
</PUBLIC:COMPONENT>

Next: How to load a Web service URL

http://www.internet.com



JupiterOnlineMedia

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

Solutions
Whitepapers and eBooks
Intel PDF: Virtualization Delivers Data Center Efficiency
Intel eBook: Managing the Evolving Data Center
Microsoft Article: BitLocker Brings Encryption to Windows Server 2008
Symantec eBook: The Guide to E-Mail Archiving and Management
Microsoft Article: RODCs Transform Branch Office Security
Go Parallel Article: James Reinders on the Intel Parallel Studio Beta Program
Avaya Article: Advancing the State of the Art in Customer Service
Adobe Acrobat Connect Pro: Web Conferencing and eLearning Whitepapers
Avaya Article: Avaya AE Services Provide Rapid Telephony Integration with Facebook
Go Parallel Article: Getting Started with TBB on Windows
HP eBook: Storage Networking , Part 1
MORE WHITEPAPERS, EBOOKS, AND ARTICLES
Webcasts
Intel Seminar: Efficiencies in Hardware/Software Virtualization
HP Webcast: Disaster Recovery Planning
Go Parallel Video: Performance and Threading Tools for Game Developers
HP Video: StorageWorks EVA4400 and Oracle
HP Webcast: Storage Is Changing Fast - Be Ready or Be Left Behind
MORE WEBCASTS, PODCASTS, AND VIDEOS
Downloads and eKits
IBM TCO eKIT: Your IT Budget is Under Attack, Get in Control
IBM Energy Efficiency eKIT: Learn How to Reduce Costs
30-Day Trial: SPAMfighter Exchange Module
Red Gate Download: SQL Toolbelt and free High-Performance SQL Code eBook
Iron Speed Designer Application Generator
MORE DOWNLOADS, EKITS, AND FREE TRIALS
Tutorials and Demos
Microsoft Article: Silverlight Streaming--Free Video Hosting for All
Featured Algorithm: Intel Threading Building Blocks - parallel_reduce
HP Demo: StorageWorks EVA4400
MORE TUTORIALS, DEMOS AND STEP-BY-STEP GUIDES
webref The latest from WebReference.com Browse >
The Partial Function Application in JavaScript · Creating Dynamic RSS Feeds with Ajax · Performance Optimizations for High Speed JavaScript
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Cablevision Deploys More Hotspots for Commuters · Dell Joins the Netbook Movement with its Inspiron Mini 9 · It's Official: Dell Enters the Netbook Fray


Produced by Yehuda Shiran and Tomer Shiran
All Rights Reserved. Legal Notices.
Created: November 19, 2001
Revised: November 19, 2001

URL: http://www.webreference.com/js/column97/2.html