April 6, 2002 - Partitioning your Multiple Web Service Code | WebReference

April 6, 2002 - Partitioning your Multiple Web Service Code

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

Yehuda Shiran, Ph.D.
Doc JavaScript

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

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("
        https://www.dev1.eraserver.net/D2S/WebServiceSample/isPrime.asmx?WSDL",
        "isPrimeNumberWebService");
      myWebService.useService("https://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.