Creating Clients for XML Web Services

This topic is specific to a legacy technology. XML Web services and XML Web service clients should now be created using Windows Communication Foundation.

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:

  1. Create a proxy class for the Web service.

  2. Reference the proxy class in the client code.

  3. Create an instance of the proxy class in the client code.

  4. If anonymous access has been disabled for the Web application hosting the Web service, set the Credentials property of the proxy class.

  5. 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

  • Building XML Web Service Clients
    Details how to build a client to an XML Web service, regardless of the platform or technology used to build the XML Web service.

Build Date: 2011-02-07