You are previewing Microsoft Windows Communication Foundation 4.0 Cookbook for Developing SOA Applications.
O'Reilly logo
Microsoft Windows Communication Foundation 4.0 Cookbook for Developing SOA Applications

Book Description

Over 85 easy recipes for managing communication between applications

  • Master WCF concepts and implement them in real-world environments

  • An example-packed guide with clear explanations and screenshots to enable communication between applications and services and make robust SOA applications

  • Resolve frequently encountered issues effectively with simple and handy recipes

  • Explore the new features of the latest .NET 4.0 framework/Visual Studio 2010

  • In Detail

    The Windows Communication Foundation 4.0 (WCF 4.0) is a .NET-based application programming interface for building and running connected systems. It enables secure and reliable communication among systems within an organization or across the Internet. This book deals with the difficult issues faced by a .NET developer while working with WCF.

    WCF 4.0 is a communications infrastructure that unifies a broad array of distributed systems' capabilities in a composable, extensible architecture that supports multiple transports, messaging patterns, encodings, network topologies, and hosting models. This book is a collection of focused real-world recipes and covers basic recipes on topics such as working with contracts to more advanced topics such as extending WCF runtime. By the end of this book you will have valuable information that helps transform the potentially unproductive habits of .Net developers who work with WCF.

    This book will take you through many concepts starting with complete support for contract-related design for WCF service development. You will learn to use WCF's built-in feature for building various service endpoints. Service hosting and configuration are important areas for building WCF services, especially at the service deployment stage, and are detailed in this book. You will find it easy to work with WCF client proxy generation and metadata publishing and discovery when you go through recipes such as customizing auto-generated service proxies.

    The author then discusses the exchange of data in WCF service operation features, related to WCF data serialization. You will discover some useful tips for security in WCF service development and built-in features for developing concurrency control for your services built upon it.

    One big plus is that you will learn to extend the existing WCF framework to achieve advanced functionality. You will find a dedicated chapter for RESTful and AJAX-enabled service development. Moving on, you will find several useful WCF service interoperability cases, which are important for a distributed service development platform. Towards the end of this book you will find some handy and useful diagnostic methods for troubleshooting.

    Extend and secure the WCF framework and develop robust SOA applications with ease

    Table of Contents

    1. Microsoft Windows Communication Foundation 4.0 Cookbook for Developing SOA Applications
      1. Microsoft Windows Communication Foundation 4.0 Cookbook for Developing SOA Applications
      2. Credits
      3. Foreword
      4. About the Author
      5. About the Reviewers
      6. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Conventions
        5. Reader feedback
        6. Customer support
          1. Errata
          2. Piracy
          3. Questions
      7. 1. Working with Contracts
        1. Introduction
        2. Defining a one-way Contract
          1. How to do it...
            1. How it works...
            2. There's more...
            3. See also
        3. Make DataContract forward-compatible
          1. How to do it...
          2. How it works...
          3. There's more...
          4. See also
        4. Generate DataContract from an XML Schema
          1. Getting ready
          2. How to do it...
            1. How it works...
            2. There's more...
            3. See also
        5. Using XMLSerializer to control message serialization
          1. How to do it...
            1. How it works...
            2. See also
        6. Using MessageContract to control theSOAP message
          1. How to do it...
          2. How it works...
          3. See also
        7. Adding a custom SoapHeader via Contract
          1. How to do it...
          2. How it works...
          3. There's more...
          4. See also
        8. Return custom exception data through FaultContract
          1. How to do it...
            1. How it works...
            2. There's more...
            3. See also
      8. 2. Endpoint, Binding, and Behavior
        1. Introduction
        2. Configuring Default Endpoints
          1. How to do it...
            1. How it works...
            2. There’s more...
            3. See also
        3. Setting up two-way communication over MSMQ
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There’s more...
          5. See also
        4. Building a Publish-Subscribe service with dual binding
          1. Getting ready
          2. How to do it...
            1. How it works...
            2. There’s more...
            3. See also
        5. Creating a multiple-endpoint service
          1. How to do it...
            1. How it works...
            2. See also
        6. Implementing a POX HTTP service
          1. How to do it...
          2. How it works...
          3. There’s more...
          4. See also
        7. Defining a CustomBinding without a timestamp header
          1. How to do it...
          2. How it works...
          3. See also
        8. Suppressing mustUnderstand validation on unknown SoapHeaders
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There’s more...
          5. See also
        9. Sharing a physical address between multiple endpoints
          1. How to do it...
          2. How it works...
          3. There’s more...
          4. See also
      9. 3. Hosting and Configuration
        1. Introduction
        2. Hosting a service in a console application
          1. How to do it...
            1. How it works...
            2. See also
        3. Hosting a service in Windows Service
          1. How to do it...
          2. How it works...
          3. See also
        4. Hosting a HTTP service with ASP.NET-compatible context
          1. How to do it...
          2. How it works...
          3. There's more...
          4. See also
        5. Hosting a non-HTTP service in IIS 7
          1. How to do it...
          2. How it works...
          3. See also
        6. Customizing IIS ServiceHost via ServiceHostFactory
          1. How to do it...
            1. How it works...
            2. See also
        7. Specifying a dedicated service instance for a singleton service
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        8. Hosting a service in WSS 3.0
          1. How to do it...
          2. How it works...
          3. See also
      10. 4. Service Discovery and Proxy Generation
        1. Introduction
        2. Creating a typed service client
          1. How to do it...
            1. How it works...
            2. See also
        3. Choosing a specific type for representing a collection parameter
          1. How to do it...
          2. How it works...
          3. There's more...
          4. See also
        4. Reusing types between service and client
          1. How to do it...
            1. How it works...
            2. See also
        5. Customizing an auto-generated service proxy class in Visual Studio
          1. How to do it...
            1. How it works...
            2. See also
        6. Building an ad-hoc auto-discoverable service
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        7. Using managed ServiceDiscovery
          1. How to do it...
            1. How it works...
            2. See also
        8. Generating a service proxy in code
          1. How to do it...
            1. How it works...
            2. There's more...
            3. See also
        9. Customizing auto-generated service metadata
          1. How to do it...
            1. How it works...
            2. See also
      11. 5. Channel and Messaging
        1. Introduction
        2. Using ChannelFactory to consume a WCF service
          1. How to do it...
          2. How it works...
          3. There's more...
          4. See also
        3. Invoking async operation via ChannelFactory
          1. How to do it...
            1. How it works...
            2. There's more...
            3. See also
        4. Creating a service via ChannelListener
          1. How to do it...
            1. How it works...
            2. There's more...
            3. See also
        5. Getting the IP address of a client consumer of a WCF service
          1. How to do it...
            1. How it works...
            2. See also
        6. Adding a dynamic SoapHeader into a message
          1. How to do it...
            1. How it works...
            2. See also
      12. 6. Dealing with Data in Service
        1. Introduction
        2. Binding a WPF element with data from a WCF service
          1. How to do it...
          2. How it works...
          3. There's more...
          4. See also
        3. Returning ReadOnlyCollection data
          1. How to do it...
          2. How it works...
          3. See also
        4. Using raw XML as an operation parameter
          1. How to do it...
          2. How it works...
          3. There's more...
          4. See also
        5. Returning a DataTable/DataSet in a service operation
          1. Getting ready
          2. How to do it...
          3. See also
        6. Transferring binary data with MTOM encoding
          1. Getting ready
          2. How to do it...
          3. See also
        7. Specifying ServiceKnownType information in a programmatic way
          1. How to do it...
          2. How it works...
          3. See also
        8. Using XmlSerializer for custom data serialization
          1. How to do it...
            1. How it works...
            2. See also
      13. 7. Security
        1. Introduction
        2. Setting up ad hoc Windows authentication over plain HTTP
          1. How to do it...
          2. How it works...
          3. See also
        3. Getting an authenticated client identity in a service operation
          1. How to do it...
          2. See also
        4. Using username authentication with an ASP.NET membership provider
          1. How to do it...
          2. How it works...
          3. See also
        5. Sending a clear text username token over unsecured HTTP transport
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        6. Using transport and message security at the same time
          1. How to do it...
          2. How it works...
          3. See also
        7. Authorizing through declarative role-based access control
          1. How to do it...
            1. How it works...
            2. See also
        8. Impersonating with a client caller identity
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
          5. See also
        9. Adding multiple tokens in a service request (supportingToken)
          1. How to do it...
            1. How it works...
            2. There's more...
            3. See also
        10. Supplying dedicated credentials for firewall or proxy authentication
          1. Getting ready
          2. How to do it...
        11. Securing a dynamic SoapHeader
          1. How to do it...
          2. How it works...
          3. See also
      14. 8. Concurrency
        1. Introduction
        2. Hosting a singleton instance service
          1. How to do it...
          2. How it works...
          3. See also
        3. Invoking a WCF service without blocking the front UI
          1. How to do it...
            1. How it works...
            2. See also
        4. Using throttling to control service concurrency
          1. How to do it...
          2. How it works...
          3. There's more...
          4. See also
        5. Ensuring termination of a client session
          1. How to do it...
          2. How it works...
          3. There's more...
          4. See also
        6. Tuning WCF concurrency performance via Visual Studio testing tools
          1. How to do it...
          2. How it works...
          3. There's more...
          4. See also
      15. 9. Extending WCF Runtime
        1. Introduction
        2. Using a custom ServiceHost
          1. How to do it...
          2. How it works...
          3. See also
        3. Intercepting operation parameters in a strong-type manner
          1. How to do it...
          2. How it works...
          3. See also
        4. Filtering operation requests based on message
          1. How to do it...
          2. How it works...
          3. See also
        5. Generic operation error handling with OperationInvoker
          1. How to do it...
            1. How it works...
            2. There's more...
            3. See also
        6. Altering operation messages via MessageInspector
          1. How to do it...
          2. How it works...
          3. See also
        7. Building a custom MessageEncoder
          1. How to do it...
          2. How it works...
          3. There's more...
          4. See also
        8. Centralizing authorization through a custom ServiceAuthorizationManager
          1. How to do it...
          2. How it works...
          3. See also
      16. 10. RESTful and AJAX-enabled WCF Services
        1. Introduction
        2. Building a self-hosted REST service
          1. How to do it...
          2. How it works...
          3. See also
        3. Using an auto-generated Help page
          1. How to do it...
          2. How it works...
          3. See also
        4. Mapping URL suffix to operation parameters
          1. How to do it...
          2. How it works...
          3. There’s more...
          4. See also
        5. Applying OutputCache in a REST service
          1. How to do it...
          2. How it works...
          3. There’s more...
          4. See also
        6. Implementing file download via REST endpoint
          1. How to do it...
          2. How it works...
          3. See also
        7. Consuming a WCF service from an ASP.NET AJAX client
          1. How to do it...
          2. How it works...
          3. There’s more...
          4. See also
        8. Accessing a remote REST service in an AJAX client
          1. How to do it...
            1. There’s more...
            2. See also
      17. 11. Interoperability
        1. Introduction
        2. Building a WS-I Basic Profile 1.1 compatible service
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        3. Consuming an ASMX Web Service from a WCF client
          1. How to do it...
            1. How it works...
            2. See also
        4. Accessing a WCF service via the WebRequest component
          1. How to do it...
          2. How it works...
          3. See also
        5. Consuming a WCF service with a raw MSMQ program
          1. How to do it...
          2. How it works...
          3. See also
        6. Using a WCF Service in Microsoft Office
          1. How to do it...
          2. How it works...
          3. See also
      18. 12. Diagnostics
        1. Introduction
        2. Using the WCF Test Client tool to test a service
          1. How to do it...
          2. There’s more...
          3. See also
        3. Capturing WCF request/response messages via Fiddler tool
          1. How to do it...
          2. See also
        4. Using built-in tracing and message logging
          1. How to do it...
          2. How it works...
        5. Debugging in a Windows service host
          1. Getting ready
          2. How to do it...
          3. See also
        6. Creating a custom Visual Studio Debugger Visualizer for WCF debugging
          1. How to do it...
          2. There’s more...
          3. See also
        7. Using PerformanceCounters for WCF service monitoring
          1. How to do it...
      19. 13. Miscellaneous WCF Development Tips
        1. Introduction
        2. Creating test X.509 certificates for WCF Service
          1. How to do it...
            1. There's more...
        3. Managing X.509 certificates installed on service machine
          1. How to do it...
          2. There's more...
        4. Building an RSS feed service
          1. How to do it...
          2. There's more...
          3. See also
        5. Building a routing service
          1. How to do it...
          2. How it works...
          3. There's more...
          4. See also
        6. Registering WCF components manually in IIS server
          1. How to do it...
          2. There's more...