point
Menu
Magazines
Browse by year:
Distributed applications using windows communication foundations (WCF)
Hariharan Rajaram
Wednesday, October 31, 2007
Services play a major role in the modern software architecture and WCF (Windows Communication Foundation) provides a platform for building services by enabling interoperability with services and interfaces from various platforms. WCF supports all major transports like TCP/IP, HTTP, MSMQ, named pipes and protocols such as WS-Security and WS-Addressing, (WS-*). Currently WCF supports SOAP and POX messages. Many products like BizTalk Server and Windows Live Server are fully embracing WCF.

Conceptually, WCF is a set of assemblies that allows developers to quickly write Service-Oriented applications. Designing, building, maintaining, and versioning-distributed application are complex in nature and WCF is designed to solve these complex issues.

Characteristics of WCF
Independent versioning
All distributed services must adhere to versioning in order to have unique identity.

Asynchronous forward-only messaging
Most of the applications follow request a reply method calls. In such scenarios, once a request is placed, the client needs to wait until the server responds to the request. In order to overcome this limitation WCF allows asynchronous forward-only calls. Asynchronous forward-only messaging allows efficient handling of processing power and delivers reliable messaging.

Platform consolidation
Before WCF, Microsoft provided five sets of technologies for distributed applications, namely RPC, WSE, ASMX, Remoting, MSMQ, and COM+. WCF consolidated these five technologies into one unified platform.

Security
WCF supports different security models to create a secure service. Since, WCF is extensible in nature; one can also extend the WCF security to meet custom business needs. By default, WCF Security ranges from the traditional transport-centric to the more modern message based security.

Reliability
WCF reliable mechanism supports major assurance terms such as At Most Once (A message is guaranteed to arrive at the receiver’s end no more than one time.), At Least Once (A message is guaranteed to arrive at the receiver’s end at least one time.), Exactly Once (The combination of At Most Once and At Least Once, which guarantees that the message arrives once at the receiver’s end.), and In Order Delivery (The In Order Delivery guarantees that the messages that are sent in an order are received at the receiver’s end in the same order) assurances. These assurances are supported by WCF with little or no modification to the application.

Transactional support
A transaction is a way of ensuring that all or none of the work is done. WCF allows transaction to span across multiple applications.

Interoperability
One of the major roles of WCF is to interoperate with other systems and applications that are running on different operating systems and platforms. WCF communicates with other applications which understand WS-*, Basic Profile (BP), and XML messages through TCP, HTTP, MSMQ and named pipes. WCF also allows custom extensions like binary message encodings to communicate with legacy mainframe applications.

Performance
WCF provides different levels of interoperability and performance accordingly. By default, WCF applications can communicate more efficiently with other WCF applications than when they are communicating with Java based applications.

Extensibility
WCF is extremely extensible in design. WCF is designed in such a way that it will work with custom transports, channels, bindings, encodings, and architectural paradigms.

Configurability
Like other .NET applications, WCF also supports rich configuration through XML configuration. Using the WCF configuration one can configure transport, addresses, behaviors, bind, etc.

Service-Orientation is an architectural style of loosely coupling distributed application components using messages and contracts. Every service oriented design follows four principles (also called tenets) namely:

Explicit boundaries
In Service Oriented architecture, services usually interact with other services through well defined, clearly stated, and accessible point of boundaries unlike in Object-Oriented applications.

Service autonomy
In Service Oriented Architecture pure autonomy is impossible, but at the same time, some amount of autonomy is desired. A truly autonomous service is the one, which dynamically creates communication channels, dynamically negotiates security policy, dynamically interrogates message schemas, and dynamically exchanges messages with other services. In practical scenarios, no service has control of the boundaries, availability or lifetime of other services.

Contract sharing
Contracts came into picture when COM and DCOM evolved. In Service Oriented Architecture, the focus is on messages that are passed between participants. The methods of describing the messages are called contracts. Service Oriented contracts are expressed using XSD and WSDL. XSD Schemas are used to describe the message structures whereas WSDL is used to describe message endpoints.

Policy compatibility
Before accessing a Service, one should be able to know the circumstances under which the other Services can interact with a Service. These circumstances are described in the policy of the services. The policy of a service is defined in the design of the service itself. The policies are like credentials or certificates, etc. that are required to access a particular service.

In summary, WCF is a framework that exposes a consistent object model to develop services.

A business example
Let us consider a practical scenario where the use of WCF benefits the business. In any travel organization, a ticket booking system has multiple faces. One can book tickets using the web site of the travel organization or by calling the customer support services or by visiting the booking counters. These processes differ from one another. The following figure shows the high-level business system model.

If the organization decides to add new means of booking tickets like SMS system or Agent System, the present application business logic needs to be rewritten to accommodate these changes, which involve cost and effort. In order to minimize the cost and effort while introducing new modes of reservation, the travel organization introduced service oriented architecture in the above application. The diagram below depicts a more generalized service oriented system that can scale up to new needs with minimized cost and effort as the business grows.

The author is, Lead – Development, Ness India. He can be reached at hariharan.rajaram@in.ness.com
Twitter
Share on LinkedIn
facebook