In today's business world, an organization consists of so many applications in different sizes with different platforms. These applications may be in the form of Object Oriented, Component Based or Service Oriented. One way or the other it is mandatory that these application needs to be communicated to share the data. The ability to share data between a wide network of services that can communicate with other platforms and devices is what Web services are all about.
Windows Communication Foundation (WCF) is Microsoft's unified programming model for building Web service applications with managed code. The following section of this paper will explain the overview of WCF.
The vast variety of applications that are developed today need to communicate with each other. These kind of distributed applications are developed in various technology stacks like .NET Remoting, ASMX, Enterprise Services, System.Messaging and WSE etc. Each technology has its own power advantages.
For e.g. with MSMQ, the application can have a powerful mechanism for scalable, durable and volatile queued messaging that takes care of getting data reliability from one place to next.
Enterprise Services provide transaction integration across multiple parties performing related work in a distributed environment allows throttling access to limited shared resources.
. NET Remoting provides the integrated mechanism for communicating with objects across application domain boundaries in a very flexible and extensibility model.
Windows Communication Foundation is built from the ground-up to combine and extend the capabilities of these existing Microsoft distributed system technologies, including Enterprise Services, System.Messaging, .NET Remoting, ASMX and WSE to deliver a unified development experience. It extends .NET Framework 2.0 and enables the developers to build secure, next-generation Windows based applications. Developers can now focus on business logic and the leave the underlying plumbing to Windows Communication Foundation.
This new set of model is introduced as “WinFX” (Windows Framework) in Microsoft’s Windows next Version.
WinFX is the new programming interface introduced in Windows “Vista”. It is the new set of managed code API that Microsoft releases with Vista. It is a unified, managed-code programming model that extends the .NET Framework 2.0 and enables you to build secure, next-generation, Windows-based applications.
WinFX consists of three fundamental frameworks. They are
- Windows Presentation Foundation (WPF)
- Windows Communication Foundation (WCF) and
- Windows Workflow Foundation (WWF)
WPF (formally known as “Avalon”) is a new user interface subsystem and API based on XML, .NET and vector graphics.
WCF (formally known as “Indigo”) is service-oriented messaging system, which allows programs to interoperate locally or remotely similar to web services. It is the Messaging framework of WinFX.
WWF allows task automation and integrated transactions using workflows. This paper targets only WCF.
WinFX is intended to give programmers easier access to the functionality present in the Windows API.
Windows Communication Foundation (WCF)
Windows Communication Foundation is designed as a logical next version of today’s distributed systems technologies. It is Microsoft’s unified framework for building and running service-oriented applications using managed code. It provides new set of Windows API and Service-Oriented programming model. It implements WS-I standards.
The anatomy of WCF will be explained in the following section.
WCF comprised of the following 4 core components. They are Endpoint, Service, Channel, and Behavior. The basic overview is shown in the following figure.
Fig: Windows Communication Foundation (WCF) Anatomy
Endpoint is the basic unit of WCF communication. Endpoint made up of 3 components. They are Address, Binding and Contract. Each of which is explained below.
It defines where the endpoint is. This is equivalent to service address in WSDL. Various Address components are URI, Identity & Headers.
Defines how the endpoint communicates. It is made up of various binding elements like Transport protocol (TCP, HTTP, MSMQ, named pipes etc), Encoding (text, Message Transmission Optimization Mechanism (MTOM)), binary), security (asymmetric, symmetric and transport) and other aspects like message reliability. This is equivalent to bindings in WSDL.
Defines what the endpoint communicates. This is equivalent to portType in WSDL. It describes the WCF contracts and their operations. It defines the various operations like One way, request/reply, duplex, queuing etc.,
A program that exposes a collection of endpoints to communicate with outside the world.
A program that exchanges messages with one or more endpoints using channels.
An abstraction of the connection between the client and an endpoint.
Windows Communication Foundation (WCF) features
Facilitates interoperability through WS-* standards
WS-Trust. Uses the secure messaging mechanisms of WS-Security
Confidentiality – keeping messages private
Authentication – verifying claimed identity
Uses transport-level protocol (like HTTPS); only point-to-point secure
Uses WS-Security; less efficient but secure from end to end
SOAP Message Security (OASIS)
Provides for SOAP messages what TCP provides for IP packets
Ensures messages are exactly once
Handles lost messages and duplicates
End-to-end reliability (vs. transport reliability of TCP)
- Moniker support (GetObject) for usage of WCF services from COM-based applications
Web Services Enhancements (WSE) 3.0
.NET v1.x WS-I support add-on library
Windows Communication Foundation (WCF, previously codenamed “Indigo”) is Microsoft’s unified framework for building and running service-oriented applications using managed code. It enables developers to build secure, reliable, transacted solutions that integrate across platforms and interoperate with existing investments.
This enables developers to compose distributed applications using the best features of each of today’s stacks and maximizes developer productivity through a rich, intuitive attribute-based programming model.