ebook img

Windows communication foundation : unleashed PDF

719 Pages·2007·11.08 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Windows communication foundation : unleashed

Craig McMurtry Marc Mercuri Nigel Watling Matt Winkler Windows Communication Foundation U N L E A S H E D 800 East 96th Street,Indianapolis,Indiana 46240 USA Windows Communication Foundation Unleashed Editor-in-Chief Copyright © 2007 by Sams Publishing Karen Gettman All rights reserved. No part of this book shall be reproduced,stored in a retrieval Senior Acquisitions system,or transmitted by any means,electronic,mechanical,photocopying,recording, or otherwise,without written permission from the publisher. No patent liability is Editor assumed with respect to the use of the information contained herein. Although every Neil Rowe precaution has been taken in the preparation of this book,the publisher and author assume no responsibility for errors or omissions. Nor is any liability assumed for Development Editor damages resulting from the use of the information contained herein. Mark Renfrow ISBN-10: 0-672-32948-4 Managing Editor ISBN-13: 978-0-672-32948-7 Patrick Kanouse Library of Congress Cataloging-in-Publication Data Project Editor Windows communication foundation unleashed / Craig McMurtry ... [et al.]. Seth Kerney p. cm. Copy Editor Includes index. Mike Henry ISBN 0-672-32948-4 Indexer Ken Johnson 1. Application software--Development. 2. Electronic data processing--Distributed processing. 3. Microsoft Windows (Computer file) 4. Web services. I. McMurtry,Craig. Proofreader QA76.76.A65W59 2007 Leslie Joseph 005.4'46--dc22 Technical Editor 2007004268 John Lambert Printed in the United States of America Publishing First Printing: March 2007 Coordinator 10 09 08 07 4 3 2 1 Cindy Teeters Trademarks Book Designer All terms mentioned in this book that are known to be trademarks or service marks Gary Adair have been appropriately capitalized. Sams Publishing cannot attest to the accuracy of this information. Use of a term in this book should not be regarded as affecting the validity of any trademark or service mark. Warning and Disclaimer Every effort has been made to make this book as complete and as accurate as possi- ble,but no warranty or fitness is implied. The information provided is on an “as is” basis. The author and the publisher shall have neither liability nor responsibility to any person or entity with respect to any loss or damages arising from the information contained in this book. Contents at a Glance Foreword......................................................................................................xvi Introduction....................................................................................................1 Part I Introducing the Windows Communication Foundation 1 Prerequisites....................................................................................................7 2 The Fundamentals........................................................................................19 3 Data Representation......................................................................................77 4 Sessions, Reliable Sessions, Queues, and Transactions...............................109 Part II Introducing the Windows Workflow Foundation 5 Fundamentals of the Windows Workflow Foundation..............................131 6 Using the Windows Communication Foundation and the Windows Workflow Foundation Together..................................................................189 Part III Security 7 Security Basics.............................................................................................217 8 Windows CardSpace, Information Cards, and the Identity Metasystem.................................................................................................253 9 Securing Applications with Information Cards.........................................293 10 Advanced Security.......................................................................................337 Part IV Integration and Interoperability 11 Legacy Integration......................................................................................385 12 Interoperability...........................................................................................413 Part V Extending the Windows Communication Foundation 13 Custom Behaviors.......................................................................................419 14 Custom Channels.......................................................................................453 15 Custom Transports......................................................................................481 Part VI Special Cases 16 Publish/Subscribe Systems..........................................................................505 17 Peer Communication..................................................................................537 18 Representational State Transfer and Plain XML Services...........................569 Part VII The Lifecycle of Windows Communication Foundation Applications 19 Manageability..............................................................................................583 20 Versioning...................................................................................................623 Part VIII Guidance 21 Guidance.....................................................................................................639 Index...........................................................................................................673 Table of Contents Foreword xvi Introduction 1 Part I Introducing the Windows Communication Foundation 1 Prerequisites 7 Introduction...................................................................................7 Partial Types...................................................................................7 Generics.........................................................................................8 Nullable Value Types......................................................................11 The Lightweight Transaction Manager...............................................13 Role Providers...............................................................................14 Summary......................................................................................17 References.....................................................................................17 2 The Fundamentals 19 Background...................................................................................19 The Service Model..........................................................................26 A Software Resource................................................................31 Building a Service for Accessing the Resource..............................34 Using the Service....................................................................52 Hosting the Service in IIS.........................................................65 Changing How the Service Communicates.................................70 Summary......................................................................................74 References.....................................................................................74 3 Data Representation 77 Background...................................................................................77 TheXmlSerializerand the DataContractSerializer..........................79 The XML Fetish.............................................................................83 Using the DataContractSerializer...................................................88 Exception Handling......................................................................103 Summary....................................................................................108 References...................................................................................108 vi Windows Communication Foundation Unleashed 4 Sessions,Reliable Sessions,Queues,and Transactions 109 Introduction................................................................................109 Reliable Sessions...........................................................................109 Reliable Sessions in Action.....................................................111 Session Management.....................................................................113 Queued Delivery..........................................................................114 Enhancements in Windows Vista............................................116 Transactions................................................................................118 Summary....................................................................................128 Part II Introducing the Windows Workflow Foundation 5 Fundamentals of the Windows Workflow Foundation 131 Introduction................................................................................131 What Is Windows Workflow Foundation?.................................131 What Windows Workflow Foundation Is Not............................132 Activities.....................................................................................132 Out of the Box Activities........................................................135 Creating Custom Activities.....................................................136 Communicating with Activities...............................................143 Design Behavior...................................................................149 Transactions and Compensation.............................................151 Workflow Models.........................................................................154 Sequential Workflows............................................................155 State Machine Workflows.......................................................163 Custom Root Activities..........................................................165 Workflow Hosting........................................................................166 Hosting the Runtime.............................................................166 Runtime Services..................................................................168 Custom Services...................................................................177 Rules Engine................................................................................179 Rules as Conditions...............................................................181 TheConditionedActivityGroupActivity...................................183 Rules as Policy......................................................................185 Summary....................................................................................188 References...................................................................................188 Contents vii 6 Using the Windows Communication Foundation and the Windows Workflow Foundation Together 189 Introduction................................................................................189 Consuming Services......................................................................190 The Simple Case...................................................................190 The General Case..................................................................191 Orchestrating Services...................................................................195 Exposing Workflows as Services......................................................196 Publishing as a Web Service....................................................196 Hosting Inside a WCF Service.................................................200 Looking Ahead.............................................................................206 References...................................................................................213 Part III Security 7 Security Basics 217 Introduction................................................................................217 Basic Tasks in Securing Communications..........................................217 Transport Security and Message Security...........................................218 Using Transport Security................................................................219 Installing Certificates............................................................219 Identifying the Certificate the Server Is to Provide......................221 Configuring the Identity of the Server......................................223 Transport Security in Action...................................................223 Using Message Security..................................................................230 Impersonation and Authorization...................................................236 Impersonation.............................................................................236 Authorization..............................................................................239 Reversing the Changes to Windows.................................................248 Uninstalling the Certificates...................................................249 Removing the SSL Configuration from IIS.................................250 Removing the SSL Configuration from HTTP.SYS .......................250 Restoring the Identity of the Server .........................................250 Summary....................................................................................251 References...................................................................................251 8 Windows CardSpace,Information Cards,and the Identity Metasystem 253 Introduction................................................................................253 The Role of Identity......................................................................253 Microsoft Passport and Other Identity Solutions................................256 viii Windows Communication Foundation Unleashed The Laws of Identity.....................................................................258 The Identity Metasystem...............................................................259 Information Cards and CardSpace...................................................265 Managing Information Cards.........................................................267 Architecture, Protocols, and Security................................................273 CardSpace and the Enterprise.........................................................286 Summary....................................................................................290 References...................................................................................290 9 Securing Applications with Information Cards 293 Introduction................................................................................293 Developing for the Identity Metasystem...........................................293 Simple Demonstration of CardSpace................................................295 Prerequisites for the CardSpace Samples...........................................296 1) Enable Internet Information Services and ASP.NET 2.0............296 2) Get X.509 Certificates........................................................297 3) Import the Certificates Into the Certificate Store....................297 4) Update the Hosts File with DNS Entries to Match the Certificates........................................................................298 5) Internet Information Services Setup.....................................298 6) Certificate Private Key Access..............................................299 7) HTTP Configuration..........................................................300 Adding Information Cards to a WCF Application...............................301 Adding Information Cards.............................................................306 Using a Federation Binding............................................................311 Catching Exceptions.....................................................................313 Processing the Issued Token...........................................................314 Using the Metadata Resolver..........................................................316 Adding Information Cards to Browser Applications............................317 Creating a Managed Card..............................................................328 Building a Simple Security Token Service..........................................332 Summary....................................................................................334 References...................................................................................335 10 Advanced Security 337 Prelude.......................................................................................337 Introduction................................................................................338 Securing Resources with Claims......................................................338 Claims-Based Authorization Versus Role-Based Authorization.......339 Claims-Based Authorization Versus Access Control Lists..............340 Adopting Claims-Based Authorization......................................341 Contents ix Leveraging Claims-Based Security Using XSI......................................342 Authorizing Access to an Intranet Resource Using Windows Identity.............................................................................343 Improving the Initial Solution................................................350 Adding STSs as the Foundation for Federation...........................358 Reconfiguring the Resource Access Service................................372 Reconfiguring the Client........................................................376 Experiencing the Power of Federated, Claims-Based Identity with XSI............................................................................378 Claims-Based Security and Federated Security....................................380 Summary....................................................................................381 References...................................................................................381 Part IV Integration and Interoperability 11 Legacy Integration 385 Introduction................................................................................385 COM+ Integration........................................................................385 Supported Interfaces..............................................................386 Selecting the Hosting Mode....................................................387 Using the COM+ Service Model Configuration Tool...........................387 Exposing a COM+ Component as a Windows Communication Foundation Web Service..............................................................390 Referencing in the Client.......................................................395 Calling a Windows Communication Foundation Service from COM.....396 Building the Service..............................................................397 Building the Client...............................................................400 Building the VBScript File......................................................401 Testing the Solution..............................................................402 Integrating with MSMQ.................................................................402 Creating a Windows Communication Foundation Service That Integrates with MSMQ................................................................403 Creating the Request.............................................................403 Creating the Service..............................................................404 Creating the Client...............................................................407 Testing................................................................................411 Summary....................................................................................412 12 Interoperability 413 Summary....................................................................................415 References...................................................................................416

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.