SOA Cookbook Design Recipes for Building Better SOA Processes Master SOA process architecture, modeling, and simulation in BPEL, TIBCO’s BusinessWorks, and BEA’s Weblogic Integration Michael Havey BIRMINGHAM - MUMBAI SOA Cookbook Design Recipes for Building Better SOA Processes Copyright © 2008 Packt Publishing All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews. Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book. Packt Publishing has endeavored to provide trademark information about all the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information. First published: September 2008 Production Reference: 1190808 Published by Packt Publishing Ltd. 32 Lincoln Road Olton Birmingham, B27 6PA, UK. ISBN 978-1-847195-48-7 www.packtpub.com Cover Image by Vinayak Chittar ([email protected]) [ FM-2 ] Credits Author Project Manager Michael Havey Abhijeet Deobhakta Reviewers Project Coordinators Frank Jennings Brinell Lewis Ravi Ravindra Rajashree Hamine Acquisition Editor Indexer Adil Ahmed Monica Ajmera Development Editor Proofreader Nikhil Bangera Dirk Manuel Technical Editors Production Coordinator Mithun Sehgal Shantanu Zagade Aanchal Kumar Cover Work Editorial Team Leader Shantanu Zagade Akshara Aware [ FM-3 ] About the Author Michael Havey started his career as a consultant in the BPM and SOA space thirteen years ago, after many years in the role of 'perpetual student.' He attained undergraduate degrees in Computer Science, Philosophy, and Mathematics (at the University of Toronto), and even spent time studying Philosophy at the Masters level (at Carlton University), before finally resolving to descend the ivory tower and join the workforce. In his professional life, Michael has worked extensively with application integration and business processes. His first book, Essential Business Process Modeling, was published by O'Reilly in 2005. He has also published a number of articles in SOA World, Java Developer's Journal, Weblogic Developer's Journal, BPTrends, and O'Reilly Net. He is an architect in TIBCO's financial services consulting group. Previously he worked as a consultant for IBM, BEA, and Chordiant. Without my family's support, I could never have completed this book. Thanks Paola, Napoleon, Katrina, Mason, and Ireland for inspiring me. And thanks to my mother for being my most loyal reader. Many thanks also to my reviewers, busy fellows to begin with, for graciously accepting my invitation to evaluate the first draft. Their constructive criticism helped me make numerous improvements to the book. Ravi Ravindra, Frank Jennings, and Stuart Charlton: I owe you a favor. And what a team Packt put together for me! To Adil Ahmed, Nikhil Bangera, Brinell Lewis, Rajashree Hamine, and Mithun Sehgal: You're the best in the business! [ FM-4 ] About the Reviewers Frank Jennings works in the Information Products Group of Sun Microsystems Inc. He has more than 9 years of experience in Java, SOA, and System Design. He is an Electronics Engineer from Madras University and has worked for several open- source projects. Frank has written regular columns for leading Java journals including Java Developer's Journal and Linux Developer's Week. He is also the co-author of the book SOA Approach to Integration, which focuses on SOA design patterns for enterprises. He is also involved in technical publications for Sun Microsystems in the fields of Solaris and Developer AMP Stack. His blog can be read at http://blogs. sun.com/ phantom and he can be reached via email at [email protected]. He also holds a Post Graduate Diploma in Computer Science and an Advance Diploma in Computer Integrated Management from the University of Indianapolis. Dr. Ravindra is an IBM Certified Executive IT Architect and Project Manager with over 34 years of experience in the IT industry. He has an extensive background in design, implementation, and support of information systems. He has held responsibility for the specification, development, implementation, and acquisition of a variety of application systems and technologies for both public and private sector clients. His expertise lies in the development and implementation of information technologies and the strategies that meet and potentially influence the business objectives of an organization. He has contributed articles on a variety of topics, including data modeling, prototyping, and object-oriented analysis. He is based in Ottawa and is a part of IBM's Global Business Services. [ FM-5 ] Table of Contents Preface 1 Chapter 1: SOA Survival Guide 9 SOA from 184 Billion Feet 11 The Model Stack 13 The Secret They Couldn't Hide—SOA is Process-Oriented 16 Summary 20 Chapter 2: Drawing SOA Architecture 21 The 4+1 Structure of an SOA Architecture Document 22 Using ARIS Methodology to Organize the Logical View 25 Example—Competitive Enrollment 27 Data and Service Interfaces for Retailer Enrollment 30 BPMN Processes for Retailer Enrollment 36 Enrollment Process 39 Drop Process 41 Switch Process 42 ESB Processes 43 Traceability to Functional Requirements 45 Summary of BPMN Processes 46 Service Composition of Retailer Enrollment Using SCA 46 On Modeling Tools 48 Summary 49 Chapter 3: Separating BPM and SOA Processes 51 The Model Stack 52 A Reference Architecture 52 Vendor Offerings 53 Where Does BPEL Fit? 54 Design Tips on Separating BPM and SOA 55 Example—Process for Handling Credit Card Disputes 56 Table of Contents Disputes on the Model Stack 63 BPM-Oriented Disputes with TIBCO 65 Architecture 65 iProcess Business Processes 67 BusinessWorks Orchestration Processes 71 ActiveMatrix ESB Processes 73 SOA-Oriented Disputes with BEA 75 Architecture 75 Weblogic Integration Orchestration Process 76 About the Examples 81 Summary 81 Chapter 4: Modeling Orchestration and Choreography 83 Choreography versus Orchestration 84 Examples—Energy Enrollment, Email Bank Transfer 86 Modeling Choreography in BPMN 88 The Invisible Hub in BPEL 95 Choreography in WS-CDL with Pi4SOA 98 Defining Roles and Relationships 98 Building a Control Flow of Interactions 100 Generating a BPEL Role Process 104 Tips on Modeling Orchestration 106 Dependable Routing 108 About the Examples 110 Summary 111 Chapter 5: Short and Long-Running Processes 113 Process Duration—the Long and Short of It 114 Stateful and Stateless Processes in BEA's Weblogic Integration 116 How to Keep Long-Running State 117 State in Oracle's BPEL Process Manager 117 State in BEA's Weblogic Integration 119 Our Own State Model 120 Combining Short-Running Processes with State in TIBCO's BusinessWorks 122 Our Use Case—Sending Money by Email 122 The Router Process 124 The Request Process 125 The Transfer Process 127 The Cancellation Process 128 The Expiration Process 129 A Note on Implementation 130 [ ii ] Table of Contents Fast Short-Running BPEL 130 Uses of Short-Running Processes 130 Architecture for Short-Running Processes 132 Example of a Very Fast Process 134 Running the Very Fast Process on the Optimized Engine 135 Managing Inbound Events and Timeouts 136 Compiled Form 137 Compiled Code—What Not To Do 141 About the Examples 141 Summary 142 Chapter 6: Flat Form 145 Our Use Case: Credit Card Disputes 146 The Disputes Process as Requirements Flowchart 147 Disputes in BPEL—Naïve Form 151 Naïve BPEL 151 The Flatness of Naive Approach 154 Disputes in BPEL—Flat State Machine 155 Dispute State Diagram 155 State Diagram in BPEL 157 The Flatness of State Form 160 Disputes in BPEL: Flat Event Loop 161 The BPEL Event Loop 161 The Flatness of Event Form 164 Disputes in BPEL: Flat Control Flow 164 Arrow Surgery 164 Managing Flow in BPEL 167 The Flatness of Flow Form 168 Flat Concurrency 169 Long-Lived Concurrency 169 How Not to Design the Voting Process 170 The Flat Voting Process 171 Advantages and Disadvantages of Flat Form 173 About the Examples 175 Summary 175 Chapter 7: Dynamic Processes and the Change Problem 177 The Change Problem 178 A Risky Change 179 A Riskier Change 180 The "Change Region" 182 Poor Man's Change: Versioning 182 [ iii ]