This documentation is archived and is not being maintained.

Generating an XML Web Service Proxy

To access an XML Web service from a client application, you first add a Web reference, which is a reference to an XML Web service. When you create a Web reference, Visual Studio creates an XML Web service proxy class automatically and adds it to your project. This proxy class exposes the methods of the XML Web service and handles the marshalling of appropriate arguments back and forth between the XML 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 XML Web service. The Add Web Reference sets this property by default to the URL of the XML 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 section of your application's configuration file. For more information, see Managing Project Web References.

After adding a Web reference to a client application, you can invoke the exposed methods of that XML Web service and access the results just as you would any other method of a component. For more information, see Web References.

If you are unable to add a Web reference, such as when the XML Web service is not accessible from the machine on which you are using Visual Studio, you can use the XML Web Services Description Language Tool (Wsdl.exe) to generate an XML Web service client proxy class. For more information, see Creating an XML Web Service Proxy.

See Also

Accessing XML Web Services in Managed Code | Web References | Managing Project Web References | Creating an XML Web Service Proxy | Web Services Description Language Tool (Wsdl.exe)