Building XML Web Service Clients
This topic is specific to a legacy technology. XML Web services and XML Web service clients should now be created using Windows Communication Foundation.
Using a Web service encompasses the communication of Web service methods over a network using industry standard protocols. However, before an application can begin communicating with Web service methods, there are four basic steps it must accomplish:
Determine if a Web service exists. You can look in a directory, such as UDDI Services, for the vendors that provide Web services with specific functionalities. The directory has a URL to the vendor's Web site.
Discover a Web service. Given a URL to a vendor, Web service discovery is invoked to get the specific details about each Web service that is available at that URL. Information about each Web service is returned to the client in the form of a service description, which is an XML document that describes the Web service in the Web Services Description Language (WSDL). The service description concretely details how to communicate with a Web service. For information about Web service discovery, see Web Service Discovery.
Given a service description, generate a proxy class, which can communicate with Web service methods based on the precise definition in the service description. For instructions, see Creating an XML Web Service Proxy.
Because the proxy class communicates with the Web service across the Internet, it is a good idea to verify that the Url property of the proxy class references a trusted destination.
Create a client application, which invokes methods of the proxy class. The methods of the proxy class can communicate with the Web service methods over the Internet, using industry standard protocols. For more information, see Creating Clients for XML Web Services.
After discovering that a Web service exists using Web service discovery, you can view information about the Web service and the Web service methods it implements in a more user-friendly format than the service description. To do so, access the service help page described in How to: Explore Existing XML Web Services Created Using ASP.NET.
Web services can be used by a variety of client applications. You can communicate with a Web service from any Web application, including another Web service. The client of a Web service is not necessarily a client-based application; in reality, most clients are server-based applications, such as Web Forms and other Web services.
As shown in the previous graphic, there are two Web service clients: an ASP.NET Web Form and a Web service. The ASP.NET Web Form, which the user sees, communicates with the
GetCurrentPrices Web service. The
GetCurrentPrices Web service then acts as a Web service client by communicating with the
StockServices Web service to obtain the stock quote. The stock quote is then returned to the
GetCurrentPrices Web service, which subsequently passes it back to the ASP.NET Web Form.