Add a SOAP service as a data source

This article shows you how to add a SOAP Web service as a data source, how to test the data source connection, and then how to display the information returned by the Web service by creating a Data View on your site.

 Important   If your site resides on a server running Microsoft SharePoint Foundation, the default settings on the server require that your server administrator first edit the Web.config file on the server before you can connect to a SOAP Web service, as described in the section Step 2: Test the data source connection . If your site resides on a server running Microsoft SharePoint Server 2010, you can connect to a SOAP Web service without making any changes on the server.

In this article


What is a Web service?

A Web service is software designed to support interoperable program-to-program interactions over a network. In the context of Microsoft SharePoint Designer 2010, a Web service is a service that returns XML data in response to remote procedure call–type queries. With SharePoint Designer 2010, you can interact with existing Web services by including an XML Web Service data source control on your Web pages. Typically you do this by configuring an XML Web Service as a data source and then by creating Data Views of that data, as shown in this article.

Web services are used in a range of application-integration and data-sharing scenarios because they provide interoperability between software components that can reside on different platforms or in different companies. A Web service performs a specific task, in which information is requested by the client computer and returned by the Web service in the form of XML. Some common examples of XML Web services are currency converters, mortgage calculators, and stock quote reports.

XML Web services are made possible by SOAP, a standards-based protocol that is used for exchanging information in XML format over a computer network. Each Web service includes a Web Service Description Language (WSDL) file that contains information about the XML Web service and its capabilities. Web service providers can register their Web services by using Universal Description Discovery and Integration (UDDI), a specification for publishing and locating information about Web services. Interested users can search the UDDI registry for Web services that they might find helpful. After a Web service is added to a Web site, the information about that Web service is displayed by using Hypertext Transfer Protocol (HTTP).

A Web service uses SOAP and WSDL to communicate with the browser

To add a Web service to the Data Source list, you must know the URL for the WSDL description of the Web service. This URL often ends in either ?WSDL or .wsdl. Once you have the URL for the WSDL description, you can add the Web service to your Data Sources list.

SharePoint Foundation 2010 provides Web services for interacting with almost any aspect of each server, site, list, library, survey, or Web page that is based on SharePoint Foundation 2010. Office SharePoint Server 2010 provides the same Web services as SharePoint Foundation 2010, plus an additional set of Web services. In the following procedures, you use the Web service named Webs. The Webs Web service provides methods for working with SharePoint sites and subsites. For example, you can use this Web service to query for and display the titles and URLs of all sites within the current site collection, the titles and URLs of all sites directly beneath the current site, or the URL of the parent site for the specified page URL.

You can find links to more information about the Web services provided by SharePoint Foundation 2010 and Office SharePoint Server 2010 in the See Also section.

Top of Page Top of Page

Step 1: Add a SOAP Web service to the Data Sources list

To help you administer and maintain your SharePoint site, you want to create a Data View that displays the names and URLs of all subsites in the current site collection. By connecting to the SOAP Web service in SharePoint Foundation 2010 and using it as a data source, you can quickly retrieve this data and create a view of it.

  1. Click Data Sources in the Navigation Pane.
  2. On the Data Connections tab, in the New group, click SOAP Service Connection.
  3. In the Data Source Properties dialog box, in the Service description location box on the Source tab, type the URL for the Web service, or click Browse to locate and select the WSDL file.

For this example, type http://your server name/_vti_bin/Webs.asmx?WSDL, where your server name is the name of your server.

  1. Click Connect Now.

After the connection is established, the Connect Now button changes to a Disconnect button, and the other options on the tab become available.

Source tab of Data Source Properties dialog box

  1. In the Select which data command to configure list, there are four options:
    • The Select command retrieves information from the Web service. You can then display the information on your site by creating a Data View.
    • The Insert, Update, and Delete commands also retrieve information from the Web service. However, you cannot create a Data View that displays or modifies information that is retrieved by using these commands. You can only use a Data View to display information that is retrieved by using the Select command.

For this example, click the Select command because you want to create a Data View of the data that is returned by the Web service.

Under Select Connection Info, you can see that the Service Name is Webs and that the Address is http://your server name/_vti_bin/Webs.asmx.

  1. In the Port list, click the application protocol that you want to use for accessing the Web service.

The options in this list are supplied by the Web service as compatible protocols, and they will change from Web service to Web service.

To follow the example, click WebsSoap.

  1. In the Operation list, click the operation that you want the Web service to do. The options in the list are defined by the Web service as operations that it can perform.

For the Web service named Webs that is used in the example, the following operations are available:

  • To return the titles and URLs of all sites within the current site collection, click GetWebCollection.
  • To return the collection of list template definitions for the current site, click GetWeb.
  • To return the properties of a site (for example, name, description, and theme), click GetListTemplates.
  • To return the titles and URLs of all sites directly beneath the current site, click GetAllSubWebCollection.
  • To return the URL of the parent site for the specified page URL, click WebURLFromPageURL.
  • To return the content types used in the current site, click GetContentTypes.

For this example, click GetWebCollection.

  1. The Parameters list displays the names of any parameters that the Web service requires or accepts. To configure the permanent or default value of any parameter, click it, and then click Modify.

Required parameters are identified with an asterisk (*). The Webs Web service does not require any parameters.

  1. Click OK.

The SOAP Web service is now listed under SOAP Services in the Data Sources list.

Top of Page Top of Page

Step 2: Test the data source connection

Now that you have created a data source connection that appears in the Data Sources list, you want to make sure that the connection is working properly. To test the data source connection:

  • On the Insert tab, in the Data Views & Forms group, click Data View and under SOAP Services, click the web service that you just created.

If the Data Source Details task pane displays data from the data source, the data source connection is working properly. You are ready to create a Data View of this data. Skip to Step 3: Create a Data View of the SOAP Web service data source.

If the Data Source Details task pane does not display data from the data source, but instead the task pane either is blank or displays an error message, the data source connection is not working properly. This issue may occur if your server is running SharePoint Foundation 2010, the server is behind a proxy server or firewall, and the proxy server settings are not specified in the Web.config file for the virtual server.

To resolve this issue, contact your server administrator and ask him or her to perform the following procedure. The server administrator must edit the Web.config file to include the proxy server settings for the virtual server where your site resides. In a server farm environment, the server administrator must edit the Web.config file for each virtual server in every front-end Web server in the server farm.

 Note   Changing the default proxy server setting enables server-to-server communication but does not in any way affect inbound connections or access permissions to your server.

Configure the Web.config file on the server

To configure the Web.config file, follow these steps on the server running SharePoint Foundation 2010:

  1. Start a text editor such as Notepad.
  2. Locate and open the Web.config file for the virtual server where you want to allow users to create connections to XML Web service and server-side script data sources.

The Web.config folder is located in the content area of your server — for example, the default path is \Inetpub\wwwroot\wss\VirtualDirectories\80.

  1. Copy and paste the following lines into the Web.config file anywhere at the level directly below the <configuration> node.
  <system.net>
    <defaultProxy>
      <proxy autoDetect="true" />
    </defaultProxy>
  </system.net>
  1. Save the Web.config file, and then exit the text editor.
  2. Reset Microsoft Internet Information Services (IIS) to apply your changes. Alternatively, you can reset after the next step to apply your changes to multiple virtual servers at one time. To reset IIS, open a command line window and type iisreset at the command prompt.
  3. Repeat steps 1 through 5 for each virtual server where you want to allow users to create connections to SOAP web services.

Top of Page Top of Page

Step 3: Create a Data View of the SOAP Web service data source

Now that you have added a Web service to your Data Sources list, you can create a Data View that displays the data retrieved from the Web service.

You can quickly create a Data View simply by dragging the data source onto a page. When you drag a data source onto a page, the result is a default view of the data, in which the first five fields in your data source appear in each row in a basic table. If the first five fields appear with the corresponding data, the data source is configured properly.

Data Views are based on Microsoft ASP.NET technology. To create a Data View, you must start with an ASP.NET page (.aspx file).

  1. Click the File tab on the ribbon, and then under Pages, click More Pages, and then click ASPX, and finally click Create.
  2. On the New ASPX page dialog box, enter a unique name for the ASPX page and optionally, choose a location to save the page.

 Note    By default, the ASPX page will be saved to the Site Pages library.

  1. Click Yes to open the page in Advanced Mode.

A new page with a FORM tag opens.

ASP.NET form tag

  1. Click the Insert tab on the ribbon, and in the Data Views & Forms group, click Show Data and then click the web service that you just created.

The Data Source Details task pane displays data from the data source.

In the Data Source Details task pane, select the fields that you want to insert, then click Insert Selected Fields as, and then select an option.

A Data View containing all titles and URLs of all sites within the current site collection is now displayed on your page.

Top of Page Top of Page

 
 
Applies to:
SharePoint Designer 2010