spacer
Yehuda Shiran April 6, 2002
Partitioning your Multiple Web Service Code
Tips: April 2002

Yehuda Shiran, Ph.D.
Doc JavaScript

Developer News
News Flash: Adobe Has iPhone Workaround
Adobe's Flash 10.1 Goes Mobile (Minus iPhone)
A Salute to Visionary CEOs

You need to have three JavaScript functions for each Web service you consume:

  • The init() function assigns a short name to the Web service URL
  • A function to call the Web service with the appropriate parameters
  • A function to display the results

The init() function can be shared among Web services. It is invoked upon loading of the page, onload=init(). We call the behavior's useService() method to assign short identifiers to the Web service's rather-long URL. We call the Add Web service by simpleCalcWebService and the isPrime Web service by isPrimeNumberWebService:

function init() {
  myWebService.useService("
    http://www.dev1.eraserver.net/D2S/WebServiceSample/isPrime.asmx?WSDL",
    "isPrimeNumberWebService");
  myWebService.useService("http://63.210.240.215/d2s/20011205/add.asmx?WSDL",  
    "simpleCalcWebService");
}
These Web service examples work properly in Internet Explorer 5.5 or later browsers. If you are using Internet Explorer 5.5+ and receiving errors with the examples, you need to enable the access data sources across domains option. See Column 105 for details.

To learn more on consuming multiple Web services, go to Column 106, Web services Part XI: Consuming Multiple Web Services.


People who read this tip also read these tips:

Look for similar tips by subject:

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
Building a Banking Application Home Page with OOP · Mixing Scripting Languages · Review: phpFox, a Social Networking CMS with all the Bells and Whistles
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Enterprise 2.0: Social Networking in the Cloud · BroadSoft Marketplace Hastens Pace of Telephony Innovation · Review: HTC Hero for Sprint