Web services provide a way to run a service on the Web and access its methods using standard protocols, including Simple Object Access Protocol (SOAP), Extensible Markup Language (XML), Web Service Description Language (WSDL), and Hypertext Transfer Protocol (HTTP). Technically, a Web service is nothing more than an application that exposes its interface over the Web to a client who wants to access the service's abilities. The uses of a Web service include validating credit cards, searching for data in a database, inserting an order into a shopping cart, and updating a guest list. The sky is the limit on what you can have your Web service do on your server.
In the past, JavaBeans, Component Object Model (COM) components, and other, nonstandard service components handled these services, which required specialized formats and/or extra specialist components to exchange data with the client. But Web services under .NET run by invoking methods in the service directly through HTTP or SOAP, so someone wanting to run your Web service from their computer can simply send a HTTP call to your service, passing the parameters in a standard Uniform Resource Locator (URL). You'll see how to do this later in the chapter.
Three components make up a Web service:
Discovery: First, you need to locate the Web service. You locate Web services through the Discovery Service Protocol. The discoverable information for a .NET Web service is stored in XML in a .disco file. This file contains references to all the Web services under your Web site's virtual directory. Visual Studio (VS) can automatically generate this file for you.
Description: Once you've discovered your service, you need a way to tell the client what methods, classes, and so on the Web service has and what wiring protocol (SOAP, HTTP, and so on) the services are using. You do this through WSDL, an XML format. VS provides a tool for generating WSDL files automatically from your services.
Wiring protocol: Web services under .NET use two main protocols: HTTP-post/HTTP-get and SOAP. HTTP-post and HTTP-get enable you to send and receive information via a URL by passing and receiving namevalue pair strings. Unfortunately, HTTP can only pass strings that represent different data types. SOAP allows you to pass a richer type of information, such as DataSets. You can find more details and SOAP specifications at www.w3.org/TR/SOAP/.