Today we will see a very important feature/part of the WCF called CHANNELS.
A CHANNEL IS THE CONDUIT through which all messages pass to and from WCF applications.
It is responsible for preparing and delivering messages in a consistent way.
Channels are defined for transports, protocols,and message interception.
Channels are layered together to create a CHANNEL STACK.
The goal of a channel stack is to transform a message into a wire format compatible with the sender and receiver and to transport the message.
There are two types of channels that are used to do this:
1) Transport channels
2) Protocol channels.
1) Transport Channels
Transport channels always sit at the bottom of the channel stack and are responsible for transporting messages using a transport protocol. WCF provides a number of transport protocols, including HTTP, TCP, MSMQ, peer-to-peer, and named pipes.
2) Protocol Channels
Protocol channels reside on top of transports or other protocol channels. Because protocol
channels reside on top of other channels, they are often referred to as layered channels. Protocol channels are responsible for implementing wire-level protocols by transforming and modifying messages. WCF provides many types of protocol channels. Examples include protocol channels that implement support for security, transactions, and reliable messaging.
How Channel Stack works??
The following diagram shows how a message flows from a WCF client application through a client-side channel stack over a given transport to a server
I) Role of Protocol Channels
a)At the top of the stack are the protocol channels.
b)Protocol channels interact with a message and facilitate security, reliable messaging, transactions, and logging features.
c)There can be any number of protocol channels in a channel stack, depending on the required features.
II) Role of Transport Channels
a) Transport channels are responsible for sending bytes over a transmission protocol such as TCP or HTTP.
b)They are also responsible for using an encoder to convert messages into an array of bytes for transport.
c)It is the job of an encoder to convert a message from its XML representation to an array of bytes. Encoders are exposed to the transport channel using binding elements.
d)Transport channels look in the binding context for an implementation of a MessageEncoder class. If none are available, the transport channel can specify a default message encoder.
We will go in depth with the Channel Shapes in coming post.