How to: Connect to Data in a Web Service

You connect your application to the data returned from a Web service by running the Data Source Configuration Wizard and selecting Web Service on the Choose a Data Source Type page.

Upon completion of the wizard, a Web reference is added to your project and is immediately available in the Data Sources Window.

Note

The items that appear in the Data Sources window are dependent on the information that the Web service returns. Some Web services might not provide enough information for the Data Source Configuration Wizard to create bindable objects. For example, if the Web service returns an untyped dataset, then no items appear in the Data Sources Window upon completing the wizard. This is because untyped datasets do not provide schema, so the wizard does not have enough information to create the data source.

Note

Your computer might show different names or locations for some of the Visual Studio user interface elements in the following instructions. The Visual Studio edition that you have and the settings that you use determine these elements. For more information, see Visual Studio Settings.

To connect your application to a Web service

  1. On the Data menu, click Add New Data Source.

  2. Select Web Service on the Choose a Data Source Type page.

  3. Enter the URL to the Web service you want to use, and then click Go.

  4. Click Add Reference to include a reference to the Web service in your project.

  5. Click Finish.

    The data source is added to the Data Sources window.

Next Steps

To add functionality to your application

  • Select an item in the Data Sources window and drag it onto a form to create bound controls. For more information, see Displaying Data Overview.

See Also

Tasks

Walkthrough: Accessing a Web Service Using Visual Basic or Visual C#

Walkthrough: Displaying Data on a Form in a Windows Application

How to: Connect to Data in a Database

How to: Connect to Data in an Object

How to: Connect to Data in an Access Database

How to: Connect to Data in a SQL Server Express Database

Concepts

Displaying Data Overview

TableAdapter Overview

Dataset Designer

Other Resources

Accessing Web Services in Managed Code