WCF Service Layer

The WatchMe application has a service layer built into it that allows other applications to communicate with it programmatically in order to control the behaviour of the application or pull data out of it. This could be used to automate the entry of timer data into an existing time tracking application or even trigger the automatic creation, starting and stopping of timers from within another application. 

This service layer is built using the Windows Communication Foundation (WCF) and makes use of HTTP as its communication layer.

In order to make use of this service layer, you need to have a Pro key and also have a detailed understanding of how to use WCF. The service layer is provided as is and I will not provide assistance in the debugging of custom code that makes use of this service layer.

If none of this makes sense, then this feature of WatchMe is not for you. If you’re feeling brave and wish to continue, let’s proceed…

Turning the Service Layer On

By default the service layer is not enabled when running WatchMe. To turn it on you need to launch WatchMe with the “WCF” command-line switch. It should look like this “WatchMe.exe wcf”.

The service layer uses WSHttpBinding by default, but if you need to use BasicHttpBinding simply use the “WCFBASIC” command-line switch instead (added in v2.4.1). If you’re not sure which binding to use, go with the default (WSHttpBinding) unless you really need to switch. For more info on the differences between these binding options, check out this page.

Note: You must register your instance of WatchMe with a “Pro” key for this Service Layer to work. Using the command line switch on a non-Pro version of WatchMe will not start the service layer.

Note: When starting the WatchMe with the service layer enabled, you may run into an “Access is denied” error. To get around this you need to be running WatchMe with an account that has permissions to register new HTTP services on your machine – for example, the machine administrator can do this. You can run WatchMe as an admin or a user with this privilege or you could check out another possible solution here using the netsh command.

An example of the command to fix this is: netsh http add urlacl url=http://+:8000/Flamebrain/WatchMe/ user=DOMAIN\user

Creating Client Code that Communicates with the Service Layer

Once you have enabled the service layer and have it running, surf to http://localhost:8000/Flamebrain/WatchMe/ in your browser and follow the directions on how to create a client that can communicate with WatchMe. More info can be found at http://msdn.microsoft.com/en-us/library/ms734691.aspx.

You’re on your own now.

Good luck.