In Service oriented architecture there are two parties involved, Server and Client .Server and client communicate to each other via Messages. Message travels over the network. For communication; server and client must be agreed upon
- Format of message
- Encoding of the message etc.
Channels are the responsible component of WCF for
- Creation of consistent message
- Transport of consistent message.
- Conversion of Message in wire format
The main goal of Channel is to transform message to format understandable by the communication wire and compatible to both server and client and then transport the message over the wire in between client and server.
Essentially Channel has to decide about
- Protocol used in the message
- Encoding in the message
- Message is reliable or not
- Security of the message
- Transaction of the message
Mainly channel performs two different types of task and on basis of task channel is of two types,
Transport channels are responsible to send and receive the message using a transport protocol. WCF supports HTTP, TCP, and MSMQ, Peer to Peer and Named Piped transport protocols.
Protocol channels are responsible to implement and support security, transaction and reliable messaging. These channels transform and modify the message to make it compatible to wire level.
In a communication there may be one or more than one transport and protocol channels. Collections of different channels are called as Channel Stack.
Different channel performs different tasks. For example one protocol channel can secure the message whereas another protocol channel can make message reliable.
In WCF architecture, transport channel always resides at the bottom of channel stack. A usual channel stack can be depicted as below,
WCF provides us many readymade channel stacks to do communication between service and client. This WCF provided channel stacks are known as Binding. One channel layer is defined by one Binding Element.
You are very much allowed to create your own channel stack if all WCF provided bindings are not meeting your requirement.
Transport protocol of service and client communicates to each other.
Transport channel converts messages into bytes or binary to send over the network. Encoding of messages is also done by the transport channels.
I hope you are having basic idea about channel now. Thanks for reading
If you find my posts useful you may like to follow me on twitter http://twitter.com/debug_mode or may like Facebook page of my blog http://www.facebook.com/DebugMode.Net If you want to see post on a particular topic please do write on FB page or tweet me about that, I would love to help you.Follow @debug_mode