WEB SERVICES: PRINCIPLES and TECHNOLOGY Michael P
Total Page:16
File Type:pdf, Size:1020Kb
WEB SERVICES: PRINCIPLES WEB SERVICES: PRINCIPLES AND TECHNOLOGY Michael P. Papazoglou “This book is one of the most comprehensive treatments of Web services I have seen. It covers the full gamut of concepts, principles, supporting technology and necessary infrastructure required to build a service-oriented architecture using today’s advanced standards. I highly recommend this book.” Dave Chappell: author, Enterprise Service Bus “This book, authored by one of the most respected experts in the Web services fi eld, is an invaluable reference for both academics and practitioners. Because of its rigor and completeness it is bound to become the defi nitive guide to Web services technologies.” AND Francisco Curbera: manager, Component Systems, IBM T.J. Watson Research Center TECHNOLOGY Web services represent the next generation of web-based technology. They allow new and improved ways for enterprise applications to communicate and integrate with each other and, as such, are having a profound effect on both the worlds of business and of software development. In this new book, Michael Papazoglou offers a comprehensive examination of Web services which gives you all you will need to know to gain a solid foundation in this area. This book will help you to understand: ● The nature of Web services – what they actually are ● The underlying concepts, principles, and methodologies of Web services ● The fundamental technologies that underpin the Web services paradigm ● How Web services are introduced into organizations, and how they are designed, deployed and used Michael P. Papazoglou Papazoglou Michael P. ● The key standards necessary for the development of Web services Web Services: Principles and Technology is suitable for computer science students and also for professionals who need an introduction to this area. Key features to help reinforce your understanding include: ● Spiral approach to build on earlier knowledge as the topics become more advanced ● Numerous examples throughout demonstrate the practical application of the theory Michael P. Papazoglou ● Self-test questions, hints and tips, and discussion topics feature throughout Michael Papazoglou holds the chair of Computer Science and is director of INFOLAB/CRISM at Tilburg University, The Netherlands. WEB SERVICES: PRINCIPLES AND TECHNOLOGY www.pearson-books.com 9780321155559_COVER.indd 1 29/6/07 14:48:50 WEBS_A01.qxd 11/12/07 4:30 PM Page i Web Services Visit the Web Services: Principles and Technology Companion Website at www.pearsoned.co.uk/papazoglou to find valuable student learning material including: l Links to useful sites on the web WEBS_A01.qxd 11/12/07 4:30 PM Page ii We work with leading authors to develop the strongest educational materials in computing, bringing cutting-edge thinking and best learning practice to a global market Under a range of well-known imprints, including Prentice Hall, we craft high-quality print and electronic publications which help readers to understand and apply their content, whether studying or at work To find out more about the complete range of our publishing, please visit us on the World Wide Web at: www.pearsoned.co.uk WEBS_A01.qxd 11/12/07 4:30 PM Page iii Web Services: Principles and Technology Michael P. Papazoglou INFOLAB/CRISM, Tilburg University, The Netherlands WEBS_A01.qxd 11/12/07 4:30 PM Page iv This book is dedicated to Marion without whose support, continuous encouragement, and infinite patience this book would have been impossible. Pearson Education Limited Edinburgh Gate Harlow Essex CM20 2JE England and Associated Companies throughout the world Visit us on the World Wide Web at: www.pearsoned.co.uk First published 2008 © Pearson Education Limited 2008 The rights of Michael P. Papazoglou to be identified as author of this work have been asserted by him in accordance with the Copyright, Designs and Patents Act 1988. All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, electronic, mechanical, photocopying, recording or otherwise, without either the prior written permission of the publisher or a licence permitting restricted copying in the United Kingdom issued by the Copyright Licensing Agency Ltd, Saffron House, 6–10 Kirby Street, London EC1N 8TS. All trademarks used herein are the property of their respective owners. The use of any trademark in this text does not vest in the author or publisher any trademark ownership rights in such trademarks, nor does the use of such trademarks imply any affiliation with or endorsement of this book by such owners. ISBN: 978-0-321-15555-9 British Library Cataloguing-in-Publication Data A catalogue record for this book is available from the British Library 1098765432 11 10 09 08 07 Typeset in 10/12pt Times by 35 Printed and bound in Great Britain by Henry Ling Ltd., at the Dorset Press, Dorchester, Dorset The publisher’s policy is to use paper manufactured from sustainable forests. WEBS_A01.qxd 11/12/07 4:30 PM Page v Contents Preface xix Foreword xxix Acknowledgements xxxi Part I Basics 1 Chapter 1: Web services basics 3 1.1 Introduction 4 1.1.1 What are Web services? 5 1.1.2 Typical Web services scenarios 6 1.2 The concept of software as a service 8 1.3 A more complete definition of Web services 10 1.4 Characteristics of Web services 12 1.4.1 Types of Web services 12 1.4.1.1 Simple or informational services 13 1.4.1.2 Complex services or business processes 14 1.4.2 Functional and non-functional properties 15 1.4.3 State properties 15 1.4.4 Loose coupling 16 1.4.5 Service granularity 17 1.4.6 Synchronicity 17 1.4.7 Well-definedness 19 1.4.8 Service usage context 19 1.5 Service interface and implementation 19 1.6 The service-oriented architecture 22 1.6.1 Roles of interaction in the SOA 23 1.6.1.1 Web services provider 23 1.6.1.2 Web services requestor 23 1.6.1.3 Web services registry 24 1.6.2 Operations in the SOA 24 1.6.2.1 The publish operation 25 1.6.2.2 The find operation 25 1.6.2.3 The bind operation 26 WEBS_A01.qxd 11/12/07 4:30 PM Page vi vi Contents 1.6.3 SOA: an example involving complex services 26 1.6.4 Layers in an SOA 27 1.7 The Web services technology stack 32 1.8 Quality of service (QoS) 35 1.9 Web services interoperability 39 1.10 Web services versus components 40 1.11 Impact and shortcomings of Web services 43 1.12 Summary 46 Review questions 46 Exercises 47 Part II Enabling infrastructure 49 Chapter 2: Distributed computing infrastructure 51 2.1 Distributed computing and Internet protocols 52 2.1.1 Internet protocols 52 2.1.1.1 The Open Systems Interconnection reference model 53 2.1.1.2 The TCP/IP network protocol 55 2.1.2 Middleware 57 2.2 The client–server model 59 2.3 Characteristics of interprocess communication 60 2.3.1 Messaging 60 2.3.2 Message destinations and sockets 62 2.3.3 Synchronous and asynchronous forms of message communication 63 2.4 Synchronous forms of middleware 64 2.4.1 Remote procedure calls 64 2.4.2 Remote Method Invocation 66 2.5 Asynchronous forms of middleware 66 2.5.1 Store and forward messaging 67 2.5.2 Publish/subscribe messaging 69 2.5.3 Event-driven processing mechanisms 71 2.5.4 Point-to-point queuing 73 2.6 Request/reply messaging 74 2.7 Message-oriented middleware 75 2.7.1 Integration brokers 77 2.7.2 The Java Message Service (JMS) 80 2.8 Transaction-oriented middleware 81 2.9 Enterprise application and e-business integration 82 WEBS_A01.qxd 11/12/07 4:30 PM Page vii Contents vii 2.10 Summary 86 Review questions 86 Exercises 87 Chapter 3: Brief overview of XML 89 3.1 XML document structure 90 3.1.1 XML declaration 90 3.1.2 Elements 91 3.1.3 Attributes 92 3.2 URIs and XML namespaces 92 3.3 Defining structure in XML documents 95 3.3.1 The XML Schema Definition Language 95 3.3.2 The XML schema document 96 3.3.3 Type definitions, element, and attribute declarations 98 3.3.3.1 Element declarations 98 3.3.3.2 Attribute declarations 100 3.3.4 Simple types 100 3.3.5 Complex types 101 3.4 XML schemas reuse 101 3.4.1 Deriving complex types 102 3.4.1.1 Complex type extensions 102 3.4.1.2 Complex type restrictions 103 3.4.1.3 Polymorphism 103 3.4.2 Importing and including schemas 104 3.4.2.1 Including schemas 105 3.4.2.2 Importing schemas 106 3.5 Document navigation and transformation 109 3.5.1 The XML Path Language 109 3.5.2 Using XSLT to transform documents 111 3.6 Summary 114 Review questions 114 Exercises 115 Part III Core functionality and standards 117 Chapter 4: SOAP: Simple Object Access Protocol 119 4.1 Inter-application communication and wire protocols 120 4.1.1 SOAP as a wire representation 120 4.2 SOAP as a messaging protocol 121 WEBS_A01.qxd 11/12/07 4:30 PM Page viii viii Contents 4.3 Structure of a SOAP message 125 4.3.1 SOAP envelope 126 4.3.2 SOAP header 128 4.3.2.1 SOAP intermediaries 130 4.3.3 SOAP body 133 4.4 The SOAP communication model 134 4.4.1 RPC-style Web services 135 4.4.2 Document (message)-style Web services 137 4.4.3 Communication modes and messaging exchange patterns 139 4.5 Error handling in SOAP 139 4.6 SOAP over HTTP 140 4.7 Advantages and disadvantages of SOAP 143 4.8 Summary 144 Review questions 145 Exercises 145 Chapter 5: Describing Web services 147 5.1 Why is a service description needed? 148 5.2 WSDL: Web Services Description Language 148 5.2.1 WSDL interface definition 150 5.2.2 WSDL implementation 157 5.2.3 WSDL message exchange patterns 164 5.3 Using WSDL to generate client stubs 168 5.4 Non-functional descriptions in WSDL 171 5.5 Summary 171 Review questions 172 Exercises 173 Chapter 6: Registering and discovering Web services