Shahid Riaz Bhatti

if(my.work == “Interesting” || my.availableTime > my.workHours) { this.blog.Post();}

How to develop a simple Service and its Consumer using WCF

September 27
by Shahid Riaz Bhatti 27. September 2008 08:24

What is WCF:

WCF stands for Windows communication foundation. WCF allows to build distributed application reagrdless of their underlying plumbing, in a syammetrical manner. Unlike other distributed APIs like (DCOM, .Net remoting, XML web services etc), WCF provides a single, unified, and extendable programming object model that can be used to interact with a number of previously diverse distributed technologies.

WCF is a way to develop the SOA application.

Lets get a brief introduction, advantage and disadvatange of other distributed technologies prior to WCF.

DCOM:

DCOM stands for Distributed component object model. This technology was used prior to the release of .Net platform. Using DCOM it was possible to develop Distributed system using COM objects.

Benifit:

Benifit of the DCOM was the location transparency of components. This allowed client software to be programmed in such a way that the physical location of the remote objects were not hard-coded. Regardless of whether the remote object was on the same machine or secondary networked machine, the code base could remain neutral, as the actual location was recorded externally in the system registry.

Limitation:

DCOM  was a Windows centric API. Even though DCOM was ported to a few other OS, DCOM alone did not provde a fabric to build comprehensive solution involving multiple OS(Windows,Unix, Mac) or promote sharing of data between diverse architectures (COM, J2EE, CORBA, etc)

COM+/Enterprise services:

COM+ was released by Microsoft. It's first name was Microsoft Transaction server (MTS). Despite its name, COM+ is not only used by COM programmers, it is also accessible to .Net programmers.

Features of COM+:

COM+ provides a number of features which are Transaction Management, object lifetime management, pooling services, a role based security system and a loosely coupled event model and so on.

Limitation:

COM+ has the same limitation of DCOM i.e. It is a windows only solution that is best suited for in-house application development or as a backend service indirectly manipulated by more agonistic front end.

.Net Remoting:

With the release of .Net plateform, DCOM quickly bacame a lagacy distributed API. In its place, the .Net base class libraries shipped with the .net remoting layer, represented by the System.Runtime.Remoting namespace. This namespace allows multiple computers to distribute objects, provided they are all running the application under the .net plateform.

Benifit:

.Net Remoting is usable only by .net application but it is possible to make use of .Net remoting to build distributed systems that span multiple OS.

Limitation:

Interoperability between other programming architectures (such as J2EE) was still not directly possible.

WEB Services:

From the history of the distributed API we can see that developing the distributed application which can run on multiple OS was not possible. They are all plateform and framework dependent.

XML web servies addressed this issue. So when you need to expose the services of remote objects to any OS and any programming model, XML web services provide the most straightforward way of doing so.

Benifit:

The benifit of the XML web services is interoperability and data exchange, because web service encodes its data as simple XML. Given the fact that web services are based on open industry standard (HTTP,XML,SOAP) rather than proprietary type systems and proprietary wire formats (as in case with DCOM or .net remoting), they allow for a high degree of interporability and data exchange.

Limitation:

Potential draw back of web services is the fact that they can suffer from some performance issues (given the use of HTTP and XML data representation), and they may not be suitable for in house application where TCP-based protocol and binary formatting of data could be used without penalty.

Role of WCF:

WCF is a distributed computing toolkit introduced with .net 3.0 that integrated these previous independent technologies into a streamlined API represented primarily via the System.ServiceModel namespace. WCF enables to expose services to callers using wide variety of techniques. For example, in an In-house application where all connected machines are windows based, you can make use of various TCP protocols to ensure the fastest possible performance. This same service can also be exposed using the XML web service-based protocol to allow external callers to leverage its functionality regardless of the programming language or OS.

WCF allows to pick the correct protocol for the job using a common programming model. Due to this it becomes easy to plug and play the underlying plumbing of your distributed application. In most cases, you can do so without being required to recompile or redeploy the client/service software.

In this POST I have attached a word file. In that file I developed a a simple service using the WCF. I developed that service from scratch, instead of using the WCF template. I hope that it will help in understanding of WCF.

WCF.doc (1.12 mb)

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , , , ,

C# | Visual Studio | WCF

RecentComments

Comment RSS

Most comments

supplynflshop supplynflshop
51 comments
tiffany-bracelets tiffany-bracelets
39 comments
AVI to iPad AVI to iPad
36 comments