다음을 통해 공유


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

  1. Open the client project in Visual Studio 2005.

  2. Run the WSE Settings 3.0 Tool.

    1. In Solution Explorer, right-click the project name, and then click WSE Settings 3.0….
    2. Select Enable this project for Web Services Enhancements.
    3. 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.

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

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

  5. In the Web services found at this URL box, select the Web service to use.

  6. In the Web reference name field, enter a name that you will use in your code to access the selected Web service programmatically.

  7. Click Add Reference.

    A WSE-enabled proxy class is added to the project.

    Note

    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.

See Also

Tasks

WSE Settings 3.0 Tool