Because network overhead makes a web service execute much slower than a standard function, many operations are not well suited for implementation as a web service. Using a web service to add two numbers, for example, or to calculate a random number, would introduce unnecessary overhead to a program. Such operations are better suited for implementation using standard functions.
Web services, in contrast, are ideal for operations that use data residing at a remote source (most often within a database on a specific server). For example, web services are well suited for the following operations:
Responding to queries for stock quotes
Returning information regarding the availability of specific inventory items
Providing real-time information, such as weather and road conditions
Offering airline flight arrival and departure information
Implementing e-commerce operations, such as ticket sales for movies and special events
Authenticating users or credit-card information
You may be saying to yourself that users already perform such operations on many sites across the Web. Web services provide programmers with a way to integrate these operations into their programs. By using web services to implement common user operations (such as downloading stock quotes, ordering a book, and checking the weather) within your company’s website, you can keep users from leaving your website to perform these operations elsewhere. By taking advantage of web services, you can integrate powerful processing developed by other programmers into your applications and web pages.
To help you better understand how web services extend the functionality of the Web into your applications, the remainder of this chapter will let you test drive readily available web services.
The examples this chapter presents make use of web services existing on the Web at the time of this writing. Over time, the services this chapter presents may change or become unavailable. This book’s companion website, which you can find by following the links at www.sybex.com, will provide updates to the chapter code as the services change.
From the companion website, you can download the source code for all of the programs and services this book presents. You will find links to other key web development sites too.