How to: Create a Proxy Class to Communicate with a Web Service
When a client project is Web Services Enhancements for Microsoft .NET (WSE)-enabled, proxy classes that are generated for the client project are WSE-enabled.
To create a WSE-enabled proxy class
Open the client project in Visual Studio 2005.
Run the WSE Settings 3.0 Tool.
- In Solution Explorer, right-click the project name, and then click WSE Settings 3.0….
- Select Enable this project for Web Services Enhancements.
- Click OK to dismiss the dialog.
This enables future proxy classes that are generated for this project inside of Visual Studio 2005 to be WSE-enabled.
In Solution Explorer, right-click the name of the project to add the Web service to and then click Add Web Reference.
The Add Web Reference dialog box opens.
In the URL box, enter the URL of the Web service to use. If you do not know the URL, use the links in the browse pane to locate the Web service you want.
In the Web services found at this URL box, select the Web service to use.
In the Web reference name field, enter a name that you will use in your code to access the selected Web service programmatically.
Click Add Reference.
A WSE-enabled proxy class is added to the project.
The WSE-enabled proxy class is not thread-safe. When the proxy class is used to make multiple asynchronous calls to a Web service method, each call must be completed using the EndXX method before another call may be made.