K2 SmartObject Services – Configuration update, static endpoint

After the release of K2 1370, there have been some small updates to the K2HostServer.config file for your SmartObject Services configuration.

The basics is pretty simple, KB1370 added the ability to change binding and binding configuration on the REST and WCF endpoints separately. Because the binding configuration also defines the authentication mechanism, this means that REST endpoints could use basicHttpBinding with Basic authentication, while the WCF endpoint uses wsHttpBinding with Windows authentication. It also allows us to run either one endpoint on HTTPS while the other is not.

In my previous post on the K2 Services I showed you how to create a static endpoint, this simplifies the URL and allows you to rename or update the SMO without the endpoint changing. The configuration sections shown in those posts are now outdated and won’t work anymore. Since the KB article describing the change doesn’t have all the parameters, this post is also a note-to-self.

To use a static endpoint, try this configuration:

<smoServices enableEndpoints="true" enableEvents="true" enableCrossDomainPolicy="true" scheme="http" server="k2.denallix.com" port="8888" serviceRoot="SmartObjectServices" specialCharacterReplacement="_" enableMetadata="true" defaultSecurityLabel="K2">
    <wcf binding="wsHttpBinding" bindingConfiguration="wsHttpBinding+Windows" />
    <rest binding="webHttpBinding" bindingConfiguration="webHttpBinding+Windows" />

      <excluded all="true">
          <endpoint categoryPath="ServicesDemo" alias="InfoSmo" isolationLevel="single" smartobjectName="Info" >
            <wcf binding="wsHttpBinding" bindingConfiguration="wsHttpBinding+Windows"/>
            <rest binding="webHttpBinding" bindingConfiguration="webHttpBinding+Windows"/>


The configuration first shows some standard parameters, like if the endpoints are enabled at all (enableEndpoints) and if it should listen for events (enableEvents). This configuration is pretty much default and should be good for nearly everybody.

It also shows the default configuration for the endpoints, so all WCF endpoints will use wsHttpBinding with Windows authentication and all the REST endpoints will use webHttpBinding with Windows authentication.

In this configuration there is first an exclusion of all the SmartObjects using the . A common method to get every self-created SmartObject is to change the to and uncomment the section which is commented. This allows you to ‘hide’ categories of SmartObjects, while still showing other SmartObjects.

The configuration section tells me that the InfoSmo SmartObject inside the ServicesDemo category will be exposes as a static endpoint named “Info”. Because I didn’t specify a smartobjectVersion parameter, it will use the latest version of that SmartObject. This endpoint will work, even if the was used. So, with the above configuration, you only get one endpoint exposed on the URL http://k2.denallix.com:8888/SmartObjectServices/wcf/InfoSmo
(for wcf) and http://k2.denallix.com:8888/SmartObjectServices/rest/InfoSmo (for rest).

It also tells me that the WCF is running on wsHttpBinding and uses windows authentication and the rest endpoint uses webHttpBinding with Windows authentication as well. As you can see, with static endpoints, you can also configure specific wcf bindings and bindingconfigurations per endpoint, which is useful if your mobile devices require a SmartObject, as they tend to use Basic authentication over HTTPS.

The above configuration also makes the REST endpoint work inside the Excel PowerPivot and inside SharePoint 2010’s BCS. To get it working, some extra configuration inside SharePoint is needed, this configuration is described in this Walkthrough.