Today, we’re going to understand a new concept and for that matter, you must be familiar to Bollywood and movies like ‘Maine Pyar Kiya’ (MPK). You can say this as a pre-requisite.
In MPK, there was a situation, where hero and heroine were separated a distance apart. Then heroine used to send ‘Love Letters’ using pigeon postal service. And she used to sing a song for that matter – ‘Kabootar Ja Ja Ja’
Now, Windows Communication Foundation (WCF) is a unified programming model to build distributed applications. In our scenario, Sallu is providing his ‘best love’ services (pyar, daulat, shoharat, etc…) and Bhyagyashree is going to consume those.
Here hero and heroine are at two distant places and we call it as end-points. And, if they want to communicate, they must have ABCs i.e.
- A for Address on which she will send a letter, look at Sallu’s address
- B for Binding which defines how they communicate – here ‘OnAirBinding’ or Pigeon is used
- C for contract, the contract between Sallu and Bhagyashree says, if Bhagyashree wants Sallu to bestow all romantic poems, letters on her, she must send a love letter to him, kind of.
This scenario depicts the basic peer-to-peer communication in WCF (oops Bollywood movies). Here, in this mode of communication Salman is service provider and Bhagyashree is consumer, but sometimes situation can be other way round. And it’s very much possible.
In this new picture, what do you understand?
Well, WCF is not just about peer-to-peer applications. But can be used in many different applications as well. In this case Salman is a service provider (or publisher) and Aish, Kat and Bhyagyashree are service consumers (or subscribers). They are registered with Salman for his ‘best’ services.
But to provide these services, everyone needs to have ABCs.
- A – Address. Everyone will have a unique address for communication purpose
- B – Binding. Everyone will have their own mode of communication. In previous case it was Pigeon service, now it’s Email, Phone, Mobile and what not. WCF provides bindings like Http, TCP/IP, etc…
- C – Contract. All these actresses will have their own terms and conditions to work with Salman. And these terms and conditions will be put into contracts.
The main advantage of WCF is – it can communicate with any other technology. That means, WCF can communicate with .NET Managed based applications, Native applications, J2EE based applications.
To consume WCF services, client creates a proxy object of the service (mostly called as ‘ServiceClient’). In our scenario, all the gals will be having their own ‘personal copy’ of Salman Khan; however, original Salman is totally different. It’s like Salman will be having clones to enjoy himself with his girlfriends. Remember Dev Anand in ‘Teen Devian’? Nice idea, if we could implement in our world.
Probably, I’ll share some technical examples in next few posts. But, after this, you can see the how WCF works.
Mayur Tendulkar | www.mayurtendulkar.com