Windows Communication Foundation is unified programming API, takes many existing communication technologies, such as Web Services, Windows Remoting, Microsoft Message Queuing, and abstracts them into a single technology. In most cases, this simplifies the way you communicate with other applications. It also allows you to communicate with other applications without being coupled to a specific technology. Therefore, you could use Web Services over SOAP to begin with, and later move to remote procedure calls (RPC) without changing your code, just the configuration of WCF.
There are a few basic tasks when creating a WCF service. The basic tasks that must be performed are, in order:
- Define the service contract. A service contract specifies the signature of a service, the data it exchanges, and other contractually required data.
- Implement the contract. To implement a service contract, create the class that implements the contract and specify some custom behaviors that the runtime should have.
- Configure the service by specifying endpoint information and other behavior information.
- Host the service in an application.
- Build a client application.
For more information, see http://msdn2.microsoft.com/en-us/library/ms732098.aspx
Here is a quick overview to share with you all, Taken From an interesting article by David Ong on GeekWithBlogs.net
Credit & Courtesy goes to David Ong and Geekwithblogs.net
WCF programs are basically divided into 3 different types of programs. They are common known as
Clients are program that consumes the services, they are normally the ones that initiate the messenging to the service. Depending on the designed architecture of your application, it is possible that a service behaves as a client as well.
Services are the programs that offers the services to the consumers. They are the ones that react and process the messages, similar to the backend of the application. They can be viewed as the equivalence of web services in .Net 2.0.All services have to have endpoints specified in order to work. A good way to remember proper endpoint configurations is ABC. A being Address, B being Binding and C being Contracts.
Address are the expose points of services. Services have to tell the world that where they are via addresses.
Bindings will describe to the world on how they will communicate with the world. They contain information such as transport way, how they are encoded, are they reliable etc.
- Contracts are of (but not necessary all have to be present) 3 different kinds
- Service Contract
Describes what the service does.
- Data Contract
Define custom messaging structure.
- Message Contract
Define the message format that is passed between services.
Intermediaries are programs that act as “middle-man”, their basic roles can be similar to providing a firewall, routing, gateway etc. They are commonly invisible to the client and services.
All services and clients communicate via messages, which are made up of one body, and one or more header. All WCF messages are XML formatted and transport neutral. In other words, you can specify different forms of transport (HTTP, MSMQ, Named Pipes etc) for different messages. Within each application, you can specify different messaging transport depending on the communication needs of the system. Basically, messages can be divided into
One way messaging. Simplex in short means “fire and forget”
Asynchronous two-way messaging. In short this means that once fired, the application will carry on doing its own thing. Upon the return results, it will then handle it.
- Request Reply
Synchronous 2 way messaging. This is the common communicate method whereby you’ll fire a request, and wait for the response before continuing.
Before a client and service can talk to each other, they have to go through a channel. Imagine a channel as a pipe, with one end being the input message and the other end with the results of the message. There’re different channels that can be stacked onto each other, they are commonly known as Channel Stacks. They can be of these different types:
- Reliable Sessions
- TCP Transport
- Binary Message Encoder
- Windows Security
- Request Reply
The way in which messages are sent through the pipe (Channel) is known as a Transport and they way at which they are encoded are known as Encodings. Transport can be made up of the following:
- Named Pipes
I hope this quick overview was helpful to you. I am just refreshing my knowledge on WCF, forgot most of it. It’s been an year i touched it, so interview purpose refreshing it again..
Please share your related informations as comments in this post..