You are previewing Inside Windows® Communication Foundation.
O'Reilly logo
Inside Windows® Communication Foundation

Book Description

Dive deep into the operation of Windows Communication Foundation with this practical, hands-on book—and learn the intricacies of Windows Communication Foundation and service-oriented concepts and implementations. Fundamentally, services are not objects. Given the prevalence of the object-oriented paradigm over the past 20 years, experienced developers need to explore a new way of thinking about architecting solutions. Concise and practical, this guide explains the fundamentals of applications built with a service-oriented architecture and how the international standards for Web services are implemented in Windows Communication Foundation. Each chapter includes at least two practical code samples in Visual C#.

Table of Contents

  1. Inside Microsoft Windows® Communication Foundation
  2. Dedication
  3. A Note Regarding Supplemental Files
  4. Acknowledgments
  5. Introduction
    1. Who This Book Is For
    2. How This Book Is Organized
    3. Code Samples and System Requirements
    4. Questions and Comments
  6. I. Introduction to WCF
    1. 1. The Moon Is Blue
      1. The Universal Requirement
      2. The Universal Concept
      3. The Business Example
      4. Introducing Windows Communication Foundation (WCF)
        1. Not Just Another API
        2. WCF from 10,000 Feet
          1. Beneath It All: Windows
          2. Helpful Products: The Windows Server System
          3. The Development Platform: The Microsoft .NET Framework
          4. The Distributed Platform: WCF
          5. Putting It All Together
        3. WCF Features
          1. Independent Versioning
          2. Asynchronous One-Way Messaging
          3. Platform Consolidation
          4. Security
          5. Reliability
          6. Transactional Support
          7. Interoperability
          8. Performance
          9. Extensibility
          10. Configurability
      5. Summary
    2. 2. Service Orientation
      1. A Quick Definition of Service Orientation
      2. Getting the Message
      3. Messaging Participants
        1. The Initial Sender
        2. Intermediaries
        3. The Ultimate Receiver
      4. The Anatomy of a Message
        1. Envelope
        2. Header
        3. Body
      5. Message Transports
      6. Message Encodings
        1. The XML Infoset
        2. SOAP and the XML Infoset
        3. The Text Encoder
        4. The Binary Encoder
        5. The MTOM Encoder
        6. Choosing the Right Encoding
      7. Addressing the Message
        1. In-Transport Addressing vs. In-Message Addressing
        2. Specifying the Ultimate Receiver
        3. Specifying the Initial Sender
        4. Specifying Where to Send an Error
        5. Identifying a Message
        6. Relating Messages to Other Messages
        7. Who Is Listening for a Response?
        8. Specifying an Operation
        9. The Need for Standard Header Blocks
      8. WS-Addressing
        1. Endpoint References
        2. Message Information Headers
        3. Message Information Header Block Dependencies
      9. The Four Tenets of Service Orientation
        1. Explicit Boundaries
        2. Service Autonomy (Sort Of)
        3. Contract Sharing
        4. Compatibility Based on Policy
      10. Putting It All Together
        1. The Contract
      11. Why SO Makes Sense
        1. Versioning
        2. Load Balancing
        3. Platform Changes over Time
        4. Content-Based Routing
        5. End-to-End Security
        6. Interoperability
      12. Summary
    3. 3. Message Exchange Patterns, Topologies, and Choreographies
      1. Message Exchange Patterns
        1. The Datagram MEP
          1. Datagrams and WSDL
          2. Datagrams and WCF Contracts
          3. Error Handling Considerations
          4. HTTP and the Datagram MEP
        2. The Request/Reply MEP
          1. Request/Reply and WSDL
          2. Request/Reply and WCF Contracts
          3. Transport Considerations
        3. The Duplex MEP
          1. The Duplex MEP and WSDL
          2. The Duplex MEP and WCF Contracts
      2. Message Topologies
        1. Point-to-Point
        2. Forward-Only Point-to-Point
        3. Brokered
        4. Peer-to-Peer
      3. Message Choreographies
      4. Summary
    4. 4. WCF 101
      1. WCF Quick Start
        1. Defining the Service Contract
        2. Defining the Address and the Binding
        3. Creating an Endpoint and Starting to Listen
        4. Mapping Received Messages to a HelloWCF Member
        5. Compiling, Running, and Verifying the Receiver
        6. Sending a Message to the Receiver
        7. Compiling, Running, and Verifying the Sender
        8. Looking at the Message
        9. A Slight Change with a Major Impact
        10. Exposing Metadata
        11. Consuming Metadata
          1. Generating the Proxy with Svcutil.exe
          2. Coding HelloWCFSender with Svcutil.exe-Generated Types
      2. WCF Gross Anatomy from the Outside
        1. The Address
        2. The Binding
        3. The Contract
          1. Service Contracts
          2. Data Contracts
          3. Message Contracts
      3. WCF Gross Anatomy from the Inside
      4. Summary
  7. II. WCF in the Channel Layer
    1. 5. Messages
      1. Introduction to the Message Type
      2. The WCF XML Stack
        1. The XmlDictionary Type
        2. The XmlDictionaryWriter Type
          1. Creating an XmlDictionaryWriter Object
          2. The Write Methods
          3. Writing with an XmlDictionary
        3. The XmlDictionaryReader Type
          1. Creating an XmlDictionaryReader Object
          2. Round-Tripping XML with an XmlDictionary
      3. Back to the Message
      4. Creating a Message
        1. A Word about Message Serialization and Deserialization
        2. Message Versions
        3. Serializing an Object Graph
        4. Pulling Data from a Reader
        5. Pushing Data into a Message with a BodyWriter
        6. Messages and SOAP Faults
          1. SOAP Fault Anatomy
          2. The MessageFault Type
      5. Buffered vs. Streamed Messages
      6. Serializing a Message
      7. Deserializing a Message
        1. Checking Whether a Message Is a SOAP Fault
      8. Message State
      9. Working with Headers
        1. The MessageHeader Type
          1. Creating a MessageHeader Object
          2. Serializing a MessageHeader Object
          3. WS-Addressing Endpoint References
          4. MessageHeader Miscellany
        2. The MessageHeaders Type
          1. Creating a MessageHeaders Object
          2. Adding a MessageHeader
          3. Getting the Value of a MessageHeader
          4. Copying a MessageHeaders Object
          5. Serializing a MessageHeaders Object
          6. WS-Addressing and the MessageHeaders Type
        3. The EndpointAddress Type
          1. The AddressHeader Type
          2. Serializing an EndpointAddress Object
      10. Copying Messages
      11. Message Cleanup
      12. Summary
    2. 6. Channels
      1. Channels in Perspective
        1. Instantiating a Channel
      2. The Channel State Machine
        1. The ICommunicationObject Interface
        2. The CommunicationObject Type
        3. CommunicationObject-Derived Types
        4. The Open and BeginOpen Methods
          1. CommunicationObject: Check Whether State Transition to Open Is Permissible
          2. CommunicationObject: If So, Transition State to Opening
          3. MyCommunicationObject: OnOpening Virtual Method Invoked
          4. CommunicationObject: Opening Event Raised, Delegates Invoked
          5. MyCommunicationObject: OnOpen Virtual Method Invoked
          6. MyCommunicationObject: OnOpened Virtual Method Invoked
          7. CommunicationObject: State Transitions to Opened
          8. CommunicationObject: Opened Event Raised, Delegates Invoked
        5. The Close and Abort Methods
        6. The Fault Method
        7. About CommunicationObject Stacks
      3. Introduction to Channel Shape
      4. Channel Interfaces and Base Types
        1. The IChannel Interface
        2. Datagram Channels: IInputChannel and IOutputChannel
          1. Sending: IOutputChannel
          2. Receiving: IInputChannel
        3. Request/Reply Channels: IRequestChannel and IReplyChannel
          1. Sending: IRequestChannel
          2. Receiving: IReplyChannel
          3. Request/Reply Correlation: The RequestContext Type
        4. Duplex Channels: IDuplexChannel
          1. Sending and Receiving: IDuplexChannel
        5. The IDefaultCommunicationTimeouts Interface
        6. The ChannelBase Type
      5. Channel Flavors
        1. Transport Channels
        2. Protocol Channels
        3. Shaping Channels
      6. Creating a Custom Channel
        1. Creating the Base Type
          1. Adding the Constructor
          2. Adding the Channel State Machine
        2. Creating the Datagram Channels
        3. The Datagram Receiving Channel
        4. The Datagram Sending Channel
        5. The Duplex Channel
        6. The Duplex Session Channel
      7. Summary
    3. 7. Channel Managers
      1. The Concept of a Channel Manager
      2. The Receiver: Channel Listeners
        1. The IChannelListener Interface
        2. The IChannelListener<TChannel> Interface
        3. The ChannelListenerBase Type
        4. The ChannelListenerBase<TChannel> Type
        5. Building a Custom Channel Listener
      3. The Sender: Channel Factories
        1. The IChannelFactory Interface
        2. The IChannelFactory<TChannel> Interface
        3. The ChannelFactoryBase Type
        4. The ChannelFactoryBase<TChannel> Type
        5. Building a Custom Channel Factory
      4. Summary
  8. III. WCF in the ServiceModel Layer
    1. 8. Bindings
      1. The Binding Object Model
        1. Binding Constructors
        2. Binding Test Methods
        3. Binding Factory Methods
          1. Specifying the Listening Address
        4. The GetProperty<T> Method
        5. The MessageVersion Property
        6. The Scheme Property
        7. The CreateBindingElements Method
      2. The BindingElement Type
        1. Binding Element Constructors and the Clone Method
        2. BindingElement Test Methods
        3. BindingElement Query Mechanism
        4. BindingElement Factory Methods
      3. The TransportBindingElement Type
      4. The BindingContext Type
        1. BindingContext Factory Methods
      5. Using a Binding
      6. Creating Custom Bindings
      7. Summary
    2. 9. Contracts
      1. Contracts Defined
      2. WCF Contract Gross Anatomy
        1. Service Contracts
          1. The ProtectionLevel Property
          2. The SessionMode Property
        2. Operations in a Service Contract
          1. The AsyncPattern Property
          2. The ProtectionLevel Property
          3. The IsOneWay Property
          4. The IsInitiating and IsTerminating Properties
          5. The Name, Action, and ReplyAction Properties
        3. Operation Method Arguments
        4. Mapping a Service Contract to a Service Object
        5. Data Contracts
          1. The DataContractAttribute Type
          2. The DataMemberAttribute Type
        6. Message Contracts
        7. Operation Compatibility
        8. My Philosophy on Contracts
          1. Avoid Defining Methods in Data Contracts and Message Contracts
          2. Seal Contracts
          3. Use Nullable Types
      3. From Contract Definition to Contract Object
      4. Summary
    3. 10. Dispatchers and Clients
      1. Questions to Ask Yourself
      2. The Dispatcher
        1. ChannelDispatcher Anatomy
          1. CommunicationObject Members
          2. The ServiceThrottle Property
          3. The ManualAddressing Property
          4. The ErrorHandlers Collection
          5. The Endpoints Property
        2. EndpointDispatcher Anatomy
          1. Filters
        3. The DispatchRuntime Type
          1. The InstanceContext Related Types
          2. The MessageInspectors Property
          3. The OperationSelector Property
          4. The DispatchOperation Collection
        4. The DispatchOperation Type
        5. The ServiceHost Type
      3. The Client
      4. Summary
  9. Index
  10. About the Author
  11. Copyright