K2 SmartObject Service and Versioning

This blogpost is outdated. Please see K2 SmartObject Services – Configuration update static endpoint if you have any problems with the K2HostServer.config file changes.

Since the coming of the K2 SmartObject Service in KB1230 , people might have noticed the smartobjectVersion parameter in the managedEndpoints definition. Since SmartObjects have been around, they always had a version. The version number starts at 0 (zero) and increases by 1 (one) when the SmartObject is deployed.

In the past, there wasn’t really a reason why you would bother with versioning of SmartObjects. Default, all the API’s (and the process) will take the latest version. With the K2 SmartObject Service, you might want to define a managed endpoint with a specific version. The reason is simple: you don’t want your SOA clients to break when you deploy a new version of that SmartObject. For more info on why you’d want that in a SOA architecture, see the four tenets of SOA.

The static endpoint allows you to set a version with the smartobjectVersion parameter. Leave that out and it will take the latest. An example below of how you can define it (scoll to the end of the line to see the smartobjectVersion):

<smoServices enableEndpoints="True" enableEvents="true" enableCrossDomainPolicy="false" baseUri="http://dlx:8888/SmartObjectServices" binding="WsHttpBinding" specialCharacterReplacement="_">
	<managedEndpoints>
		<excluded all="true" />
		<static>
			<endpoints>
				<endpoint categoryPath="K2SimpleProc" alias="EmployeesV1" smartobjectName="Employee" binding="WsHttpBinding" smartobjectVersion="1" />
			</endpoints>
		</static>
	</managedEndpoints>
</smoServices>

This is all great, but how do we actually get to know which versions of a SmartObject are available? The SmartObject Service Tester ([K2 installpath]\bin\SmartObject Service Tester.exe) allows you get the XML of a SmartObject definition:

On the right a property panel is shown:

This is the SmartObject Service Tester of 1290, not sure if the 1230 also has this, but you can find the version number here:

SmartObjects start counting from 0. So in my example, I deployed 2 times.