Wednesday, October 3, 2007

Windows Communication Foundation

WCF









Introduction

Windows Communication Foundation (WCF) is Microsoft's unified programming model for building service-oriented applications. It enables developers to build secure, reliable, transacted solutions that interoperate with applications in different platforms.

Interoperability is the fundamental characteristic of WCF. The fundamental communication mechanism is based on Web Services specifications such as SOAP, XML, XSD, WSDL and newly established standards including the WS-* protocols. These specifications address several areas, including basic messaging, security, reliability, transactions, and working with a service's metadata.

WCF relies on WS-Policy and WS-Metadata Exchange to discover information about the communications partners. Reliable communication is essential for most situations (no duplicates messages), and WS-Reliable Messaging would be used to interact with many of the other applications in this scenario. WS-Security and the related specifications might also be used for establishing a secure channel. The specifications support the main security services such as authentication, integrity and confidentiality. WS-Atomic Transaction is very important for managing transactional context involving several transactional resources.

The key point is that WCF implements interoperable Web services, complete with cross-platform security, reliability, transactions, and other services. It also is transport neutral, protocol neutral, and format neutral. For example, services are free to make use of HTTP, TCP, named pipes, and any other transport mechanisms for which there is an implementation. It is possible the WCF-to-WCF communication to be optimized, but all other communication uses standard Web services protocols.

The architecture

The architecture is based on layers.

~ Contracts

~ Service Runtime

~ Messaging

~ Activation and Hosting

Contracts

Contracts define various aspects of the message system. The data contract describes how every business object to be on the wire is going to be persisted using XML. The message contract defines specific message parts (header and body) using SOAP protocols, and allows finer-grained control over parts of the message. The service contract specifies the actual method signatures of the service. The policy and binding contracts enable you to specify transport, security details, and other aspects that must be met in order to communicate with a service.

Service Runtime

The service runtime manages the execution of services. It is possible to be specified the run-time behaviors through attributes or configuration settings. For example, a service can indicate that its instances are not thread-safe. Throttling behavior allows you to put limits on the number of connections, sessions, and threads. Error handling behaviors control how errors are handled and reported to clients. Metadata behavior governs how and whether metadata is made available to the outside world. Transaction behavior enables the rollback of transacted operations if a failure occurs. Dispatch behavior is the control of how a message is processed by the WCF infrastructure. Parameter filtering allows preset actions to occur based on filters acting on message headers.

Messaging

The messaging layer illustrates the possible formats and exchange patterns of the data. WS Security channel is an implementation of the WS-Security specification enabling security at the message layer. The WS Reliable Messaging channel enables the guarantee of message delivery. The encoders present a variety of encodings that can be used to suit the needs of the message. The HTTP channel specifies that the HyperText Transport Protocol is used for message delivery. The TCP channel similarly specifies the TCP protocol. The Transaction Flow channel governs transacted message patterns. The Named Pipe channel enables inter-process communication. The MSMQ channel enables interoperation with MSMQ applications.

Activation and Hosting

The specific method by which a service is started is determined by its activation options. And services can be either self-hosted or hosted in the context of another application. The Windows Activation Service (WAS) enables WCF applications to be activated automatically when deployed on a computer running the WAS. Services can also be manually run as executables (.EXE files). A service can also be run automatically as a Windows service. And a service can also be run as a COM+ application.

No comments: