XML Web Services Examples

XML Web services operate on the same principle as Web page requests. The client sends a request for a Web page or service to the hosting server, and that server returns your page or results to you. Just as with Web pages, interaction between clients and XML Web services is connectionless and stateless. If you are thinking about developing a XML Web service that will need to remember something about its users, you will have to include some sort of storage or caching scheme in your plans. Table 8.2 lists some examples of likely XML Web services you will encounter.

Table 8.2: H nipls

Service

Description

Weather

Provide this XML Web service with your zip code, and in return you will get a paragraph describing your local forecast.

Table 8.2: 1! ni|ls

Service

Description

Stock Prices

Send this XML Web service the name of a company and it will return that company's current stock value.

TV Programming

Give this service a time and a channel and receive a description of the television show airing at that time.

Online Payments

Provide this service with a username, password, dollar amount, and payee identification and this service could transfer funds from your online account to an online merchant.

File Storage

Accepts files as inputs for storage in a user's personalized file system. This same service can also field requests for documents the user has in storage.

Sales Tax

Provide a dollar amount and a state name, and this service can calculate and return the local sales tax.

When looking at the examples in Table 8.2, you will see that there are many possible combinations for XML Web service inputs and outputs. In some cases, you can provide little or no data and still get back some usable information. For more personalized services, such as the online payment system or personal file storage, some means of securely identifying and authenticating a user is required to protect highly sensitive personal information. In all these examples, the client is asking to be provided some sort of service, whether it be providing information or storing a file.

In Figure 8.4, I have illustrated a fictional user's interaction with an online store. Many different XML Web services come in to play during this interaction. This fictional online store makes a call to an externally hosted XML Web service to calculate the shipping cost of the requested item. Next the online store contacts an XML Web service hosted at one of its suppliers to check on the desired product's availability status. Determining that this product is in stock, the online store uses the supplier's XML Web service to place the order for the product. The online store then contacts yet another XML Web service hosted by a different company to arrange the transfer of funds from the user's account to the store's account.

.NET My Services

You can accuse Microsoft of being a little slow to embrace the Internet in the beginning, but once it realized what a profound effect the Internet would have on computers and applications, Microsoft made developing for the Internet its number-one priority. With XML Web services, Microsoft has put the pedal to the metal in the race to become the world's leading XML Web services provider with a project called .NET My Services (originally codenamed Hailstorm). .NET My Services hopes to be the central point of user services for the Internet. Using Microsoft's Passport user authentication and identification technology, .NET My Services will provide user-specific data such as email inboxes, calendars, online wallets, and more.

Imagine this scenario: You log on to your favorite online bookstore, and because both you and the bookseller are hooked into .NET My Services, you are immediately provided a tailored list of products you might be interested in. With a single click, you can complete a book order because the bookseller already has access to your address and online wallet. Of course, making shopping this easy and fast makes many users queasy, but this is only one possible future. For a less threatening example, picture logging in to a public kiosk at the mall to use the Internet, and you realize that your personalized favorite Web site list and favorite interface color scheme is automatically available on this machine. All this and more will be made possible through XML Web services.

Web-Enabled Devices

XML Web services will play a crucial role in the development of mobile and Web-enabled devices. If you look at a handheld digital phone, you can see that there is not a lot of room in that case for bulky hardware, such as RAM and hard drives. In order to make small devices useful and feature rich, developers must offload as much processing power as possible to servers housed on the Internet. XML Web services are the ideal way to provide this functionality because they communicate using open source protocols, which allow any developer working with any device to access them. Look around and I'll bet you can spot a couple of devices that could potentially be Web-enabled, for example:

■ Alarm clocks that regularly compare their time to an accurate Web-based source

■ TV sets that download television programming guides for on-screen viewing

■ Microwave ovens that can download a requested recipe

I would not be surprised if there are developers currently developing software for washing machines and toasters. Personally, I can't wait for the day when I can check email and listen to streaming media in the shower.

0 0

Post a comment