Pro WCF 4: Practical Microsoft SOA Implementation, Second Edition Copyright © 2011 by Nishith Pathak All Rights Reserved
Total Page:16
File Type:pdf, Size:1020Kb
CYAN YELLOW MAGENTA BLACK PANTONE 123 C BOOKS FOR PROFESSIONALS BY PROFESSIONALS® THE EXPERT’S VOICE® IN .NET Companion eBook Available Pro WCF 4 Pro WCF 4: Practical Microsoft SOA Implementation is a complete guide to Windows Communication Foundation from the SOA perspective, demonstrat- Pro ing why WCF 4 is critical to service-oriented architecture and development. WCF 4 Gain deep insight into the functionality of WCF 4 and the improvements from the .NET 4.0 Framework – learn about service discovery, the routing ser- vice, a new simplified configuration paradigm, and other advanced features. Deepen your mastery of WCF 4 through informative examples that will aid you Nishith Pathak, Author of in understanding and implementing these important additions. Pro WCF: Practical Microsoft Inside, you’ll find coverage of the unified programming model, reliable mes- SOA Implementation saging, security, and the peer-to-peer programming model. You'll also learn Pro how to move your current .NET remoting and web service applications to WCF and how to integrate those applications with WCF 4. This book offers genuine insight into solving real enterprise problems using WCF and .NET 4.0. In Pro WCF 4, learn more about: • New features of WCF with .NET 4.0 • A comprehensive WCF programming model • How queue management and reliable messaging work in WCF • Implementing transaction support in WCF • Making WCF services interoperable with other SOA offerings • Best practices in using WCF effectively • Developing WCF applications with Visual Studio 2010 WCF 4 The release of .NET 4.0 brought a wide range of new functionality to WCF. Practical Microsoft SOA Implementation Developers and architects with experience using WCF 3.5 or earlier who want to apply this new functionality to their application will benefit greatly from the discussions and code samples in this book. Pro WCF 4 is also a great resource for application developers and architects new to SOA or the core concepts of WCF. Creating the next generation of secure, reliable, Companion eBook and interoperable services THE APRESS ROADMAP Pro WCF 4 See last page for details Introducing Expert SECOND EDITION on $10 eBook version .NET 4 WCF 4 SECOND Pro C# 2010 and EDITION the .NET 4 Platform SOURCE CODE ONLINE Pathak www.apress.com ISBN 978-1-4302-3368-8 Nishith Pathak 54999 US $49.99 Shelve in: .NET User level: 9 781430 233688 Intermediate–Advanced this print for content only—size & color not accurate 7.5 x 9.25 spine = 0.875" 472 page count This book was purchased by [email protected] For your convenience Apress has placed some of the front matter material after the index. Please use the Bookmarks and Contents at a Glance links to access them. Contents at a Glance Contents ..................................................................................................................... v About the Author ..................................................................................................... xiv About the Technical Reviewer .................................................................................. xv Acknowledgments ................................................................................................... xvi Introduction ............................................................................................................ xvii Part I: Introducing Windows Communication Foundation .......................................... 1 ■Chapter 1: WCF and SOA Basics .............................................................................. 3 ■Chapter 2: What’s New in WCF 4 ........................................................................... 25 ■Chapter 3: Exploring the WCF Programming Model .............................................. 55 Part II: Programming with WCF ................................................................................ 99 ■Chapter 4: Installing and Creating WCF Services ................................................ 101 ■Chapter 5: Hosting and Consuming WCF Services .............................................. 145 ■Chapter 6: Managing WCF Services .................................................................... 185 Part III: Advanced Topics in WCF ........................................................................... 217 ■Chapter 7: Implementing WCF Security .............................................................. 219 ■Chapter 8: Implementing Reliable Messaging and Queue-Based Communications ......................................................... 253 ■Chapter 9: Using Transactions in WCF ................................................................ 281 ■Chapter 10: Integrating with COM+ .................................................................... 303 ■Chapter 11: Working with Data ........................................................................... 337 ■Chapter 12: Developing Peer-to-Peer Applications with WCF ............................. 371 ■Chapter 13: Implementing SOA Interoperability ................................................. 399 ■Appendix: QuickReturns Ltd. ............................................................................... 419 Index ....................................................................................................................... 425 iv Introduction This book is a complete guide to Windows Communication Foundation (WCF) from a service-oriented architecture (SOA) perspective. With each new version of the .NET Framework, Microsoft has improved many key areas of WCF. In .NET 4.0, Microsoft has given developers a better experience and enabled them to become more productive. The book not only provides deep insight into the new WCF functionality that ships with .NET 4.0—such as service discovery, routing services, and simplified configuration—but also provides extensive examples to make it easier to put the new concepts into practice. You'll learn how to move your current offerings to WCF, and how to integrate those applications with WCF 4.0. This book offers genuine insight into solving real enterprise problems using WCF and .NET 4.0. This books covers the following: • The new features of WCF with .NET 4.0 • The WCF programming model • Implementing WS-Discovery and routing services in WCF • How queue management and reliable messaging work in WCF • Implementing transaction support in WCF • How to make WCF services interoperable with other SOA offerings • Best practices for using WCF effectively • Developing WCF applications with Visual Studio 2010 It will also address the business drivers that dictate the need for these WCF features, as well as the industry best practices for applying them. Who This Book Is For The release of .NET 4.0 brought a wide range of new functionality to WCF. Developers and architects with experience using WCF 3.5 or earlier who want to be able to apply this new functionality to their applications will benefit greatly from the discussions and code samples in this book. This book is also a great resource for application developers and architects new to SOA and/or the core concepts of WCF. An Overview of This Book This book specifically targets WCF in .NET 4.0. The text that you hold in your hands is a massive retelling of this book’s first printing to account for all of the major changes that are found in .NET 4.0. Not only will you find brand-new chapters, you will find that many of the previous chapters have been expanded in great detail. This book divided into three parts, each of which contains related chapters. The following xvii ■ INTRODUCTION sections describe each part. The book also has one appendix, where you’ll find a description of the sample application used throughout this book. Part 1: Introducing Windows Communication Foundation This part of the book explains the business motives and pain points of the various distributed technologies developed by Microsoft. It explains how you can address these issues using WCF. Once you understand some of these basic concepts of WCF, including the business and technological factors, you can appreciate its simplicity and flexibility. Chapter 1 covers the service standards and introduces WCF. Chapter 2 explains the new features of WCF that ship with .NET 4.0. Chapter 3 discusses the unified programming model of WCF and how WCF provides the best tools for creating secure, interoperable web services. Part 2: Programming with WCF This part covers the technical features of WCF in detail. You’ll concentrate on the programming aspects of WCF with the assistance of a fictitious stock market application. Chapter 4 guides you through installing and creating WCF services. Chapter 5 covers creating services, and the various hosting options available in WCF services. Chapter 6 discusses how to manage WCF services to obtain the best return on investment for your application. Part 3: Advanced Topics in WCF Real-world SOA applications will have many demanding features to implement. These complex real-world web service implementations will address security issues (both client and service), reliable messaging, transactions, COM+ integration, data integration issues, and peer-to-peer communications. In Chapters 7 through 12, you will concentrate on these topics. In addition, you’ll investigate the WCF interoperability options available to seamlessly communicate with non-Microsoft platforms in Chapter 13. Prerequisites To get the most out of this book, you should install WCF and the .NET Framework 4.0. I recommend using Microsoft Visual Studio 2010 as the development environment to