Service Settings

Basic Authentication

The <sourceCode.services><basicAuthentication> tag contains the attributes that configure the Basic authentication used by K2 Services.

Inclusions

The <sourceCode.services><inclusions> tag contains the default settings for inclusions in data returned K2 Services.

<sourceCode.services>
    <basicAuthentication requireSSL="True" enabled="True" cachingEnabled="True" cachingDuration="15" defaultSecurityLabel="K2" />
    <inclusions userExtendedProperties="False" hiddenFields="False" maxWorklistItems="0" processDataFields="False" processXmlFields="False" activityDataFields="False" activityXmlFields="False"></inclusions>
</sourceCode.services>


Service Endpoints and Bindings

The <services><service> section contains the default configuration for the endpoints provided by K2 Services.  The default configuration provides Task, Identity and Core services at the SyncREST.svc and SyncWCF.svc endpoints along with Worklist, Process, Identity and Core services at the REST.svc and WCF.svc endpoints. 

Each endpoint defines an associated <binding> via the bindingConfiguration attribute.  This allows each endpoint to support a different security binding allowing for the mixing of authentication and SSL requirements for the same virtual directory.  The REST endpoints are associated with <webHttpBinding> bindings while WCF/SOAP endpoints are associated with <basicHttpBinding> bindings.  For example, the default bindingConfiguration for the Task service at SyncREST.svc endpoint is SourceCode.Services.SyncRestBinding+HTTPS found in the <bindings><webHttpBinding><bindingname="SourceCode.Services.SyncRestBinding+HTTPS"> section.

<endpoint address="Task" behaviorConfiguration="SourceCode.Services.RestBehavior" binding="webHttpBinding" bindingConfiguration="SourceCode.Services.SyncRestBinding+HTTPS" contract="SourceCode.Services.ServiceContracts.ITaskService" />

The <bindings> section contains the configuration details for each binding.  The two main configuration elements related to K2 Services bindings are <security> and <transport>.

The <securitymode=""> element/attribute defines whether or not SSL is supported.  Although None *should* allow IIS to manage the binding requirements this is not the case with WCF.  Unfortunately, WCF will not allow both SSL (HTTPS) and non-SSL (HTTP) support on the same endpoint.  Therefore, K2 Services must have multiple endpoints and mappings to multiple bindings to support both SSL (HTTPS) and non-SSL (HTTPS) for the same service.  Example configurations for these have been provided in comments in the web.config and the product documentation.

K2 recommends setting <securitymode="TransportCredentialOnly"> for standard non-SSL (HTTP) support and <securitymode="Transport"> to enable SSL (HTTPS) support.  Remember that when bindings are enabled, an associated service endpoint must also be enabled.

The <transportclientCredentialType=""/> element/attribute defines what credential types will be supported by client requests headers.  <transportclientCredentialType="None"/> allows for the greatest flexibility by allowing the client application to provide the appropriate supported header – Basic, Windows (NTLM or Negotiate) or NTLM.  Changing this value to Windows or NTLM will force the endpoint to require a Windows-based request thus disabling Basic authentication.

K2 recommends setting <transportclientCredentialType="None"/> to enable support for Basic and Windows (NTLM or Negotiate) depending on the client request header.  Remember that when bindings are enabled, an associated service endpoint must also be enabled.

Below is an example web.config file with the default security configuration for the service endpoints bindings. Update these sections to change the endpoints and bindings. 

