Connectors

SOAP Web Services

To connect with SOAP Web Services we suggest using the Empty Data Source provider with custom .NET C# code in project automation to load the data from your SOAP service. This method provides access to most SOAP services since each one is different this allows you to control how to call the service.

You will need to create a .NET WebService Proxy class via the Microsoft WSDL.exe tool.

WSDL Tool is installed with Visual Studio or .NET SDKs https://www.microsoft.com/net/targeting

This guide walks through consuming the SharePoint Webs Web Service.

SharePoint Webs Web Service

Create a Proxy.cs file from the SharePoint Webs ASMX Web Service using the wsdl.exe tool.

wsdl.exe /out:Proxy.cs http://<sharepoint_site_url>/_vti_bin/webs.asmx?WSDL

In this guide we are going to call the GetWebCollection() API.

SharePoint Webs GetWebCollection API

Empty Data Source

Create a new Data Sync project and connect to the Empty DataSource provider.

Columns

Add the columns (Title, Url) we need to return to define the data schema.

Webs Data Source Column 1 Webs Data Source Column 2

System.Web.Services Assembly

The WSDL proxy class references an assembly not included in Data Sync so Add the System.Web.Services.dll assembly under File->Properties->Assembiles

Add the Web Services .NET Assembly

Project Automation

Using project automation we will fill the Data Source Table at runtime from the web service by calling the service and enumerating the results.

Web Service Proxy

Include the Proxy.cs code we generated with the WSDL tool into the project automation class. To do this add the following snippet to the end of the automation code file, since we do not need to refer to it.

Insert the code from Proxy.cs between the namespace and add to the end of the project automation code file.

#region WebServiceProxy
namespace WebService 
{
    // INSERT WSDL Proxy Class Code from Proxy.cs here 
}
#endregion WebServiceProxy

Call Web Service

Implement the code to call the web service and fill the Data Table with data. The code below is an example of calling the SharePoint Webs web service and calling the GetWebCollection() API.

If your intellisense is not working, try adding a Target Data Source Tools->Create Null/Empty Data source saving the project and reopening the project.

Since the SharePoint Web Service returns a System.Xml.XmlNode object we need to add a using to the class for System.Xml to the top of the document so we can work with the XmlDocument API.

using System.Xml;

Replace the Start() method and add the GetDataTableSource(DataTableStoreCallbackInfo) method with the code below.

    public override void Start()
    {		
        // Set callback function implmentation.
        DataSourceA.GetDataTableCallback = GetDataTableSource;            
    }    

    public DataTableStore GetDataTableSource(DataTableStoreCallbackInfo info)
    {            
        // Convert Datasource Properties to a Dictionary.
        var prop = DataSourceA.Properties.ToDictionary(k => k.Name);

        // Create an instance of the Web Service
        WebService.Webs service = new WebService.Webs();
        // Set the URL from the DataSource Properties
        service.Url = prop["url"].Value;
        service.UseDefaultCredentials = true;	
		
        // Get a response from the SOAP Service
        XmlNode webs = service.GetWebCollection();
		
        // Add an Namespace to the Namespace Manager
        XmlNamespaceManager nsmgr = new XmlNamespaceManager(webs.OwnerDocument.NameTable);
        nsmgr.AddNamespace("ns1", "http://schemas.microsoft.com/sharepoint/soap/");
        
        //Enumerate the Web nodes
        foreach(XmlNode item in webs.SelectNodes("//ns1:Web", nsmgr))
        {            
            // Add the columns to the Data Row
            info.Store.Rows.Add(info, 
                (o, columnName) => 
                {
                    // Get the requested column from the node attributes
                    var value = item.Attributes[columnName];

                    //Return the value.
                    return value != null ? value.Value : null;                
                });
        }

        return info.Store;
    }

Download SharePoint SOAP Project