Implementing SOA Using Java™ EE
Total Page:16
File Type:pdf, Size:1020Kb
Implementing SOA Using Java™ EE ptg From the Library of ALESSANDRO CAROLLO The Java™ Series Visit informit.com/thejavaseries for a complete list of available publications. ptg ublications in The Java™ Series are supported, endorsed, and Pwritten by the creators of Java at Sun Microsystems, Inc. This series is the official source for expert instruction in Java and provides the complete set of tools you’ll need to build effective, robust, and portable applications and applets. The Java™ Series is an indispensable resource for anyone looking for definitive information on Java technology. Visit Sun Microsystems Press at sun.com/books to view additional titles for developers, programmers, and system administrators working with Java and other Sun technologies. From the Library of ALESSANDRO CAROLLO Implementing SOA Using Java™ EE B. V. Kumar ptg Prakash Narayan Tony Ng Upper Saddle River, NJ • Boston • Indianapolis • San Francisco New York • Toronto • Montreal • London • Munich • Paris • Madrid Cape Town • Sydney • Tokyo • Singapore • Mexico City From the Library of ALESSANDRO CAROLLO Many of the designations used by manufacturers and sellers to distinguish their products are claimed as Editor-in-Chief trademarks. Where those designations appear in this book, and the publisher was aware of a trademark Mark Taub claim, the designations have been printed with initial capital letters or in all capitals. Acquisitions Editor Sun Microsystems, Inc. has intellectual property rights relating to implementations of the technology Greg Doench described in this publication. In particular, and without limitation, these intellectual property rights may Development Editor include one or more U.S. patents, foreign patents, or pending applications. Songlin Qiu Sun, Sun Microsystems, the Sun logo, J2ME, J2EE, Java Card, and all Sun and Java based trademarks Managing Editor and logos are trademarks or registered trademarks of Sun Microsystems, Inc., in the United States and Kristy Hart other countries. UNIX is a registered trademark in the United States and other countries, exclusively licensed through X/Open Company, Ltd. This publication is provided “as is” without warranty of any Project Editor kind, either express or implied, including, but not limited to, the implied warranties of merchantability, Anne Goebel fitness for a particular purpose, or non-infringement. This publication could include technical inaccura- Copy Editor cies or typographical errors. Changes are periodically added to the information herein; these changes Apostrophe Editing will be incorporated in new editions of the publication. Sun Microsystems, Inc. may make improve- Services ments and/or changes in the product(s) and/or the program(s) described in this publication at any time. Indexer The authors and publisher have taken care in the preparation of this book, but make no expressed or Lisa Stumpf implied warranty of any kind and assume no responsibility for errors or omissions. No liability is Proofreader assumed for incidental or consequential damages in connection with or arising out of the use of the Karen A. Gill information or programs contained herein. Publishing Coordinator The publisher offers excellent discounts on this book when ordered in quantity for bulk purchases or Michelle Housley special sales, which may include electronic versions and/or custom covers and content particular to your business, training goals, marketing focus, and branding interests. For more information, please contact: Cover Designer Alan Clements U.S. Corporate and Government Sales (800) 382-3419 Senior Compositor [email protected] Gloria Schurick ptg For sales outside the United States please contact: International Sales [email protected] Visit us on the web: informit.com/aw Library of Congress Cataloging-in-Publication Data: Kumar, B. V. (Balepur Venkatanna ), 1959- Implementing SOA using Java EE / B.V. Kumar, Prakash Narayan, Tony Ng. p. cm. ISBN 978-0-321-49215-9 (pbk. : alk. paper) 1. Service-oriented architecture (Computer science) 2. Java (Computer program language) I. Narayan, Prakash, 1960- II. Ng, Tony. III. Title. TK5105.5828K95 2010 004.6'54--dc22 2009041877 Copyright © 2010 Sun Microsystems, Inc. All rights reserved. Printed in the United States of America. This publication is protected by copyright, and permission must be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permissions, write to: Pearson Education, Inc Rights and Contracts Department 501 Boylston Street, Suite 900 Boston, MA 02116 Fax (617) 671 3447 ISBN-13: 978-0-321-49215-9 ISBN-10: 0-321-49215-3 Text printed in the United States on recycled paper at Edwards Brothers in Ann Arbor, Michigan. First printing December 2009 From the Library of ALESSANDRO CAROLLO To my mother—Mrs. M. N. Lakshmidevamma —Dr. B. V. Kumar To my parents—Mr. K.N. Krishnamoorthy and Mrs. Sharada Krishnamoorthy —Prakash Narayan ptg To Kaitlyn, Tyler, and Sophia —Tony Ng From the Library of ALESSANDRO CAROLLO This page intentionally left blank ptg From the Library of ALESSANDRO CAROLLO Contents Foreword by Robert Brewin . xvii Foreword by Raj Bala . xviii Acknowledgments. xxi ptg About the Authors . xxiii Part I Overview . .1 Chapter 1 Introduction . 3 Products and Services 4 Software-Driven Services 4 Web Services 6 SOA 8 Web Services and SOA Opportunities 12 Summary 13 Endnotes 13 Chapter 2 Evolution of IT Architectures . .15 The Server-Side Architecture Progression 16 Progression of Mainframe Architecture 17 Progression of Client/Server Architecture 19 Progression of Distributed Architecture 21 Internet and World Wide Web 26 vii From the Library of ALESSANDRO CAROLLO viii CONTENTS Client-Side Architecture Progression 28 Terminals as Clients 29 Thick Clients 30 Thin Clients 30 Browser Clients 31 Mobile Clients 31 Service Oriented Architecture and Web Services 32 Web Services 32 Arrival of SOAP, WSDL, and UDDI Infrastructure 34 Summary 35 Endnotes 35 Chapter 3 Evolution of Service Oriented Architecture . 37 Services Oriented Architecture—The Description 38 Early Architectures 38 IMS 39 CICS 40 CORBA 41 DCOM 41 Paradigm Shifts 42 ptg Java and Java 2 Enterprise Edition 42 Extensible Markup Language 43 Web Services—XML-RPC and SOAP 44 Arrival of Web Services and SOA 44 First Generation Web Services 45 The Second Generation Web Services 45 SOA Using Web Services 46 Benefits and Challenges with SOA 47 SOA Implementation Technologies 47 Microsoft's .NET Technologies 48 Sun Microsystems’s Java Enterprise Edition Technologies 48 Summary 50 Endnotes 50 Part II Service Oriented Architecture Essentials . 53 Chapter 4 Message Oriented Services and SOAP . 55 SOAP Conventions 56 Message Envelope 56 Encoding Rules 56 RPC Convention 56 Binding 57 From the Library of ALESSANDRO CAROLLO CONTENTS ix Anatomy of SOAP 57 Basic SOAP Model 57 Detailed SOAP Model 60 SOAP Encoding Details 65 Simple Type Encoding 65 Complex Type Encoding 66 SOAP Binding to the Transport Protocol 68 Interaction Using the SOAP Protocol 68 Message Exchange Model 69 SOAP Response and the Error-Handling Mechanism 71 The SOAP <Fault> 72 The SOAP <faultcode> 72 The SOAP <faultstring> 73 The SOAP <faultactor> 73 The SOAP <detail> 73 SOAP Version Differences and Dependencies 73 SOAP Versioning 73 New SOAP Version 74 Summary 75 Endnotes 76 ptg Chapter 5 Web Services and Web Services Description Language . .77 WSDL—An XML Web Services Description Vocabulary 78 The Web Services Triangle 78 Service Invocation Fundamentals 80 Synchronous Invocation and Fundamentals of RPC Mechanism 81 Service Invocation and WSDL 85 Creation of the Service 86 Generating the Web Service Description for the Service 87 Registering the Web Service 87 Publication of the Web Service 87 Discovering the Web Service 87 Understanding the Web Services Semantics 87 Invocation of Web Service 88 Describing Web Services—The XML Way 91 WSDL Elements and Their Appearance Sequence 92 Anatomy of WSDL Document 93 WSDL Version Differences and Dependencies 100 Summary 100 Endnotes 101 From the Library of ALESSANDRO CAROLLO x CONTENTS Chapter 6 Registries and UDDI. 103 Defining UDDI 104 Taxonomy-Based Business Information 104 UDDI Specifications and Services 105 Public Registries Versus Private Registries 105 UDDI Nomenclature 106 Node API Sets 106 UDDI Node 106 UDDI Registries 106 Data Structure 107 Information Model 107 Core UDDI 107 The <businessEntity> Data Structure 108 The <businessService> Data Structure 109 The <bindingTemplate> Data Structure 110 The <tModel> Data Structure 111 Publication of Business Information 112 Creation and Modification of Business Information 113 Deletion of Business Information 114 ptg Discovering Web Services 115 Information Browsing and Retrieval 116 Information Drill-Down 117 Summary 118 Chapter 7 Orchestration and Choreography . 119 Importance of Business Process and Work Flow 120 Orchestration 121 WS-Business Process Execution Language 122 Processing BPEL 124 Choreography 127 Orchestration and SOA 129 Choreography and SOA 130 Summary 130 Endnotes 131 Chapter 8 Advanced Web Services Infrastructure for Implementing SOA . 133 Message Exchange Patterns 135 WS-*—The New Generation 136 WS-Addressing 137 WS-Atomic Transaction 137 From the Library of ALESSANDRO CAROLLO CONTENTS xi WS-Coordination 137 WS-Eventing 137 WS-Metadata Exchange 138 WS-Notification 138 WS-Policy Framework 138 WS-Reliability/WS-Reliable