How to: Create a Web Service Proxy Class for the Enterprise Search Query Web Service in Visual Studio 2005

To access the web methods of the Query web service from your Microsoft .NET Framework client application, you must create a proxy class for the web service.

Note

Client application in this context refers to an application that makes a call to the web service, so this could be a separate Microsoft ASP.NET web application, a Microsoft Windows Form application, and the like.

This topic describes how you can create the proxy class for the web service from within the Microsoft Visual Studio 2005 environment.

Creating the Proxy Class

To create the proxy class for the Query web service from your project in Visual Studio 2005

  1. In the Solution Explorer, right-click the name of your project, and select Add Web Reference from the pop-up menu.

    Note

    You can also select Add Web Reference from the Project menu.

  2. In the Add Web Reference dialog box, type the following address in the URL text field:

    http://<SERVER>/_vti_bin/search.asmx
    

    and then click Go.

    When the URL has been located, you will see the QueryService web service in the main window of the dialog box.

  3. In the Web Reference name text field, change the name of the web reference. (Optional)

  4. Click Add Reference.

    You should now see the web reference for the Query web service in the Solution Explorer in the Web References folder.

Calling the Web Service

To access the web service from your code

  • Create an instance of the proxy class for the web service, using the following code:

    <ProjectNamespace>.<WebReferenceName>.QueryService queryService = new <ProjectNamespace>.<WebReferenceName>.QueryService();
    

See Also

Concepts

Enterprise Search Query Object Model Overview
Enterprise Search Query Web Service Overview