While checking out Microsoft's SOA website, I found an application called the Managed Services Engine (MSE). In the accompanying description I read that this application offers so called "Service Virtualization". In the list of features I found one that I was particularly interested in: service versioning. So I decided to check it out. For the MSE a Codeplex project has been created where the tool can be downloaded. I downloaded the bits and installed them. It comes with a clear installation manual I followed without any problems.
The MSE consists of two parts:
- Service Catalog – which handles the administration of the services.
- Service Runtime – which hosts the services.
Both parts are implemented as a Windows service. The service catalog can be administered using the supplied MSE management console snap-in. The idea behind the MSE is that you create and host end-points in the MSE which in turn calls existing services to handle the implementation. That’s where the term "virtual services" comes from. In this blogpost I’d like to zoom in on a killer feature: service versioning. For every service operation that you define in the MSE, multiple versions can be defined. The MSE has a MessageBroker component which will call the appropriate implementation for a certain version based on the incoming message. Let’s assume the following situation:
The AddIntegers operation on the CalculatorService expects 2 integers as arguments and returns the sum of these integers as result. The AddIntegerArray operation on the AdvancedCalculatorService expects an array of integers as argument and returns the sum of these integers as result. In the MSE catalog, two versions of an operation called AddIntegers is defined. Obviously, the 1.0 version is handled by the CalculatorService and version 1.1 is handled by the AdvancedCalculatorService.
But how can we call a specific version of the AddIntegers operation? This is easy. You just call the AddIntegers operation and pass it a message that corresponds with the expected schema of the version you want to call. For example: if we want to call the 1.0 version, we would sent the following message (SOAP headers have been omitted for clarity):
<AddIntegers src="/wp-content/uploads/archief/4e9c2745681d20.41245193.jpg" style="width: 425px; height: 317px" width="425" />
Another cool feature is the ability to retire the implementation corresponding to a specific version of an operation, while keeping the version available on the virtual service. Say - for example - we need to take down the CalculatorService but we have several existing clients that call the 1.0 version of the AddIntegers operation. We can make this happen by instructing the MSE to send requests for version 1.0 to the AdvancedCalculatorService. Every version of an operation in MSE is equipped with a so called ChannelMoniker which specifies the address of the implementation service and the action that is to be called on this service for a specific version. By changing the address and action for version 1.0 you can make it point it to the AddIntegerArray operation on the AdvancedCalculatorService. Additionally we can specify an XSLT with which the MSE will automatically transform the incoming 1.0 request to an 1.1 request and do the same for the response (from 1.1 to 1.0). Once this is done, you can bring down the CalculatorService but still call the 1.0 version of the AddIntegers operation on the virtual service. I think that’s pretty cool.
In this blogpost I’ve focused on service versioning, but the MSE has more features in store. Whether you’re able to employ the MSE - as is - in your current project or you need some inspiration because you’re building some sort of service framework, I think it’s worth investigating.