How to: Create a Web Service Proxy Class for the Windows SharePoint Services Search Web Service in Visual Studio

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

To access the Web methods of the Search 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.

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

  1. In 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.

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

    http://<site>/_vti_bin/spsearch.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.

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

  3. Click Add Reference.

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

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

Windows SharePoint Services Query Web Service

How to: Submit a Keyword Query to Windows SharePoint Services Search from a Client Application