Free Sample
+ Collection

Microsoft Windows Communication Foundation 4.0 Cookbook for Developing SOA Applications

Cookbook
Steven Cheng

Microsoft WCF 4.0 - Over 85 easy recipes for managing communication between applications with Microsoft Windows Communication Foundation 4.0 in this book and eBook
$29.99
$45.00
RRP $29.99
RRP $49.99
eBook
Print + eBook

Want this title & more?

$21.99 p/month

Subscribe to PacktLib

Enjoy full and instant access to over 2000 books and videos – you’ll find everything you need to stay ahead of the curve and make sure you can always get the job done.

Book Details

ISBN 139781849680769
Paperback316 pages

About This Book

  • 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

 

Who This Book Is For

If you work with Windows Communication Foundation 4.0 and you want to be efficient when working with WCF features such as interoperability, proxy generation, and security, you will find this book very useful. With this book you will be able to find quick and handy solutions for various kinds of service development scenarios using Microsoft Windows Communication Foundation 4.0. To follow the recipes you will need to be comfortable with .NET Framework, C# programming, and the basics of SOA and how to develop them.

Table of Contents

Chapter 1: 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
Chapter 2: 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
Chapter 3: 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
Chapter 4: 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
Chapter 5: 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
Chapter 6: 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
Chapter 7: 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
Chapter 8: 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
Chapter 9: 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
Chapter 10: 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
Chapter 11: 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
Chapter 12: 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
Chapter 13: 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

What You Will Learn

  • Share a physical address between multiple endpoints
  • Custom binding without a Timestamp header
  • Bind a WPF element with data from WCF service
  • Invoke a WCF service without blocking the front UI
  • Build a WCF service with ad hoc security mode
  • Intercept WCF operation messages with MessageInspector
  • Extend WCF security with custom AuthorizationManager
  • Build REST-style services with WCF
  • Call WCF services from AJAX script clients

 

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.

Authors

Read More