Excited that its going on tomorrow at Tibco Palo Alto and that I have an excuse to be home in the Bay area yet a few more days. WS-Eventing is a great spec. I've provided some feedback on this blog on it already. I have more substantive suggestions for tomorrow.
Below is a sample C# command line utility I wrote tonight that allows you to subscribe a URL-specified endpoint to XPath-specified document content. It does this by sending WS-Eventing Subscribe messages to a WS-Eventing supporting Content Based Routing service. Full source (with comments even!), WS-E WSDL file, VS project files and executable is also available here. Works against our WS-Eventing implementation nicely it seems.
* Shouldn't be necessary to have such caveats on a personal blog, but it has not been tested very much at all, and for all I know has all kinds of bugs (certainly should be doing more sanity checking of the SubscribeResponse than I do below). The only real use of it will be that some variation of it will probably end up as a sample in an article or tutorial somewhere. In other words, its true CTO-quality code...
Haven't tried it against Casey Chesnut's WS-Eventing implementation (which requires Microsoft SQL Server) since I don't have SQL Server on any systems here (shocking since I was on that team at Microsoft). Any other implementations to interop test this against? I'm sure I'll find out a few tomorrow...
Couldn't resist showing how simple the program gets to be due to the straightforwardness of WS-Eventing and how easy it is to subscribe to document traffic. Now, getting source code to appear nicely on a blog is another story, as the indentation is totally lost below :-(.
using System;
namespace CBRSubscribe
{
class MainClass
{
[STAThread]
///////////////////////////
static void Main(string[] args)
{
if (args.Length<3)
{
Console.WriteLine(
"Usage: CBRSubscribe <web service for notifications> <filter expression> <CBR URL>");
return;
}
bool result;
result=Subscribe(args[0],args[1],args[2]);
if (result)
Console.WriteLine(
"Endpoint {0} is successfully subscribed to documents matching {1} with CBR service {2}!",
args[0],args[1],args[2]);
else
Console.WriteLine("Subscription failed!");
return;
}
static bool Subscribe(string notifyAddress,string subscriptionFilter,string cbrServiceURL)
{
CBRSubscribe.CBRService.Subscribe subscription=new CBRSubscribe.CBRService.Subscribe();
subscription.NotifyTo=new CBRSubscribe.CBRService.EndpointReferenceType();
subscription.NotifyTo.Address=new CBRSubscribe.CBRService.AttributedURI();
subscription.NotifyTo.Address.Value=notifyAddress;
subscription.Filter=new CBRSubscribe.CBRService.MessagePredicateAssertion();
subscription.Filter.Value=subscriptionFilter;
CBRSubscribe.CBRService.Eventing objEventing=new CBRSubscribe.CBRService.Eventing (cbrServiceURL);
CBRSubscribe.CBRService.SubscribeResponse subscribeResponse=
new CBRSubscribe.CBRService.SubscribeResponse();
subscribeResponse=objEventing.SubscribeOp(subscription);
// sanity check the subscription results
bool result=true;
if (!subscribeResponse.Id.StartsWith("uuid:"))
result=false;
return result;
}
}
}