<services>
    <service behaviorConfiguration="SourceCode.Services.RestBehavior" name="SourceCode.Services.Rest">
        <!-- HTTP endpoints for REST.svc - uses RestBinding+HTTP binding -->
        <!-- Ensure the RestBinding+HTTP binding is enabled when enabling these endpoints -->
        <endpoint address="Process" behaviorConfiguration="SourceCode.Services.RestBehavior" binding="webHttpBinding" bindingConfiguration="SourceCode.Services.RestBinding+HTTP" contract="SourceCode.Services.ServiceContracts.IProcessNavigationService" />
        <endpoint address="Worklist" behaviorConfiguration="SourceCode.Services.RestBehavior" binding="webHttpBinding" bindingConfiguration="SourceCode.Services.RestBinding+HTTP" contract="SourceCode.Services.ServiceContracts.IWorklistNavigationService" />
        <endpoint address="Identity" behaviorConfiguration="SourceCode.Services.RestBehavior" binding="webHttpBinding" bindingConfiguration="SourceCode.Services.RestBinding+HTTP" contract="SourceCode.Services.ServiceContracts.IIdentityService" />
        <endpoint address="Core" behaviorConfiguration="SourceCode.Services.RestBehavior" binding="webHttpBinding" bindingConfiguration="SourceCode.Services.RestBinding+HTTP" contract="SourceCode.Services.ServiceContracts.ICoreService" />
        <!-- HTTPS endpoints for REST.svc - uses RestBinding+HTTPS binding -->
        <!-- Ensure the RestBinding+HTTPS binding is enabled and SSL in IIS is configured when enabling these endpoints
<endpoint address="Process" behaviorConfiguration="SourceCode.Services.RestBehavior" binding="webHttpBinding" bindingConfiguration="SourceCode.Services.RestBinding+HTTPS" contract="SourceCode.Services.ServiceContracts.IProcessNavigationService" /><endpoint address="Worklist" behaviorConfiguration="SourceCode.Services.RestBehavior" binding="webHttpBinding" bindingConfiguration="SourceCode.Services.RestBinding+HTTPS" contract="SourceCode.Services.ServiceContracts.IWorklistNavigationService" /><endpoint address="Identity" behaviorConfiguration="SourceCode.Services.RestBehavior" binding="webHttpBinding" bindingConfiguration="SourceCode.Services.RestBinding+HTTPS" contract="SourceCode.Services.ServiceContracts.IIdentityService" /><endpoint address="Core" behaviorConfiguration="SourceCode.Services.RestBehavior" binding="webHttpBinding" bindingConfiguration="SourceCode.Services.RestBinding+HTTPS" contract="SourceCode.Services.ServiceContracts.ICoreService" />
-->
        <host>
            <baseAddresses>
                <add baseAddress="http://DLX:81/K2Services/REST.svc" />
            </baseAddresses>
        </host>
    </service>
    <service behaviorConfiguration="SourceCode.Services.SoapBehavior" name="SourceCode.Services.Wcf">
        <!-- HTTP endpoints for WCF.svc - uses WcfBinding+HTTP binding -->
        <!-- Ensure the WcfBinding+HTTP binding is enabled when enabling these endpoints -->
        <endpoint address="Process" behaviorConfiguration="SourceCode.Services.SoapBehavior" binding="basicHttpBinding" bindingConfiguration="SourceCode.Services.WcfBinding+HTTP" contract="SourceCode.Services.ServiceContracts.IProcessService" />
        <endpoint address="Worklist" behaviorConfiguration="SourceCode.Services.SoapBehavior" binding="basicHttpBinding" bindingConfiguration="SourceCode.Services.WcfBinding+HTTP" contract="SourceCode.Services.ServiceContracts.IWorklistService" />
        <endpoint address="Identity" behaviorConfiguration="SourceCode.Services.SoapBehavior" binding="basicHttpBinding" bindingConfiguration="SourceCode.Services.WcfBinding+HTTP" contract="SourceCode.Services.ServiceContracts.IIdentityService" />
        <endpoint address="Core" behaviorConfiguration="SourceCode.Services.SoapBehavior" binding="basicHttpBinding" bindingConfiguration="SourceCode.Services.WcfBinding+HTTP" contract="SourceCode.Services.ServiceContracts.ICoreService" />
        <!-- HTTPS endpoints for WCF.svc - uses WcfBinding+HTTPS binding -->
        <!-- Ensure the WcfBinding+HTTPS binding is enabled and SSL in IIS is configured when enabling these endpoints
<endpoint address="Process" behaviorConfiguration="SourceCode.Services.SoapBehavior" binding="basicHttpBinding" bindingConfiguration="SourceCode.Services.WcfBinding+HTTPS" contract="SourceCode.Services.ServiceContracts.IProcessService" /><endpoint address="Worklist" behaviorConfiguration="SourceCode.Services.SoapBehavior" binding="basicHttpBinding" bindingConfiguration="SourceCode.Services.WcfBinding+HTTPS" contract="SourceCode.Services.ServiceContracts.IWorklistService" /><endpoint address="Identity" behaviorConfiguration="SourceCode.Services.SoapBehavior" binding="basicHttpBinding" bindingConfiguration="SourceCode.Services.WcfBinding+HTTPS" contract="SourceCode.Services.ServiceContracts.IIdentityService" /><endpoint address="Core" behaviorConfiguration="SourceCode.Services.SoapBehavior" binding="basicHttpBinding" bindingConfiguration="SourceCode.Services.WcfBinding+HTTPS" contract="SourceCode.Services.ServiceContracts.ICoreService" />
-->
        <host>
            <baseAddresses>
                <add baseAddress="http://DLX:81/K2Services/WCF.svc" />
            </baseAddresses>
        </host>
    </service>
    <service behaviorConfiguration="SourceCode.Services.RestBehavior" name="SourceCode.Services.SyncRest">
        <!-- HTTP endpoints for SyncREST.svc - uses SyncRestBinding+HTTP binding -->
        <!-- WARNING: Basic over HTTP is inherently insecure -->
        <!-- Ensure the SyncRestBinding+HTTP binding is enabled when enabling these endpoints
<endpoint address="Task" behaviorConfiguration="SourceCode.Services.RestBehavior" binding="webHttpBinding" bindingConfiguration="SourceCode.Services.SyncRestBinding+HTTP" contract="SourceCode.Services.ServiceContracts.ITaskService" /><endpoint address="Identity" behaviorConfiguration="SourceCode.Services.RestBehavior" binding="webHttpBinding" bindingConfiguration="SourceCode.Services.SyncRestBinding+HTTP" contract="SourceCode.Services.ServiceContracts.IIdentityService" /><endpoint address="Core" behaviorConfiguration="SourceCode.Services.RestBehavior" binding="webHttpBinding" bindingConfiguration="SourceCode.Services.SyncRestBinding+HTTP" contract="SourceCode.Services.ServiceContracts.ICoreService" />
-->
        <!-- HTTPS endpoints for SyncREST.svc - uses SyncRestBinding+HTTPS binding -->
        <!-- Ensure the SyncRestBinding+HTTPS binding is enabled and SSL in IIS is configured when enabling these endpoints -->
        <endpoint address="Task" behaviorConfiguration="SourceCode.Services.RestBehavior" binding="webHttpBinding" bindingConfiguration="SourceCode.Services.SyncRestBinding+HTTPS" contract="SourceCode.Services.ServiceContracts.ITaskService" />
        <endpoint address="Identity" behaviorConfiguration="SourceCode.Services.RestBehavior" binding="webHttpBinding" bindingConfiguration="SourceCode.Services.SyncRestBinding+HTTPS" contract="SourceCode.Services.ServiceContracts.IIdentityService" />
        <endpoint address="Core" behaviorConfiguration="SourceCode.Services.RestBehavior" binding="webHttpBinding" bindingConfiguration="SourceCode.Services.SyncRestBinding+HTTPS" contract="SourceCode.Services.ServiceContracts.ICoreService" />
        <host>
            <baseAddresses>
                <add baseAddress="http://DLX:81/K2Services/SyncREST.svc" />
            </baseAddresses>
        </host>
    </service>
    <service behaviorConfiguration="SourceCode.Services.SoapBehavior" name="SourceCode.Services.SyncWcf">
        <!-- HTTP endpoints for SyncWCF.svc - uses SyncWcfBinding+HTTP binding -->
        <!-- WARNING: Basic over HTTP is inherently insecure -->
        <!-- Ensure the SyncWcfBinding+HTTP binding is enabled when enabling these endpoints
