Export (0) Print
Expand All

Walkthrough: Connecting to Data in a Web Service 

Connecting your application to data in Visual Studio is simplified by using the Data Source Configuration Wizard. After you complete the wizard, data is available in the Data Sources Window for dragging onto Windows Forms.

Tasks illustrated in this walkthrough include:

  • Creating a new Windows Application project.

  • Creating and configuring a dataset in your application based on objects returned by the Web service.

In order to complete this walkthrough, you need:

To create the new project

  1. On the File menu, create a new project.

  2. Select Windows Application and click OK. For more information, see Creating Windows-based Applications.

    The project is created and added to Solution Explorer.

The dataset is created by running the Data Source Configuration Wizard.

To create the dataset

  1. On the Data menu, click Show Data Sources.

  2. In the Data Sources window, select Add New Data Source.

  3. Click Next on the Data Source Configuration Wizard welcome page.

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

  5. Type http://api.google.com/GoogleSearch.wsdl in the URL box of the Add Web Reference dialog box.

  6. Click Go.

  7. After the Web service is found, click Add Reference to add a reference to your project. For more information, see Add Web Reference Dialog Box.

  8. Click Finish.

  9. The Web reference is added to Solution Explorer.

The dataset you just created is now available in the Data Sources window.

NoteNote

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 will 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.

To add functionality to your application

  • Select items in the Data Sources window and drag them onto a form. For more information, see Displaying Data Overview.

Community Additions

ADD
Show:
© 2014 Microsoft