Improve Your Technology

Just another blog for techology

Introduction to Windows Communication Foundation

By  John Charles Olamendy November 07, 2006

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. See on Figure 1.

wcf11

Figure 1.

This architecture permits programmers to work at several levels. High-level programming leverages the service runtime and doesn’t require developers to directly work with messages at all, unless they want to. At the other end of the spectrum, developers can program to the messaging layer and take charge of communication activities.

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.

Services from the Outside.

From the outside, a service is collection of endpoints and a service description. The description is the information necessary for interchange messages with the service. It is used WSDL, XML Schemas, WS-Policy (description of non-functional requirements such as security mechanisms, schedules availability, and quality of service), WS-Metadata Exchange (WS-MEX) for asking the service to describe itself.

The endpoint is a basic unit of communication in Windows Communication Foundation (WCF). It is the physical port. You interchange messages with a service through the endpoints. Each endpoint is made up of three elements: an address, a binding, and a contract. The endpoint’s ABC, A stands for address, B stands for binding and C stands for contract.

The address is basically a URI. The format of the address is scheme://myservice.mydomain.com:port/path. For example for accessing a service using http protocol you must write the following address down http://myservice.mydomain.com:8080/myservice/financialservice.svc, or for accessing a service using tcp protocol by the port 2525 you must write the following address down

net.tcp://myservice.mydomain.com:2525/myservice/financialservice.svc.

 
The binding describes how a service communicates with the partners. It is a collection of details such as transport method, encoding format, reliability requirements, and security requirements. WCF creates a channel stack to satisfy the using binding.

The contract is a collection of operations that specifies what the endpoint communicates to the outside world. Each operation is a simple message exchange, for example a request message and an associated reply message that form a request/reply message exchange.

Conclusion.

This paper is intended to present the fundamental concepts of Windows Communication Foundation as the new programming model for service-oriented development. WCF implements new specifications adopted in standardization organizations such as OASIS, W3C, etc. And it is a good object model that really represents the concepts of the Service-Oriented Architecture.

Advertisements

January 4, 2009 - Posted by | Introduction to WCF, Technology | ,

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: