Channel is actually a bridge between a client and a service.
Messages can travel between clients and services through channels. There are four
main types of channels:
·
Simplex Input
·
Simplex Output
·
Request-Reply
·
Duplex
But how a channel can be created? The first time when a
message is going to be sent (only at this time) the client tries to create a
channel on a service endpoint (you will read about it later in the next
section) based on the type of channel that is required and an address. If the
service is listening on that address then a channel will be created. Here
there is a point: you do not have any channel until the first message is sent.
When communication between client and service ends, the channel will be
destroyed.
A channel is a queue of some features that make up its
properties, such as security, session or messaging pattern. There are different
types of each feature available, but you must choose a compatible combination
to be able to create a channel. Here I describe these features.
Each channel type supports one, two or all (three) messaging
patterns so you should be aware of channel characteristics to be able to use it
for your aims.
Different transports can be used in WCF. It is also
possible to write a new transport but HTTP, TCP and MSMQ are the most common
transports. These transports have some characteristics so you have to choose a
correct transport for your application. For example, some transports provide
better security features.
In addition to the security level that comes with transports,
you can use SOAP message security and its authentication or authorization and
other security mechanisms to improve security in your application.
It is possible to encode messages in a WCF application. You
can use pure text format or binary format to encode messages. There are some
built-in encoders, but you can write new encoders or extend them.
Reliable Sessions let you to have reliable messaging and it
helps you to keep communication alive whenever something is lost. Reliable
Sessions also let you to have sessions. Sessions keep states on services
during several actions.
Interoperability of a channel makes it possible to open
doors to other platforms and technologies. Four types of interoperability are
available in WCF. Basic Profile is very simple and you saw it in traditional
web services. .NET interoperability needs .NET on the client and service, but
provides some helpful features such as binary encoding. MSMQ interoperability
is a way to interoperate with other deployments of MSMQ. The fourth and last
interoperability that is very common is WS-*. This interoperability opens
doors for other platforms and can use WS-* protocols. These protocols provide
many important features such as security, transactional operations, reliability
and service.