Navigation:  I Want To... >

Automation

Previous pageReturn to chapter overviewNext page

Automation generally refers to the mechanism by which an application exposes an interface for external applications to control some aspect(s) of its behaviour.  The choice of interface that is exposed and the technology used to exchange messages between the applications is quite critical, for a number of reasons:

The interfaces exposed should be robust enough to allow at least the most commonly desired operations.  To facilitate robustness and ease of use, we have taken a Service-Oriented approach, providing multiple services that, when used together, will make Automation a powerful feature in ClearCanvas.
Some technologies are not widely supported.  This limits the types of external applications that can use the service(s).
Some technologies make backward compatibility challenging.  Windows Automation (formerly OLE Automation) is a good example of this: because the underlying technology is COM, it requires a fairly knowledgeable developer to use it in the first place, and once a method has been defined and released as part of an SDK, it is very difficult to change.

 

For these reasons, we have chosen to implement the automation service using WCF (Windows Communication Foundation).  WCF is the next generation of communication technology.  Here are just a few of its benefits:

Supports a number of different transport protocols, including: HTTP, TCP/IP and Named Pipes, to name a few.
The protocol that is used to communicate can be completely abstracted away from the consumer of the service.  This can make switching between protocols as simple as a mere configuration change.
The service can be hosted using multiple different protocols at the same time in the same process.  This can also be done through configuration.
Supports basic SOAP web service hosting, meaning that virtually any other application running on any platform can communicate with it.

 

So, what are the drawbacks to using WCF?  As with any technology, there are a few, but the biggest one is interoperability with legacy applications (e.g. unmanaged code); although this is not an unsolvable problem.  If you are writing an application using Visual C++, you may notice that, when you try to add a Web Reference to your project, it fails.  This is because Microsoft's proxy generator, sproxy, can't understand the metadata that is being returned from the service, even though it is correct.  This is very unfortunate, as it would make using the automation service in unmanaged code a breeze.  As of right now, there is no direct support provided in ClearCanvas for unmanaged applications.  One thing that we have verified to work is the gSoap proxy generator.  However, due to licensing conflicts, we are unable to distribute the generated code.  If this is an option you need to pursue, there are two good places to start: the gSoap website, and an article on Blinnov's blog with a pretty good explanation of how to generate the proxy.

 

The following sections discuss what you need to do in order to use the automation service from your application.  In order to keep the sections concise, all examples deal with .C#, NET and Visual Studio.