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

[This documentation is preliminary and is subject to change.]

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

SharePoint Foundation Query Web Service

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