HomeGuidesRecipesAPI
HomeGuidesAPILog In

Web Service (SOAP)

Intelledox Infiniti supports Web Services that are writen under Simple Object Access Protocol, allowing to query external applications in real time.

Key Concepts

Simple Object Access Protocol (SOAP) defines a standard communication protocol specification for XML-based message exchange. The standard protocol HTTP makes it easier for SOAP model to tunnel across firewalls and proxies without any modifications to the SOAP protocol and has been extensively used.

Configuration

The configuration of SOAP Web Services is very straightforward as the only WSDL is to be specified in Connection String, either pointing to a URL or a local Path.

For this example, we will use a free currency converter available online.

http://www.webservicex.com/CurrencyConvertor.asmx?wsdl

Credentials have to be specified using one of this options:

  • User Name and Password.
  • Windows Authentication.
  • Access Token.
  • No Credentials required.

For this particular example, there's no need to specify credentials.

After saving Web Service Data Source in Manage, click on "Data Objects" button. This will bring a new window with all available Data Objects for this particular Data Source.

  1. Click on **"New Data Object". Provide following information:

    Object Type: Method
    Data Object Name / Definition: ConversionRate
    Display Name: Conversion Rate

  2. Add all filter fields clicking on "Add All >>" button.

  3. Click "Save" button.

You should be able to pull live data providing FromCurrency and ToCurrency as Data Source Filter Fields in Intelledox Infiniti Design.

Adding Custom Headers

Some SOAP Web Services implement custom headers that require being handled within Intelledox Infiniti. This could be done building a custom data source provider that inherits from the built-in WebserviceDatasourceProvider and overriding two methods to add information to the header.

BuildSoapHeader(): allows to change the header, the special filter values defined in the AdditionalKeyFields function will appear here as part of the “criteria” object.

protected override string BuildSoapHeader(string connectionString, string query, Intelledox.Model.DataFilter criteria, bool windowsAuthentication)
        {
            return "<soap:Header>" + "<wsse:Security xmlns:wsse=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\"><key>12345</key>" + ((Intelledox.MembershipSecurity.ISamlMembershipProvider)System.Web.Security.Membership.Provider).Token + "</wsse:Security>" + "</soap:Header>";
        }

In the example above a “key” of “12345” was added. Parameters like this may not always be static, reason why is important to allow solution designers to be able to pass the value of this field into the data source. This can be done by returning the field in the “AdditionalKeyFields” function. This is a function on the WebserviceDatasourceProvider class that can be overwritten to add extra filters to a data source.

public override List<XmlField> AdditionalKeyFields(string connectionString, Guid objectType, Intelledox.Model.DataFilter criteria)
        {
            List<XmlField> result = new List<XmlField>();
            result.Add(new XmlField("advisor", "string", false, false));
            result.Add(new XmlField("key", "string", false, false));
            return result;
        }

Remember to import following references:

  • Infiniti.XmlHandling
  • Intelledox.Datasource
  • Intelledox.DatasourceBuiltin
  • Intelledox.InfinitiProviderBase
  • Intelledox.MembershipSecurity

Here complete code:

using Infiniti.XmlHandling;
using Intelledox.DatasourceBuiltin;
using System;
using System.Collections.Generic;

namespace CustomHeadersSOAP
{
    public class SOAP : WebserviceDatasourceProvider
    {
        public override List<XmlField> AdditionalKeyFields(string connectionString, Guid objectType, Intelledox.Model.DataFilter criteria)
        {
            List<XmlField> result = new List<XmlField>();
            result.Add(new XmlField("advisor", "string", false, false));
            result.Add(new XmlField("key", "string", false, false));
            return result;
        }

        protected override string BuildSoapHeader(string connectionString, string query, Intelledox.Model.DataFilter criteria, bool windowsAuthentication)
        {
            return "<soap:Header>" + "<wsse:Security xmlns:wsse=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\"><key>12345</key>" + ((Intelledox.MembershipSecurity.ISamlMembershipProvider)System.Web.Security.Membership.Provider).Token + "</wsse:Security>" + "</soap:Header>";
        }
    }
}