PacktLib: Microsoft Windows Communication Foundation 4.0 Cookbook for Developing SOA Applications

Microsoft Windows Communication Foundation 4.0 Cookbook for Developing SOA Applications

Credits

Foreword

About the Author

About the Reviewers

Preface

Working with Contracts

Introduction

Defining a one-way Contract

Make DataContract forward-compatible

Generate DataContract from an XML Schema

Using XMLSerializer to control message serialization

Using MessageContract to control the SOAP message

Adding a custom SoapHeader via Contract

Return custom exception data through FaultContract

Endpoint, Binding, and Behavior

Introduction

Configuring Default Endpoints

Setting up two-way communication over MSMQ

Building a Publish-Subscribe service with dual binding

Creating a multiple-endpoint service

Implementing a POX HTTP service

Defining a CustomBinding without a timestamp header

Suppressing mustUnderstand validation on unknown SoapHeaders

Sharing a physical address between multiple endpoints

Hosting and Configuration

Introduction

Hosting a service in a console application

Hosting a service in Windows Service

Hosting a HTTP service with ASP.NET-compatible context

Hosting a non-HTTP service in IIS 7

Customizing IIS ServiceHost via ServiceHostFactory

Specifying a dedicated service instance for a singleton service

Hosting a service in WSS 3.0

Service Discovery and Proxy Generation

Introduction

Creating a typed service client

Choosing a specific type for representing a collection parameter

Reusing types between service and client

Customizing an auto-generated service proxy class in Visual Studio

Building an ad-hoc auto-discoverable service

Using managed ServiceDiscovery

Generating a service proxy in code

Customizing auto-generated service metadata

Channel and Messaging

Introduction

Using ChannelFactory to consume a WCF service

Invoking async operation viaChannelFactory

Creating a service via ChannelListener

Getting the IP address of a client consumer of a WCF service

Adding a dynamic SoapHeader into a message

Dealing with Data in Service

Introduction

Binding a WPF element with data from a WCF service

Returning ReadOnlyCollection data

Using raw XML as an operation parameter

Returning a DataTable/DataSet in a service operation

Transferring binary data with MTOM encoding

Specifying ServiceKnownType information in a programmatic way

Using XmlSerializer for custom data serialization

Security

Introduction

Setting up ad hoc Windows authentication over plain HTTP

Getting an authenticated client identity in a service operation

Using username authentication with an ASP.NET membership provider

Sending a clear text username token over unsecured HTTP transport

Using transport and message security at the same time

Authorizing through declarative role-based access control

Impersonating with a client caller identity

Adding multiple tokens in a service request (supportingToken)

Supplying dedicated credentials for firewall or proxy authentication

Securing a dynamic SoapHeader

Concurrency

Introduction

Hosting a singleton instance service

Invoking a WCF service without blocking the front UI

Using throttling to control service concurrency

Ensuring termination of a client session

Tuning WCF concurrency performance via Visual Studio testing tools

Extending WCF Runtime

Introduction

Using a custom ServiceHost

Intercepting operation parameters in a strong-type manner

Filtering operation requests based on message

Generic operation error handling with OperationInvoker

Altering operation messages via MessageInspector

Building a custom MessageEncoder

Centralizing authorization through a custom ServiceAuthorizationManager

RESTful and AJAX-enabled WCF Services

Introduction

Building a self-hosted REST service

Using an auto-generated Help page

Mapping URL suffix to operation parameters

Applying OutputCache in a REST service

Implementing file download via REST endpoint

Consuming a WCF service from an ASP.NET AJAX client

Accessing a remote REST service in an AJAX client

Interoperability

Introduction

Building a WS-I Basic Profile 1.1 compatible service

Consuming an ASMX Web Service from a WCF client

Accessing a WCF service via the WebRequest component

Consuming a WCF service with a raw MSMQ program

Using a WCF Service in Microsoft Office

Diagnostics

Introduction

Using the WCF Test Client tool to test a service

Capturing WCF request/response messages via Fiddler tool

Using built-in tracing and message logging

Debugging in a Windows service host

Creating a custom Visual Studio Debugger Visualizer for WCF debugging

Using PerformanceCounters for WCF service monitoring

Miscellaneous WCF Development Tips

Introduction

Creating test X.509 certificates for WCF Service

Managing X.509 certificates installed on service machine

Building an RSS feed service

Building a routing service

Registering WCF components manually in IIS server

Index