Add a web service to a Visual Studio 2010 project

Visual Studio 2010 provides a sophisticated ability to include web services in projects. Let's take a closer look at this popular programming IDE.

First, create a new project:

NEWPROJECTWINDOWS-low.gif

After the project is created, you add a service reference to the project.

ADDSERVICEREFERENCE-low.gif

When the Add Service Reference dialog appears, enter the URL of the SRF file that is the endpoint of the service.

ADDSERVICEREFERENCEWINDOW-low.gif

The WSDL will be fetched, at which time the information about the web service is added to the dialog:

ADDSERVICEREFERENCEADDRESS-low.gif

The methods available in the service are listed in the 'Operations:' column. Click OK to complete adding the service to the project. Proxy functions are created for the operations (methods) and the service appears in the Solution Explorer.

SOLUTIONEXPLORE-low.gif

The generated proxy functions allow you to use the web service's methods in a manner identical to any other function.