Home > BizTalk, C#, Development, OData > BizTalk Data Services: Extended to bring management functions through IUpdatable

BizTalk Data Services: Extended to bring management functions through IUpdatable

In the last few days I have been actively working on the next version of BizTalk Data Services, a project initiated by Tellago’s Jesus Rodriguez and Uri Katsir.

The overall idea of this work is to provide a way to enable an OData-based RESTul service API to interact with the different BizTalk Server subsystems.

Following the concept to provide a RESTful service API, BizTalk Data Services implements the IUpdatable interface so it can follow the standard way to see and manipulate the objects and then you can just call SaveChanges to reflect your actions.

The set of functionalities added consist of basically start, stop, enable, disable, enlist and Unenlist, depending the case the following objects:

  • Hosts Instances: It leverages functionality developed for the project PowerShell Provider BizTalk
  • Applications
  • Receive Ports
  • Receive Locations
  • Orchestrations
  • In Process Instances: e.g. Suspend, Terminate, and Resume instances. All the functionalities except this one works for both BizTalk 2009 and 2010 Beta.

BizTalk Data Services enables not only the current monitoring capabilities but you can also perform some administrative task in very practice way and also count with the opportunity to use LINQ queries to interact with the model.

Now, let see some samples using the service and how the information is exchanged. Between the client and the server.

Stop All Host Instances

void Main()

{

var hostinstances = HostInstances.Where(i => i.State == “Stopped”);

foreach (HostInstance instance in hostinstances)

{

instance.State = “Started”;

UpdateObject(instance);

SaveChanges();

}

}

This actually is generating this AtomPub message

GET /BizTalkManagementService.svc/HostInstances()?$filter=State%20eq%20′Stopped’ HTTP/1.1

User-Agent: Microsoft ADO.NET Data Services

DataServiceVersion: 1.0;NetFx

MaxDataServiceVersion: 2.0;NetFx

Accept: application/atom+xml,application/xml

Accept-Charset: UTF-8

Host: localhost:8081

Connection: Keep-Alive

MERGE /BizTalkManagementService.svc/HostInstances(‘%7B54FAFC07-5E4F-49A2-B1D4-D3BDE7B1CE78%7D’) HTTP/1.1

User-Agent: Microsoft ADO.NET Data Services

DataServiceVersion: 1.0;NetFx

MaxDataServiceVersion: 2.0;NetFx

Accept: application/atom+xml,application/xml

Accept-Charset: UTF-8

Content-Type: application/atom+xml

Host: localhost:8081

Content-Length: 1015

Expect: 100-continue

<?xml version=”1.0″ encoding=”utf-8″ standalone=”yes”?>

<entry xmlns:d=”http://schemas.microsoft.com/ado/2007/08/dataservices” xmlns:m=”http://schemas.microsoft.com/ado/2007/08/dataservices/metadata” xmlns=”http://www.w3.org/2005/Atom”>

<category scheme=”http://schemas.microsoft.com/ado/2007/08/dataservices/scheme” term=”Tellago.BizTalk.REST.Resources.HostInstance” />

<title />

<author>

<name />

</author>

<updated>2010-06-24T22:13:34.9537002Z</updated>

<id>http://localhost:8081/BizTalkManagementService.svc/HostInstances(‘%7B54FAFC07-5E4F-49A2-B1D4-D3BDE7B1CE78%7D’)</id>

<content >

<m:properties>

<d:Description m:null=”true” />

<d:HostName>BizTalkServerApplication</d:HostName>

<d:HostType>In_process</d:HostType>

<d:ID>{54FAFC07-5E4F-49A2-B1D4-D3BDE7B1CE78}</d:ID>

<d:Name>Microsoft BizTalk Server BizTalkServerApplication DEKKERS</d:Name>

<d:State>Started</d:State>

</m:properties>

</content>

</entry>

So we can see how it starts getting the resources and then send the updated object back the service to save the changes.

Stop All Orchestrations in an Application

void Main()

{

var app = Orchestrations;

foreach (Orchestration orch in Orchestrations)

{

orch.Status = “Unenlisted”;

UpdateObject(orch);

Console.WriteLine(orch.Name);

}

SaveChanges( SaveChangesOptions.Batch );

}


Stop All Orchestrations from an Application

void Main()

{

var app = Orchestrations;

foreach (Orchestration orch in Orchestrations)

{

orch.Status = “Unenlisted”;

UpdateObject(orch);

Console.WriteLine(orch.Name);

}

SaveChanges( SaveChangesOptions.Batch );

}

Deployment

The main procedure is described at Uri’s blog, I’d just add that you need to keep in mind that the Explorer OM assembly works in 32 bits applications, so you may have to set this appropriately in your IIS configuration. Also you can give a try  using your Web Development Server based on Visual Studio. As far I know the only difference you are going to find is regarding to the IDs syntax. Since you can’t type something like ….svc/Applications(‘Microsoft.Practices.ESB’) in a VS Web Server, it only works on IIS.

Conclusion

I hope you find It useful to fit your needs, we are going to keep it growing, there is already a friend working on a BRE implementation, that you will find ready to download soon. Also this open a new range of possibilities, for example you may think about consolidate this information with different feeds to consolidate monitoring information, also it may help you to provide a quick way to  provide basic administrations functionalities for help desk people, or may be just as an example of a OData implementation J

You can find the code of this post @ CodePlex

VN:F [1.9.11_1134]
Rating: 4.0/5 (1 vote cast)
BizTalk Data Services: Extended to bring management functions through IUpdatable, 4.0 out of 5 based on 1 rating
Categories: BizTalk, C#, Development, OData Tags: