(picture)

March 12, 2003

Groove Web Services

I finally spent a little time playing with Groove Web Services. It's really good. A few rough edges, and not nearly enough features of course... but this is one of the most straightforward and elegant APIs I've ever seen.

I took the route of implementing a pure-JavaScript client: no WSDL parser, no infrastructure apart from XMLHTTP and XML DOM. Turns out, JavaScript is easily capable of building up interface abstractions at whatever level you need. So my code includes things like this:


with( _class( "GrooveDiscussionData" ) )
{
_implements( GrooveSOAPInterfaces );
_implements( Subscribable );
_property( "EventClass", "urn:groove-net:DiscussionEvent" );
_method( "Create", SOAPCall( "Discussion", "http://webservices.groove.net/Groove/1.0/Discussion#Create" ) );
_method( "Read", SOAPCall( "Discussion", "http://webservices.groove.net/Groove/1.0/Discussion#Read", "GetEntries" ) );
_method( "ReadEntry", SOAPCall( "Discussion", "http://webservices.groove.net/Groove/1.0/Discussion#ReadEntry", "GetEntry" ) );
_method( "UpdateEntry", SOAPCall( "Discussion", "http://webservices.groove.net/Groove/1.0/Discussion#UpdateEntry", "IsNoFault" ) );
_method( "DeleteEntry", SOAPCall( "Discussion", "http://webservices.groove.net/Groove/1.0/Discussion#DeleteEntry", "IsNoFault" ) );
_getter( "Entries", GetEnum( "./DiscussionEntry", GrooveDiscussionEntry ) );
_getter( "Entry", GetOne( "./DiscussionEntry", GrooveDiscussionEntry ) );
}

which means I can call it using code like this - which I think is even more compact than the using equivalent WSDL proxies which .NET will generate for you:


var pToolData = pTool.GetData();
pToolData.Subscribe( MyEventCallback ); // listen for any changes
var pDataEnum = pToolData.Read();
while( pDataEnum.HasMore() )
{
var pData = pDataEnum.OpenNext();
// create the simplest possible interface widget pLI as a LI in a UL (done elsewhere)
pLI.innerText = pData.GetSubject();
pLI.style.listStyleImage = pData.GetUnread() ? "url(Unread.ico)" : "url(Blank.ico)";
}

I recommend to everyone with even the vaguest interest in software development and Groove to take a look at GWS. The web services GDK and documentation will get you started in no time.