Wednesday, February 17, 2010

Notes on Programming WCF - Part II - Bindings, Enpoints, MetaDataExchange


Excerpts on a great WCF book: "Programming WCF Services- by Juval Lowy"

Bindings:
WCF defines six frequently used bindings:
1- Basic binding Offered by
1- BasicHttpBinding class
2- Exposes a WCF as legacy ASMX web service
2- TCP binding offered by
1- NetTcpBinding class for
2- cross machine communication on Intranet
3- optimized for WCF-to-WCF
3- IPC binding offered by
1- NetNamedPipeBinding class
2- It uses named pipe as transport for
3- same- machine communication
4- Fastest binding since lighter than TCP
4- Web Service (WS) binding offered by
1- WSHttpBinding
2- Uses HTTP, HTTPS
3- Uses WS-* standards
5- Dual WS Binding offered by
1- WSDualHTTPBinding
2- Bidirectional Duplex
6- MSMQ binding offered by
1- NetMsmqBinding class


Table 1-1. Transport and encoding for standard bindings
Name
Transport
Encoding
Interoperable
BasicHttpBinding
HTTP/HTTPS
Text, MTOM
Yes
NetTcpBinding
TCP
Binary
No
NetPeerTcpBinding
P2P
Binary
No
NetNamedPipeBinding
IPC
Binary
No
WSHttpBinding
HTTP/HTTPS
Text, MTOM
Yes
WSFederationHttpBinding
HTTP/HTTPS
Text, MTOM
Yes
WSDualHttpBinding
HTTP
Text, MTOM
Yes
NetMsmqBinding
MSMQ
Binary
No
MsmqIntegrationBinding
MSMQ
Binary
Yes


Endpoints:
Every service is associated with an address that defines where the service is, a binding that defines how to communicate with the service, and a contract that defines what the service does. This triumvirate governing the service is easy to remember as the ABC of the service. WCF formalizes this relationship in the form of an endpoint.
Endpoint is the ABC of a service
1. Address
2. Binding
1. Binding Configuration
3. Contract
Metadata Exchange
By default, the service will not publish its metadata. However, this does not preclude clients that have obtained the metadata via some other mechanism from invoking operations on the service. A service that does not publish metadata is the WCF analogy to an internal class in .NET.
There are two options for publishing a service's metadata: you can provide the metadata over HTTP-GET, a simple text-based protocol that most platforms support, or you can use a dedicated endpoint.
1- Create WSDL
2- Publish service’s Metadata
i. HTTP-GET : This need the service to have http address
This is enabled through service behavior configuration:
behaviorConfiguration = "MEXGET">
ii. Metadata Exchange Endpoint

No comments:

Post a Comment