How to: Generate a Web Service Proxy
Windows Communication Foundation Services and ADO.NET Data Services
To access a Web service from a client application, you first add a Web reference, which is a reference to a Web service. When you create a Web reference, Visual Studio creates a Web service proxy class automatically and adds it to your project. This proxy class exposes the methods of the Web service and handles the marshalling of appropriate arguments back and forth between the Web service and your application. Visual Studio uses the Web Services Description Language (WSDL) to create the proxy. For more information, see XML Web Services Infrastructure.
You can use the Web Reference URL property to specify the URL to the Web service. The Add Web Reference sets this property by default to the URL of the Web service you select, which is a static URL. A Web reference can use either a static URL or a dynamic URL. If you set the URL Behavior property of the Web reference to dynamic, the application obtains the URL at run time from the appSettings Element (General Settings Schema) section of your application's configuration file. For more information, see Web References in Visual Studio.
After adding a Web reference to a client application, you can invoke the exposed methods of that Web service and access the results just as you would any other method of a component. For more information, see How to: Call a Web Service.
If you are unable to add a Web reference, such as when the Web service is not accessible from the machine on which you are using Visual Studio, you can use the Web Services Description Language Tool (Wsdl.exe) to generate a Web service client proxy class. For more information, see Creating an XML Web Service Proxy.
To Generate a Web Service Proxy Class
- Add a web reference to your project. For more information, see How to: Add and Remove Web References. A proxy class is automatically generated and added to your solution which can then be instantiated like any other class.
See Also
Tasks
Concepts
Web References in Visual Studio
Other Resources
Accessing Web Services in Managed Code