Tellago Devlabs: A RESTful API for BizTalk Server Business Rules
Tellago DevLabs keeps growing as the primary example of our commitment to open source! Today, we are very happy to announce the availability of the BizTalk Business Rules Data Service API which extends our existing BizTalk Data Services solution with an OData API for the BizTalk Server Business Rules engine. Tellago’s Vishal Mody led the implementation of this version of the API with some input from other members of our technical staff.
The fundamental motivation behind the BRE Data Services API is to expose the capabilities of the BizTalk Server BRE engine in a highly interoperable RESTful service interface so that they can be accessible to applications developed in heterogeneous platforms such as J2EE, dynamic languages or even mobile application development frameworks.
Since its 2004 release, the BizTalk Server Business Rules has become of the unique and most popular technologies in the BizTalk Server ecosystem. Essentially, BizTalk BRE enables the modeling of Boolean expressions in a completely declarative model and stores them in a central repository so that they can be interpreted by other applications. In that sense, BRE is somewhat independent of BizTalk Server given that the business rules stored in BRE can be consumed by any .NET application. However, in the current version of BizTalk Server, developers will have to rely on BizTalk specific assemblies in order to interact with the BRE system. In order to overcome this limitation, we decided to implement a RESTful, OData-based API that exposes the entire BRE subsystems as simple resources accessible via HTTP.
After debating a few options, we decide to rely on the current version of WCF Data Services and the OData protocol to surface the interactions with the BizTalk Server BRE engine. The result of this implementation is a ridiculous simple interface that allows developers to browse the entire BRE system using HTTP GETs based on the OData protocol as well as to execute policies using simple HTTP POSTs.
Here are a few examples extracted from our basic documentation:
The existing version of the API allows you to navigate the entire BRE systems using simple HTTP GETs.
Browsing BRE artifacts
Querying BRE Policies
Querying BRE Rules
Querying BRE Vocabularies
Querying individual BRE resources
Querying a specific Policy
Querying a specific Rule
Querying all Rules under a Policy
Querying all Facts under a Policy
Querying all Actions for a specific Rule
Querying all Conditions for a specific Rule
Querying a specific Vocabulary
Executing a BizTalk Server Business Rule using HTTP
In addition to the enabling querying capabilities, this version of the BRE Data Services API also enables to execute rules by issuing a HTTP POST against a specific URL as specified in the following code:
POST /<service endpoint>/BREMananagementService.svc/ExecuteRuleAsSvcOperation?FactInstance='%3Cns0:LoanStatus%20xmlns:ns0=%22http://tellago.com%22%3E%3CAge%3E10%3C/Age%3E%3CStatus%3Etrue%3C/Status%3E%3C/ns0:LoanStatus%3E'&%20FactType='TestSchema'&PolicyName='TestPolicy' HTTP/1.1
HTTP/1.1 200 OK
Server: ASP.NET Development Server/10.0.0.0
Date: Tue, 08 Feb 2011 16:56:50 GMT
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<ExecuteRuleAsSvcOperation xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices"><ns0:LoanStatus xmlns:ns0="http://tellago.com"><Age>10</Age><Status>false</Status></ns0:LoanStatus>
Using this capability now we can build applications that leverage BRE without the need of relying on specific BizTalk assemblies. Specifically, this approach opens the BizTalk BRE capabilities to applications built on heterogeneous platforms such as J2EE, dynamic languages such as Ruby or Python or mobile platforms such as Windows Phone 7 or Android.
I hope you truly enjoy this release of the BizTalk BRE Data Services API. We encourage you to download the bits, give it a try and drive us crazy with your feedback.