Published on June 16, 2007
Windows Communication Foundation: Windows Communication Foundation Jason Mauer Microsoft Corporation November 10, 2005 Agenda: Agenda What is Windows Communication Foundation (WCF)? Anatomy Programming Model Features Demos (sprinkled throughout) What is Windows Communication Foundation?: What is Windows Communication Foundation? Messaging framework of WinFX WinFX = next generation Windows API Service-oriented programming model Managed API built with .NET Implements WS-I standards Formerly (and popularly :) known as 'Indigo' WCF Anatomy: WCF Anatomy Endpoint Service Channel Behavior WCF Anatomy: Endpoint: WCF Anatomy: Endpoint Basic unit of communication Represented by ServiceEndpoint class Made up of three components Address Binding Contract The ABCs of WCF: The ABCs of WCF Address Defines where the endpoint is Binding Defines how the endpoint communicates Contract Defines what the endpoint communicates The ABCs of WCF: The ABCs of WCF The ABCs of WCF: Address: The ABCs of WCF: Address Address components URI Identity Headers (optional) Headers differentiate endpoints with the same URI The ABCs of WCF: Binding: The ABCs of WCF: Binding Made up of binding elements that describe how the endpoint communicates Transport protocol TCP, HTTP, MSMQ, named pipes, etc Encoding text, Message Transmission Optimization Mechanism (MTOM), binary Security asymmetric, symmetric, transport Other aspects like message reliability Binding Example: Binding Example BasicProfileHttpBinding Name, namespace uniquely identify binding in service’s metadata HTTP transport, text encoding Predefined Bindings: Predefined Bindings Interoperable BasicHttpBinding – suitable for WS-Basic Profile Web services (including ASMX) WSHttpBinding – for non-duplex services WSDualHttpBinding – for duplex service contracts or communication through SOAP intermediaries Optimized NetTcpBinding – for cross-machine communication NetProfileNamedPipeBinding – for on-machine communication Message Queues NetMsmqBinding – for communication with WCF applications MsmqIntegrationBinding – for existing MSMQ applications The ABCs of WCF: Contract: The ABCs of WCF: Contract ContractDescription describes WCF contracts and their operations OperationDescription describes operation aspects One way, request/reply, etc MessageDescription objects describe messages that make up an operation Contract Definition: Contract Definition Attribute-based Data Contract definition Opt-in Supports interfaces and classes Independent of class access modifiers Backward compatibility for existing serialization definitions .NET Serialization XML Serialization WCF Anatomy: Services, Clients, and Channels: WCF Anatomy: Services, Clients, and Channels Service A program that exposes a collection of endpoints to communicate with the outside world Client A program that exchanges messages with one or more endpoints using channels Channel An abstraction of the connection between the client and an endpoint (and its associated messaging pipeline) Services and Channels: Separated at Birth: Services and Channels: Separated at Birth ServiceDescription ChannelDescription WCF Architecture: WCF Architecture Service Code Transport Transport WCF Anatomy: Behaviors: WCF Anatomy: Behaviors Augments runtime functionality of service/channel Throttling is one example Behaviors implemented through interfaces Services: IServiceBehavior Channels: IChannelBehavior Hosting WCF: Hosting WCF IIS Hosting HTTP only Windows Service Windows Activation Service (WAS) Vista/Longhorn Server feature Provides improved manageability Self Hosting ServiceHost class WCF Programming Model: WCF Programming Model Simple abstractions with full control under the surface Support for custom bindings, transports, encodings, etc Built on CLR type system Adorn types and methods with attributes Extensive support for configuration Make changes to services after deployment WCF Programming: SvcUtil.exe: WCF Programming: SvcUtil.exe Command-line utility to generate ServiceModel code and metadata Similar to wsdl.exe from .NET Framework WCF Features: WCF Features Security Reliable Messaging Queues Transactions Compatibility 'InfoCard' WCF Features: Security: WCF Features: Security Transfer Security Integrity – detecting message tampering Confidentiality – keeping messages private Authentication – verifying claimed identity Two modes of support Transport mode: uses transport-level protocol (like HTTPS); only point-to-point secure Message mode: uses WS-Security; less efficient but secure from end to end Standards support SOAP Message Security (OASIS) WS-Trust WS-SecureConversation WS-Federation WS-SecurityPolicy WCF Features: Security: WCF Features: Security Access Control Supports legacy CLR-based security PrincipalPermissionAttribute Provides an extensible claims-based authorization model Auditing Logging security-related events to Windows event log WCF Features: Reliable Messaging: WCF Features: Reliable Messaging Provides for SOAP messages what TCP provides for IP packets Ensures messages are exactly once Handles lost messages and duplicates Optional ordered delivery End-to-end reliability (vs. transport reliability of TCP) WCF Features: Queues: WCF Features: Queues Leverages Microsoft Message Queuing (MSMQ) as a transport Enables loosely coupled applications and disconnected operations WCF Features: Transactions: WCF Features: Transactions Takes advantage of System.Transactions in .NET 2.0 Supports WS-AtomicTransaction WCF Features: Compatibility: WCF Features: Compatibility COM+ Extend COM+ components as Web services Service derived from COM+ interface Surrogate support if more control over service contract is needed COM 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 WCF Features: “InfoCard”: WCF Features: 'InfoCard' MS implementation of an Open Identity Metasystem Users have portfolio of identities for different contexts Goal is consistency and interoperability between current and future methods of identification Built on WS-I standards WS-Trust WS-MetadataExchange WS-SecurityPolicy WCF Availability: WCF Availability WinFX Beta 1 available now For .NET Framework v2.0 Beta 2 WinFX Beta 2 coming soon Supports RTM of .NET Framework v2.0 WinFX RTM with Windows Vista also supported on XP and Server 2003 Other Goodies in WinFX : Other Goodies in WinFX Windows Presentation Foundation Graphics subsystem Vector-based, hardware accelerated Declarative programming model Windows Workflow Foundation Workflow engine Upcoming versions of BizTalk and SharePoint are built upon it Declarative programming model Resources: Resources MSDN WinFX SDK Library http://winfx.msdn.microsoft.com/library/ Windows Vista Developer Center http://msdn.microsoft.com/windowsvista/ Windows SDK Library http://windowssdk.msdn.microsoft.com/library/ WCF Team Blogs Don Box http://pluralsight.com/blogs/dbox/ Steve Maine http://hyperthink.net/blog/ Richard Turner http://blogs.msdn.com/richardt/ In Closing: In Closing Qandamp;A Reach me at [email protected] Thanks!