Building XML Web Service Clients
Using an XML Web service encompasses the communication of XML Web service methods over a network using industry standard protocols. However, before an application can begin communicating with XML Web service methods, there are four basic steps it must accomplish:
- Determine if an XML Web service exists. You can look in a directory, such as http://uddi.microsoft.com, for the vendors providing XML Web services with specific functionalities. The directory will have a URL to the vendor's Web site.
- Discover an XML Web service. Given a URL to a vendor, XML Web service discovery is invoked to get the specific details about each XML Web service available at that URL. Information about each XML Web service is returned to the client in the form of a service description, which is an XML document describing the XML Web service in the Web Services Description Language (WSDL). The service description concretely details how to communicate with an XML Web service. For information on XML Web service discovery, see Discovering XML Web Services.
- Given a service description, generate a proxy class, which can communicate with XML 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 XML 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 XML Web service methods over the Internet, using industry standard protocols. For more information, see Creating Clients for XML Web Services.
After discovering that an XML Web service exists using XML Web service discovery, you can view information about the XML Web service and the XML 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 Exploring Existing XML Web Services Created Using ASP.NET.
XML Web services can be used by a variety of client applications. You can communicate with an XML Web service from any Web application, including another XML Web service. The client of an XML Web service is not necessarily a client-based application; in reality, most clients are server-based applications, such as Web Forms and other XML Web services.
Two XML Web service clients
As shown in the previous graphic, there are two XML Web service clients: an ASP.NET Web Form and an XML Web service. The ASP.NET Web Form, which the user sees, communicates with the
GetCurrentPrices XML Web service. The
GetCurrentPrices XML Web service then acts as an XML Web service client by communicating with the
StockServices XML Web service to obtain the stock quote. The stock quote is then returned to the
GetCurrentPrices XML Web service, which subsequently passes it back to the ASP.NET Web Form.
Discovering XML Web Services | Creating an XML Web Service Proxy | Creating Clients for XML Web Services | Exploring Existing XML Web Services Created Using ASP.NET | Communicating with XML Web Services Asynchronously | Accessing XML Web Services from a Browser