Read any book, paper, or magazine article about Microsoft .NET and you鈥檒l encounter one term over and over: 鈥淴ML Web services.鈥?XML Web services, or simply 鈥淲eb services鈥?as they are more often called, are the cornerstone of the Microsoft .NET initiative. They鈥檙e the key to Microsoft鈥檚 vision of a world in which computers talk to each other over the Web using HTTP and other universally supported protocols. And they鈥檙e the number one reason that the Microsoft .NET Framework exists in the first place鈥攖o make it as easy as humanly possible to build Web services and Web service clients.
A Web service is a different kind of Web application. It doesn鈥檛 have a user interface as does a traditional Web application. Instead, it exposes callable API functions, better known as Web methods, over the Internet. It鈥檚 not designed to serve end users as traditional Web applications are. It鈥檚 designed to provide services to other applications, be they Web applications, GUI applications, or even command-line applications. What kinds of services do Web services provide? That鈥檚 up to the implementer. A Web service could provide real-time stock quotes to interested parties. It could validate credit cards or provide current information about the weather. Like traditional applications, Web services are as diverse as their creators鈥?imaginations. Microsoft, Sun, IBM, and others foresee a world in which all sorts of interesting information is made available via Web services. To the extent that developers embrace that vision, Web services will one day be the backbone of a highly programmable Internet鈥攁n Internet that doesn鈥檛 just serve end users, but one that allows servers to communicate with each other and applications to be freed from the bonds of the platforms on which they run.
An application that speaks the language of Web services has access to a universe of services that is just now emerging. Already, companies all over the world are exposing content and business logic through Web services. As one of this chapter鈥檚 sample programs demonstrates, it鈥檚 easy to build a Web service client that takes city and state names as input and fetches satellite images of said cities, thanks to Microsoft TerraService, which is a front end to a massive database of satellite images, aerial photographs, and topo maps of much of Earth鈥檚 surface and is freely available to anyone who wants to use it. In the future, you鈥檒l see applications that use Web services to check the status of overnight packages or display the soup of the day at your favorite restaurant. Web services have the potential to change the world as few technologies ever have. And Microsoft .NET will play a huge role in that change, primarily because the .NET Framework makes writing Web services and Web service clients so incredibly easy.
Web services are not the property of Microsoft. They鈥檙e an industry standard built on open protocols such as HTTP and the Simple Object Access Protocol (SOAP). Many of the Web services in operation today run on UNIX servers. You don鈥檛 need the .NET Framework to write Web services or Web service clients, but you want the framework because it makes writing Web services and Web service clients easy. A few button clicks in Visual Studio .NET creates a Web service and exposes Web methods to anyone that you provide a URL to. Creating a Web service client requires equally little effort. You don鈥檛 even have to use Visual Studio .NET. You can write powerful Web services with Notepad, which is precisely what we鈥檒l do in this chapter to introduce the brave new world of Web services and applications that use them.