<endpoint address="Task" behaviorConfiguration="SourceCode.Services.SoapBehavior" binding="basicHttpBinding" bindingConfiguration="SourceCode.Services.SyncWcfBinding+HTTP" contract="SourceCode.Services.ServiceContracts.ITaskService" /><endpoint address="Identity" behaviorConfiguration="SourceCode.Services.SoapBehavior" binding="basicHttpBinding" bindingConfiguration="SourceCode.Services.SyncWcfBinding+HTTP" contract="SourceCode.Services.ServiceContracts.IIdentityService" /><endpoint address="Core" behaviorConfiguration="SourceCode.Services.SoapBehavior" binding="basicHttpBinding" bindingConfiguration="SourceCode.Services.SyncWcfBinding+HTTP" contract="SourceCode.Services.ServiceContracts.ICoreService" />
-->
        <!-- HTTPS endpoints for SyncWCF.svc - uses SyncWcfBinding+HTTPS binding -->
        <!-- Ensure the SyncWcfBinding+HTTPS binding is enabled and SSL in IIS is configured when enabling these endpoints -->
        <endpoint address="Task" behaviorConfiguration="SourceCode.Services.SoapBehavior" binding="basicHttpBinding" bindingConfiguration="SourceCode.Services.SyncWcfBinding+HTTPS" contract="SourceCode.Services.ServiceContracts.ITaskService" />
        <endpoint address="Identity" behaviorConfiguration="SourceCode.Services.SoapBehavior" binding="basicHttpBinding" bindingConfiguration="SourceCode.Services.SyncWcfBinding+HTTPS" contract="SourceCode.Services.ServiceContracts.IIdentityService" />
        <endpoint address="Core" behaviorConfiguration="SourceCode.Services.SoapBehavior" binding="basicHttpBinding" bindingConfiguration="SourceCode.Services.SyncWcfBinding+HTTPS" contract="SourceCode.Services.ServiceContracts.ICoreService" />
        <host>
            <baseAddresses>
                <add baseAddress="http://DLX:81/K2Services/SyncWCF.svc" />
            </baseAddresses>
        </host>
    </service>
</services>
<bindings>
    <webHttpBinding>
        <!-- HTTP binding for REST.svc endpoints -->
        <!-- Ensure the REST.svc endpoints are enabled when enabling these bindings -->
        <binding name="SourceCode.Services.RestBinding+HTTP">
            <security mode="TransportCredentialOnly">
                <transport clientCredentialType="Windows" />
            </security>
        </binding>
        <!-- HTTPS binding for REST.svc endpoints -->
        <!-- Ensure the REST.svc endpoints are enabled and SSL in IIS is configured when enabling these bindings
<binding name="SourceCode.Services.RestBinding+HTTPS"><security mode="Transport"><transport clientCredentialType="Windows" /></security></binding>
-->
        <!-- HTTP binding for SyncREST.svc endpoints -->
        <!-- WARNING: Basic over HTTP is inherently insecure -->
        <!-- Ensure the SyncREST.svc endpoints are enabled when enabling this binding
<binding name="SourceCode.Services.SyncRestBinding+HTTP"><security mode="TransportCredentialOnly"><transport clientCredentialType="None" /></security></binding>
-->
        <!-- HTTPS binding for SyncREST.svc endpoints -->
        <!-- Ensure the SyncREST.svc endpoints are enabled and SSL in IIS is configured when enabling these bindings -->
        <binding name="SourceCode.Services.SyncRestBinding+HTTPS">
            <security mode="Transport">
                <transport clientCredentialType="None" />
            </security>
        </binding>
    </webHttpBinding>
    <basicHttpBinding>
        <!-- HTTP binding for WCF.svc endpoints -->
        <!-- Ensure the WCF.svc endpoints are enabled when enabling these bindings -->
        <binding name="SourceCode.Services.WcfBinding+HTTP">
            <security mode="TransportCredentialOnly">
                <transport clientCredentialType="Windows" />
            </security>
        </binding>
        <!-- HTTPS binding for WCF.svc endpoints -->
        <!-- Ensure the WCF.svc endpoints are enabled and SSL in IIS is configured when enabling these bindings
