Difference in WCF Services

Whoa! Back from an amazing internship at Microsoft Corporation where I was given some truly great work. I had to build an Operations Tool for something called an ESB and I was supposed to use Silverlight with Windows Communication Foundation (WCF).

Now, the main issue I faced when developing in Silverlight was that I had a multitude of options when it came to choosing a WCF Service Library and the appropriate settings. Here is a list:

  1. WCF Service
  2. WCF Data Service
  3. WCF RIA Service
  4. AJAX-enabled WCF Service
  5. Silverlight-enabled WCF Service

Now this gets very confusing for someone new to .NET and Silverlight (which was me 3 months ago). But with a little exploration and search, you can easily find out the difference in all the options.

There are basically 2 types of WCF Services in actuality. However there are 5 variations present which leads to most of the confusion.

The two basic types of WCF Services are:

  1. SOAP Services – Here, there is a service metadata file that helps the client generate proxy classes and the messages being transferred are generally SOAP messages with Binary encoding an option via the NetTcpBinding binding.
  2. REST Services – This service allows for a greater variety of message formats, from binary and XML to JSON, since it uses the HTTP protocol. The drawback is that there is no standard and both the client and server have to agree on the data format. However this type of service is more lightweight.

I hope this makes it very clear. And now onto the 5 variations:

  1. CoreĀ SOAP services: Simply used to build a standard SOAP service.
  2. Core REST services: Used to build a standard REST service.
  3. Data services: This is just a variation of the REST service, where the data being transferred uses a common format (OData), and thus clients know how to consume a new data service even if there’s no document. No arbitary data is allowed and only AtomPub (XML) and JSON is supported.
  4. RIA services: With RIA services, you can create one service and define multiple endpoints. So you can have both SOAP and Data Services in one package through different endpoints for your application to access.
  5. Workflow services: A variation of SOAP service. It allows you to expose a workflow(a series of executions based on operation of the application. For more info, see Windows Workflow Foundation on MSDN) instead of code as a SOAP service.

Finally, AJAX/Silverlight – enabled WCF Services are simply templates that allow for easier creation and programming of WCF Services for Silverlight and AJAX applications, owing to their lack of compatibility with a some libraries. Thus, be sure to use these if you have a AJAX/Silverlight application, irrespective of what others say!

As I am sure you now understand, WCF Services are quite simple in their hierarchy and nomenclature. If you have solid fundamentals of Computer Networks and Internet Technology, all the above terms should feel like everyday words. Also, the power that WCF grants you for your application, not only to retrieve data and information, but to enforce good design in your application really makes it worth your while to check out this great technology from Microsoft and create something really useful and meaningful.

Eviva!