ptg7041380 ptg7041380 Microsoft ® BizTalk ® Server 2010 UNLEASHED 800 East 96th Street, Indianapolis, Indiana 46240 USA Brian Loesgen Charles Young Jan Eliasen Scott Colestock Anush Kumar Jon Flanders ptg7041380 Microsoft® BizTalk® Server 2010 Unleashed Copyright © 2012 by Pearson Education, Inc. All rights reserved. No part of this book shall be reproduced, stored in a retrieval system, or transmitted by any means, electronic, mechanical, photocopying, recording, or otherwise, without written permission from the publisher. No patent liability is assumed with respect to the use of the information contained herein. Although every 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 damages resulting from the use of the information contained herein. ISBN-13: 978-0-672-33118-3 ISBN-10: 0-672-33118-7 Library of Congress Cataloging-in-Publication data is on file Printed in the United States of America First Printing September 2011 Trademarks All terms mentioned in this book that are known to be trademarks or service marks have been appropriately capitalized. Pearson Education, Inc. cannot attest to the accu- racy 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. Bulk Sales Pearson offers excellent discounts on this book when ordered in quantity for bulk purchases or special sales. For more information, please contact: U.S. Corporate and Government Sales 1-800-382-3419 corpsales@pearsontechgroup.com For sales outside of the U.S., please contact: International Sales +1-317-581-3793 international@pearsontechgroup.com Editor-in-Chief Greg Wiegand Executive Editor Neil Rowe Development Editor Mark Renfrow Managing Editor Kristy Hart Project Editor Andy Beaster Copy Editor Keith Cline Indexer Lisa Stumpf Proofreader Apostrophe Editing Services Technical Editor Gijsbert in 't Veld Publishing Coordinator Cindy Teeters Book Designer Gary Adair Compositor Gloria Schurick ptg7041380 Contents at a Glance Foreword xxii Part I The Basics 1 What Is BizTalk Server? 3 2 Schemas 15 3 Maps 89 4 Orchestrations 173 5 Pipelines 257 6 Adapters 337 Part II Advanced Topics 7 BizTalk 2010 and WCF: Extensibility 415 8 BizTalk and Windows Azure 431 9 Business Activity Monitoring with BizTalk BAM 441 10 The Business Rules Framework 467 11 Rule-Based Programming 563 12 ESB with BizTalk Server 639 Part III Deployment and Administration 13 Administration Console Concepts 669 14 Deployment Concepts 687 Part IV RFID 15 BizTalk RFID 723 16 BizTalk RFID Mobile 779 Closing notes 799 Index 803 ptg7041380 Table of Contents Foreword xxii Part I The Basics 1 What Is BizTalk Server? 3 A Brief History of Application Integration 3 BizTalk Server Capabilities 7 Adaptation 7 Mediation 8 Exception Handling 8 Orchestration and Choreography 9 Performance and Scalability 9 Security 10 Insight 10 Electronic Data Interchange 11 RFID Event Handling 11 What Is a “Typical” BizTalk Solution? 11 BizTalk Server, WCF, and WF 12 Summary 14 2 Schemas 15 BizTalk Schemas 16 XML Schema Definition 16 Properties 17 Internal Schemas 18 XML Schemas 20 Existing XSDs 20 Generating an XSD 21 Creating an XSD 21 Flat File Schemas 36 Add Existing Schemas 38 Creating by Hand 38 Flat File Schema Wizard 47 EDI Schemas 60 Messages That Are Not XML and Not Flat File 60 Pass-Through Pipeline 60 Custom Disassembler 61 ptg7041380 Custom Editor Extensions 61 Third-Party Components 61 Property Promotion 61 Distinguished Fields 63 Promoted Properties 65 Property Demotion 66 When to Use What 67 Versioning of Schemas 69 No Long-Running Transactions and a Short Downtime Acceptable 69 Long-Running Transactions or a Short Downtime Is Unacceptable 70 Testing 71 Validate Schemas 71 Validate Instances 72 Generate Instances 74 Unit Testing of Schemas 75 Testing Using Pipeline Tools 80 Schemas for Scenario Used in This Book 81 FineFoods.Common.Schemas 81 FineFoods.CreditCheck.Schemas 82 FineFoods.Customers.C1701 82 FineFoods.Customers.C1702 83 FineFoods.Customers.Schemas 84 FineFoods.Inventory.Schemas 84 FineFoods.Orders.Schemas 84 FineFoods.PurchaseOrders.Schemas 87 Summary 88 3 Maps 89 The Mapper 90 Layout of Mapper 90 Initial Considerations 92 Creating a Simple Map 94 Functoids 108 String Functoids 111 Mathematical Functoids 112 Logical Functoids 113 Date/Time Functoids 115 Conversion Functoids 116 Scientific Functoids 116 Cumulative Functoids 117 Contents v ptg7041380 Database Functoids 118 Advanced Functoids 120 Third-Party Functoids 122 Advanced Maps 123 Mapping Optional Fields 123 Looping Functoid 123 Index Functoid 125 Database Lookup 127 Scripting Functoid 129 Functoid Combination 131 Combination of Functoids for If-Then-Else 131 Create Separated List 132 Table Looping Functoid 132 Conditional Creation of Output Nodes 135 Custom XSLT 136 Cross Referencing 136 Building Custom Functoids 140 Initial Setup 141 Normal Functoid 146 Cumulative Functoid 151 Developing Advanced Functoids 155 Deployment of Custom Functoids 157 Debugging 161 Testing of Maps 163 Validating Maps 164 Testing Maps 164 Debugging a Map 167 Unit Testing 168 Summary 172 4 Orchestrations 173 Orchestration Designer 174 Defining Orchestrations 177 Building Orchestrations 178 Messages 182 Variables 186 Shapes 188 Delivery Notification and Handling Retries 217 Calling Pipelines 218 Web Services 221 Dehydration and Rehydration 228 Correlations 229 Microsoft BizTalk Server 2010 Unleashed vi ptg7041380 Convoys 234 Parallel Convoys 234 Sequential Convoys 235 Zombies 236 Transactions 237 Atomic 238 Long Running 240 Compensating Code 241 Persistence Points 246 Exception Handling 247 Debugging 250 Send Out Messages 250 Debug and Trace 250 Breakpoints in Orchestration Debugger 250 Summary 255 5 Pipelines 257 Stages in Pipelines 258 Stages in a Receive Pipeline 259 Stages in a Send Pipeline 261 Built-In Pipelines 262 Receive Pipelines 262 Send Pipelines 263 Built-In Pipeline Components 263 XML Components 264 Flat Files 268 Encoding, Encrypting, and Signing 272 BizTalk Framework 275 Validator and Party Resolution 280 Custom Pipelines 283 Using the Built-In Pipeline Templates 283 Creating Custom Pipeline Templates 284 Custom Pipeline Components 287 Resources, Attributes, and Constructors 288 Interfaces 292 Message and Context Interfaces 305 Miscellaneous Functionality 309 Streaming 314 Properties 317 Really Fast Pipeline Component Implementation 323 Deployment 324 Debugging 327 Pipeline Component Wizard 329 Contents vii ptg7041380 Testing 330 Pipeline.exe 330 Unit Testing 331 Summary 334 6 Adapters 337 BizTalk Adapters 337 Native Adapters 338 Line-of-Business Adapters 339 BizTalk Adapter Pack 339 Host Adapters 339 Third-Party and Custom Adapters 339 Additional Microsoft Adapters 340 The Role of WCF Adapters 340 Adapter Characteristics 340 Direction 341 Push and Pull 341 Message Interchange Pattern 341 Hosting 342 Configuration 342 Batches 343 Transactions 344 Message Context 344 Metadata Harvesting 344 Registering Adapters 345 Creating Adapter Handlers 346 Port-Level Configuration 349 Configuring Receive Locations 350 Configuring Send Ports 352 Adapter Properties 355 Deploying Bindings 355 Native Adapters 357 File Adapter 357 Robust Interchange 357 Polling Locked Files 358 File Renaming 359 Reliable Messaging Issues 359 Path and File Names 359 Security 360 Additional Send Handler Issues 360 FTP Adapter 360 FTP Issues 361 Microsoft BizTalk Server 2010 Unleashed viii ptg7041380 Contents ix Handling Duplicate Messages 362 Staging Files in Temporary Folders 362 Raw FTP Commands 363 Secure Messaging 363 HTTP Adapter 364 Using HTTP Receive Handlers 364 Using HTTP Send Handlers 366 Additional Configuration 366 MQ Series Adapter 367 Using MQ Series Receive Handlers 368 Using MQ Series Send Handlers 369 Managing Queues 369 Configuring MQSAgent 370 MSMQ Adapter 370 Using MSMQ Receive Handlers 371 Using MSMQ Send Handlers 372 Authenticating and Securing Messages 374 POP3 Adapter 375 Using POP3 Receive Handlers 376 Handling Encrypted Messages 377 SMTP Adapter 377 Using SMTP Send Handlers 378 Windows SharePoint Services Adapter 379 Using WSS Receive Handlers 380 Using WSS Send Handlers 381 Mapping SharePoint Columns 383 SOAP Adapter 383 WCF Adapters 384 Windows Communication Foundation 385 Comparing WCF to BizTalk Server 386 The Role of BizTalk Native WCF Adapters 388 Hosting Native WCF Adapters 389 The WCF Service Publishing Wizard 389 Publishing Orchestrations 392 Publishing Schemas 392 WCF Send Handlers 394 Importing MEX Endpoints 395 Importing Metadata Files 396 Dynamic Ports 397 Configuring WCF Adapters 397 Addresses and Identity 398 Bindings 399 [...]... CHAPTER 6 Adapters 337 3 This page intentionally left blank CHAPTER 1 What Is BizTalk Server? IN THIS CHAPTER A Brief History of Application Integration BizTalk Server Capabilities What Is a “Typical” BizTalk Solution? BizTalk Server, WCF, and WF Microsoft BizTalk Server 2010 is Microsoft s seventhgeneration integration server The first incarnation was in 1999, when it was released to meet enterprise... and WF are complementary to BizTalk Server 2010 They enable developers to construct discrete services Those services can then be orchestrated by BizTalk Server and integrated with existing systems and applications using BizTalk Server s capabilities In addition, BizTalk Server exploits WCF directly to extend its capabilities Through its integrated WCF adapters, BizTalk Server can expose or consume... using SQL Server, a proven and highly scalable product that can be clustered and made highly available and fault tolerant BizTalk Server Capabilities 7 BizTalk Server Capabilities BizTalk Server provides a sophisticated, scalable model for enabling message exchange between different systems However, by itself, the hub-bus model addresses only a subset of the concerns common to integration BizTalk Server. .. integrate their systems effectively BizTalk Server 2010 concentrates on addressing these common problems and has wide application across many different industries and agencies in both the public and private sectors BizTalk Server, WCF, and WF The Microsoft NET Framework implements two important technologies that mirror, to a degree, some of the central capabilities of BizTalk Server Windows Communication... custom functionality on top of BizTalk Server Later versions of BizTalk Server introduced the Enterprise Service Bus Toolkit ([ESB Toolkit], which started out in the first version as [ESB Guidance]) to address these requirements in a consistent manner and provide a common framework for exploiting BizTalk Server as a dynamic service bus platform 8 CHAPTER 1 What Is BizTalk Server? Adapters can be used... 704 Other Types of Resources 707 Binding Files as Resources 708 Deployment Scripts as Resources 709 xvi Microsoft BizTalk Server 2010 Unleashed Exporting MSI Files .712 Handling MSI Export on a Build Server 713 Deploying MSI Packages to a BizTalk Group 715 Import/Install via Command Line 717 Handling Other Deployables 718 Business Activity Monitoring...x Microsoft BizTalk Server 2010 Unleashed Behavior .400 Security and Credentials 401 Message Handling 402 Using the SQL Server LoB Adapter .404 WCF LoB Framework and SDK 404 SQL Server Adapter 404 Polling and Notification 405 Performing Operations via a... of BizTalk Server 2010 lies in the way it combines many additional capabilities into a single coherent platform for enterprise-level integration If Microsoft were to start building BizTalk Server from scratch today, it would doubtless base it from the ground up on WCF and WF However, the resulting product would still greatly extend the core functionality provided within the NET Framework Without BizTalk. .. are capabilities such as capturing operational and business metrics Conceptually, you can think of a BizTalk Server host as a logical hub Individual BizTalk Server machines run a local instance of that host These host instances collaborate using the message bus The bus encompasses the centralized BizTalk Server Message Box (messaging data store) and the management database (configuration data store) together... architect, focusing on delivering solutions to customers that meet the customers’ needs He started working with BizTalk 2002 just after graduation in 2003 and has been working with BizTalk ever since He has passed the exams in BizTalk 2000, 2004, 2006, 2006R2, and 2010 and is a five-time MVP in BizTalk Server He is a well-known contributor on the online MSDN forums and a blogger at http://blogs.eliasen.dk/technical/ . 399 ptg7041380 Microsoft BizTalk Server 2010 Unleashed x Behavior 400 Security and Credentials 401 Message Handling 402 Using the SQL Server LoB Adapter 404 WCF LoB Framework and SDK 404 SQL Server Adapter. as Resources 709 ptg7041380 Microsoft BizTalk Server 2010 Unleashed xvi Exporting MSI Files 712 Handling MSI Export on a Build Server 713 Deploying MSI Packages to a BizTalk Group 715 Import/Install. ptg7041380 ptg7041380 Microsoft ® BizTalk ® Server 2010 UNLEASHED 800 East 96th Street, Indianapolis, Indiana 46240 USA Brian Loesgen Charles Young Jan Eliasen Scott Colestock Anush Kumar Jon Flanders ptg7041380 Microsoft