<binding name="SourceCode.Services.WcfBinding+HTTPS"><security mode="Transport"><transport clientCredentialType="Windows" /></security></binding>
-->
        <!-- HTTP binding for SyncWCF.svc endpoints -->
        <!-- WARNING: Basic over HTTP is inherently insecure -->
        <!-- Ensure the SyncWCF.svc endpoints are enabled when enabling this binding
<binding name="SourceCode.Services.SyncWcfBinding+HTTP"><security mode="TransportCredentialOnly"><transport clientCredentialType="None" /></security></binding>
-->
        <!-- HTTPS binding for SyncWCF.svc endpoints -->
        <!-- Ensure the SyncWCF.svc endpoints are enabled and SSL in IIS is configured when enabling these bindings -->
        <binding name="SourceCode.Services.SyncWcfBinding+HTTPS">
            <security mode="Transport">
                <transport clientCredentialType="None" />
            </security>
        </binding>
    </basicHttpBinding>
</bindings>

Multiple Service Hosting

It is possible to host multiple services which include both non-SSL and SSL services.  To add the SSL service a few manual steps are required post installation.  Take the following into consideration:

Microsoft Framework .NET 3.5 does not support multiple bindings in IIS without configuring a single address and setting up a prefix filter as per the following MSDN KB (Refer to section ‘Multiple IIS Binding Support in .NET Framework 3.5’): http://msdn.microsoft.com/en-us/library/aa751841.aspx
Some of the following errors may occur when bindings are incorrectly configured:
Could not find a base address that matches scheme http for the endpoint with binding WebHttpBinding. Registered base address schemes are [].
No protocol binding matches the given address 'http://api.denallix.com:85/K2Services/REST.svc/Worklist/Items'. Protocol bindings are configured at the Site level in IIS or WAS configuration.
The resource cannot be found.
This collection already contains an address with scheme http. There can be at most one address per scheme in this collection. Parameter name: item

The K2 installation will not configure entries. To configure K2 Services to support a web site with multiple bindings add a prefix entry for the binding you wish to support in the section of the K2 Services web.config found at [Installation Directory]\WebServices\K2Services\web.config.

The HTTPS port needs to be set manually to 443 in the web.config as well.
Example of supporting the http://api.denallix.com:81 binding on an IIS site with multiple bindings:

<serviceHostingEnvironment aspNetCompatibilityEnabled="true">
  <baseAddress>
    <add prefix="http://api.denallix.com:81" />
    <add prefix="https://api.denallix.com:443" />
  </baseAddress>
</serviceHostingEnvironment>

Note that the HTTPS section in the web.config file is commented out by default.  The following section therefore needs to be enabled. Note that the first two lines are headings only and should stay commented out.  The highlighted section below needs to be enabled:  

<!-- HTTPS endpoints for REST.svc - uses RestBinding+HTTPS binding -->
<!-- Ensure the RestBinding+HTTPS binding is enabled and SSL in IIS is configured when enabling these endpoints-->
<endpoint address="Process" behaviorConfiguration="SourceCode.Services.RestBehavior" binding="webHttpBinding" bindingConfiguration="SourceCode.Services.RestBinding+HTTPS" contract="SourceCode.Services.ServiceContracts.IProcessNavigationService" />
<endpoint address="Worklist" behaviorConfiguration="SourceCode.Services.RestBehavior" binding="webHttpBinding" bindingConfiguration="SourceCode.Services.RestBinding+HTTPS" contract="SourceCode.Services.ServiceContracts.IWorklistNavigationService" />
<endpoint address="Identity" behaviorConfiguration="SourceCode.Services.RestBehavior" binding="webHttpBinding" bindingConfiguration="SourceCode.Services.RestBinding+HTTPS" contract="SourceCode.Services.ServiceContracts.IIdentityService" />
<endpoint address="Core" behaviorConfiguration="SourceCode.Services.RestBehavior" binding="webHttpBinding" bindingConfiguration="SourceCode.Services.RestBinding+HTTPS" contract="SourceCode.Services.ServiceContracts.ICoreService" />

K2 blackpearl Developers Reference4.7
Video Links Learn Support
No videos found for this article
K2 on YouTube
No Additional links found for this article
No self-learning content for this article
Try some scenarios...
No relevant support links available for this article