Web Services, Part II: Calling Service Methods - Doc JavaScript | WebReference

Web Services, Part II: Calling Service Methods - Doc JavaScript


Web Services, Part II: Calling Service Methods

In this column we continue our series on Web services. In Part I, we introduced you to this hot topic. We explained some nomenclature related to Web services, the motivation behind them, their benefits, and tips on how to find them on the Internet. In this column, we focus on how to call Web services. We'll show you first the preparations you need to do. We'll teach you which behaviors you need to attach, and how to load the Web services you are interested in. The communication with Web services is via messages. We'll show you how to assemble messages, how to send them to the Web service, and how to analyze the returned message. We'll elaborate on the error analysis and reporting, as well as on how to print the results coming from the Web service.

You can call a Web service in two fashions. You can send it a message and then, asynchronously, wait for a response. When a response arrives, you need to verify that it corresponds to your original message. We'll teach you how to check it. The other way to call a Web service is synchronously. You don't do anyting else until you get a response from the Web service. The advantage is that you don't need to check the matching between the outgoing and the inbound messages. You are sure to get the response for your particular message.

In this column you will learn:

To try calling Web services by yourself, you must do it from your own computer. You need to download two files: example.html and webservice.htc. Put them in the same directory, and load example.html in your Internet Explorer. Both files can be loaded from the enclosed zipped file. You can see the full code listing of example.html on Page 8.

Next: How to attach the WebService behavior

http://www.internet.com


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/index.html