Manipulating the header for a web service

Applies from v9.1.18
Requires technical knowledge (writing code, writing provider) Infiniti doesn’t support custom headers for web services out of the box. If you have a web service that does have a custom header, you will have to create a Custom Datasource Provider.
Most of the details for a Custom Datasource Provider can be found here: 
In the case of simply wanting to change the header for a web service, your custom datasource provider can inherit from the build-in WebserviceDatasourceProvider. You can then override the BuildSoapHeader function, this is what forms the header of the web service call.
protected override string BuildSoapHeader(string connectionString, string query, Intelledox.Model.DataFilter criteria, bool windowsAuthentication)
                return "<soap:Header>" + "<wsse:Security xmlns:wsse=\"\"><key>12345</key>" + ((Intelledox.MembershipSecurity.ISamlMembershipProvider)System.Web.Security.Membership.Provider).Token + "</wsse:Security>" + "</soap:Header>";
Note: the “12345”. This normally wouldn’t be included in a header like this, but here we’ve been able to add it.

Passing Infiniti Filter Fields to custom Web service Data Provider

In the example above we’ve added a “key” of “12345”. Parameters like this may not always be static, often you’ll want and Infiniti project designer to be able to pass the value of this field into the datasource. 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 datasource.
        public override List AdditionalKeyFields(string connectionString, Guid objectType, Intelledox.Model.DataFilter criteria)
            List result = new List();
            result.Add(new XmlField("key", "string", false, false));
            return result;
“Key” will now be a filter field available on your datasource in Infiniti Design.
The value of this filter can now be discovered and used in the BuildSoapHeader function. It will be contained within the criteria parameter, which is an object of type DataFilter.

Related Articles