Web Services Overview

What would you use a Web Service for? Well, that is a fair enough question. Web Services are used to program the Web. Web Services represent a way to abstract a Universal Resource Identifier (URI) and access it across the Web on another server. If this doesn't seem clear, keep reading, and you will understand it as I explain and talk about Web Services.

The Simple Object Application Protocol (SOAP) is what Web Services use to communicate across the Internet. This protocol is described in more detail in the section entitled "SOAP."

Why Are Web Services Useful?

Imagine you have some sort of an e-commerce Web site, and you have a partner that provides you with content. Or you might provide your partner with some sort of content, or you have some other interaction. Web Services give you an easy way to integrate with partners. I will give some examples of this shortly.

Web Services are very easy to program. They are also based on standards. The fundamental protocol on which they are based is HTTP; all the SOAP information uses this protocol as its basis. Then, the data is contained within a SOAP envelope, which is also a standard that has been submitted to the W3C (World Wide Web Consortium). Within the SOAP envelope is XML, and XML is the standard that is becoming very popular and widely adopted for Internet data representation.

Another reason you would want to implement Web Services is they can be easily upgraded on one server without affecting the applications that call them. If server A contains a Web Service, I can easily change it as long as I don't change the calling and return parameters. And I can do this without any knowledge of or effect on server B, which calls methods in my Web Service on server A.

Real-World Scenarios for Using Web Services

I would like to talk for a minute about when you would use a Web Service. Although I can think of many examples, I'll cover just a few here. I'm sure that with a little effort you can come up with your own.

Suppose I have a Web site on which I want to serve up news content to users. The news content comes from a server located somewhere else on the Internet. A Web Service provides the easiest programming model for a Web application to retrieve and consume content from across the Web.

Although I have carried out tasks before that pull in data and content from other Web servers, doing so hasn't always been easy. It has taken me several days to do this, and then several more days to debug the material I received; and making changes was sometimes difficult. In the end, this process might have taken me anywhere from four to five days of programming. With a Web Service, I can consume content from a remote server in about two hours. That's because WSDL describes the data format such that the Web service automates the parsing.

Credit-card authorization of course comes to mind. A Web Service makes the ideal method of doing credit-card authorization. From one server you can easily hit another server and authorize a credit card with just several lines of programming code.

Centralization of user information is another option that Web Services provide. You might have a user who has a set of information that is associated with that user. A Web Service can enable multiple Web Services to retrieve and use information about a given user. Of course this assumes that there is proper security clearance and the proper authorization credentials, which should have been created on the Web server.

Web Services enable you to create a killer ad server (MSDN has an example of this as part of the ColdStorage sample). Imagine being able to provide user information, such as a user's preferences, and an ad server serves up a targeted ad toward that particular user. Say, for instance, that I am on a Web site and somehow I have let it be known that I like golf. As a matter of fact, I may have indicated on the Web site that I am looking for a new set of clubs. Rather than just rotate through a bunch of ads, I can call a Web Service and let the Web Service know that I like or have an interest in golf, and the Web Service serves up a targeted ad with golf clubs or golf accessories.

ASP. NET Solutions - 24 Case Studies. Best Practices for Developers
ASP. NET Solutions - 24 Case Studies. Best Practices for Developers
ISBN: 321159659
Year: 2003
Pages: 175

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net