Creating Clients for XML Web Services
A Web service client is any component or application that communicates with a Web service using SOAP messages, or a comparable messaging protocol. A Web service client can be a traditional client application. A client can also be another Web application. (In this situation, the Web application would consume the XML within the SOAP message, format it, and send the result back to an ultimate client — perhaps a Web browser.)
Create a Web service client by following these basic steps:
Create a proxy class for the Web service.
Reference the proxy class in the client code.
Create an instance of the proxy class in the client code.
If anonymous access has been disabled for the Web application hosting the Web service, set the Credentials property of the proxy class.
Call the method on the proxy class that corresponds to the Web service method with which you want to communicate.
For most clients, these steps differ only in how the proxy class is referenced and how the Web service client is deployed.
If you create a Web service client using the following topics and your proxy fails with the exception text, |
"The request failed with HTTP status 401: Access Denied," there is a good chance that you have not yet passed your security credentials to the credential cache on the proxy. For details on passing the correct credential information to the service, see How to: Configure an XML Web Service for Windows Authentication.
In This Section
- How to: Create an ASP.NET Web Form Client
- Shows how to create a Web Forms application that is a client to a Web service.
- How to: Create a Console Application Client
- Shows how to create a console application that is a client to a Web service.
Build Date: 2011-02-07