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.
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
In the Solution Explorer, right-click the name of your project, and select Add Web Reference from the pop-up menu.
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:
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.
In the Web Reference name text field, change the name of the web reference. (Optional)
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();