ebook img

Sketchbook: Indian Women: 100+ Pages of 8 X 10 Blank Paper for Drawing, Doodling or Sketching PDF

608 Pages·2017·2.346 MB·English
by  
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Sketchbook: Indian Women: 100+ Pages of 8 X 10 Blank Paper for Drawing, Doodling or Sketching

SOA Using Java Web Services ™ This page intentionally left blank SOA Using Java Web Services ™ Mark D. Hansen Upper Saddle River, NJ • Boston • Indianapolis • San Francisco New York • Toronto • Montreal • London • Munich • Paris • Madrid Capetown • Sydney • Tokyo • Singapore • Mexico City Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and the publisher was aware of a trademark claim, the designations have been printed with initial capital letters or in all capitals. The author and publisher have taken care in the preparation of this book, but make no expressed or implied warranty of any kind and assume no responsibility for errors or omissions. No liability is assumed for incidental or consequential damages in connection with or arising out of the use of the information or programs contained herein. The publisher offers excellent discounts on this book when ordered in quantity for bulk purchases or 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: U.S. Corporate and Government Sales (800) 382-3419 [email protected] For sales outside the United States, please contact: International Sales [email protected] This Book Is Safari Enabled The Safari®Enabled icon on the cover of your favorite technology book means the book is available through Safari Bookshelf. When you buy this book, you get free access to the online edition for 45 days. Safari Bookshelf is an electronic reference library that lets you easily search thousands of technical books, find code samples, download chapters, and access technical information whenever and wherever you need it. To gain 45-day Safari Enabled access to this book: • Go to http://www.prenhallprofessional.com/safarienabled • Complete the brief registration form • Enter the coupon code Q0CN-0ABE-9QIA-M4E8-NUJ3 If you have difficulty registering on Safari Bookshelf or accessing the online edition, please e-mail [email protected]. Visit us on the Web: www.prenhallprofessional.com Library of Congress Cataloging-in-Publication Data Hansen, Mark D. SOA Using Java Web Services / Mark D. Hansen. p. cm. Includes bibliographical references and index. ISBN 978-0-13-044968-9 (pbk. : alk. paper) 1. Web services. 2. Java (Comput0er program language) 3. Computer network architectures. I. Title. TK5105.88813.H35 2007 006.7’6—dc22 2007009650 Copyright © 2007 Pearson Education, 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 One Lake Street Upper Saddle River, NJ 07458 Fax: (201) 236-3290 ISBN-13: 978-0-13-044968-9 ISBN-10: 0-13-044968-7 Text printed in the United States on recycled paper at RR Donnelley in Crawfordsville, Indiana. First printing, April 2007 To my wife, Lorraine, and our children, Elizabeth, Eric, and Emily. This page intentionally left blank Contents Foreword . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xv Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xix About This Book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxi Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxvii About the Author . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxix Chapter 1 Service-Oriented Architecture with Java Web Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1.1 Am I Stupid, or Is Java Web Services Really Hard? . . . . . . . . . . 2 1.1.1 Don’t Drink That Kool-Aid . . . . . . . . . . . . . . . . . . . . . . . . . 4 1.1.2 JWS Is a Toolset, Not an Application Framework . . . . . . . . . . 6 1.1.3 Epiphany . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 1.2 Web Services Platform Architecture . . . . . . . . . . . . . . . . . . . . . 8 1.2.1 Invocation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 1.2.2 Serialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 1.2.3 Deployment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 1.3 Java Web Services Standards: Chapters 2 through 8. . . . . . . . 18 1.4 The SOAShopper Case Study: Chapters 9 and 10 . . . . . . . . . . 21 1.5 SOA-J and WSDL-Centric Development: Chapter 11 . . . . . . . . . 22 Chapter 2 An Overview of Java Web Services. . . . . . . . . . . . . . 25 2.1 The Role of JWS in SOA Application Development . . . . . . . . . . 26 2.1.1 A Hypothetical SOA Application . . . . . . . . . . . . . . . . . . . . 26 2.1.2 JWS Enables SOA Development. . . . . . . . . . . . . . . . . . . . 29 2.2 A Quick Overview of the Ease-of-Use Features. . . . . . . . . . . . . 36 2.2.1 Source Code Annotations. . . . . . . . . . . . . . . . . . . . . . . . 37 2.2.2 Standard WSDL/Java Mapping . . . . . . . . . . . . . . . . . . . . 38 2.2.3 Standard Serialization Context . . . . . . . . . . . . . . . . . . . . 39 2.2.4 Development Models . . . . . . . . . . . . . . . . . . . . . . . . . . 40 2.2.5 JWS Trade-Offs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 vii viii Contents 2.3 JAX-WS 2.0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 2.3.1 Java/WSDL Mapping. . . . . . . . . . . . . . . . . . . . . . . . . . . 44 2.3.2 Static WSDL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 2.3.3 Dynamic and Static Clients. . . . . . . . . . . . . . . . . . . . . . . 45 2.3.4 Invocation with Java Interface Proxies. . . . . . . . . . . . . . . . 46 2.3.5 Invocation with XML . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 2.3.6 XML Service Providers. . . . . . . . . . . . . . . . . . . . . . . . . . 46 2.3.7 Handler Framework. . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 2.3.8 Message Context . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 2.3.9 SOAP Binding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 2.3.10 HTTP Binding. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 2.3.11 Converting Exceptions to SOAP Faults. . . . . . . . . . . . . . . . 49 2.3.12 Asynchronous Invocation . . . . . . . . . . . . . . . . . . . . . . . . 50 2.3.13 One-Way Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 2.3.14 Client-Side Thread Management . . . . . . . . . . . . . . . . . . . 50 2.3.15 WSDL Styles—Support for RPC/Literal and Document/Literal Wrapped . . . . . . . . . . . . . . . . . . . . . . 50 2.3.16 XML Catalogs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 2.3.17 Pseudoreference Passing (Holder<T> for Out and In/Out Parameters). . . . . . . . . . . . . . . . . . . . . . . . . 52 2.3.18 Run-time Endpoint Publishing (Java SE Only) . . . . . . . . . . . 52 2.4 JAXB 2.0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 2.4.1 Binding XML Schema to Java Representations . . . . . . . . . . 57 2.4.2 Mapping Java Types to XML Schema . . . . . . . . . . . . . . . . 59 2.4.3 Mapping Annotations . . . . . . . . . . . . . . . . . . . . . . . . . . 59 2.4.4 Binding Language. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 2.4.5 Binding Run-time Framework (Marshal/Unmarshal) . . . . . . . 65 2.4.6 Validation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 2.4.7 Portability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 2.4.8 Marshal Event Callbacks . . . . . . . . . . . . . . . . . . . . . . . . 71 2.4.9 Partial Binding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 2.4.10 Binary Data Encoding (MTOM or WS-I). . . . . . . . . . . . . . . . 72 2.5 WS-Metadata 2.0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 2.5.1 WSDL Mapping Annotations . . . . . . . . . . . . . . . . . . . . . . 78 2.5.2 SOAP Binding Annotations . . . . . . . . . . . . . . . . . . . . . . . 78 2.5.3 Handler Annotations . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 2.5.4 Service Implementation Bean . . . . . . . . . . . . . . . . . . . . . 79 2.5.5 Start from WSDL and Java . . . . . . . . . . . . . . . . . . . . . . . 79 2.5.6 Automatic Deployment . . . . . . . . . . . . . . . . . . . . . . . . . 80 2.6 WSEE 1.2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 2.6.1 Port Component. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 2.6.2 Servlet Endpoints. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 2.6.3 EJB Endpoints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 2.6.4 Simplified Packaging. . . . . . . . . . . . . . . . . . . . . . . . . . . 82 2.6.5 Handler Programming Model. . . . . . . . . . . . . . . . . . . . . . 82 Contents ix 2.7 Impact of Other Java EE 5 Annotation Capabilities . . . . . . . . . 82 2.7.1 Dependency Injection . . . . . . . . . . . . . . . . . . . . . . . . . . 82 2.7.2 Interceptors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 2.7.3 POJO Support in EJB 3.0 . . . . . . . . . . . . . . . . . . . . . . . . 83 2.8 Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 2.8.1 Configuring Your Environment to Build and Run the Software Examples. . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 Chapter 3 Basic SOA Using REST . . . . . . . . . . . . . . . . . . . . . . . 85 3.1 Why REST?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 3.1.1 What Is REST?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86 3.1.2 Topics Covered in This Chapter . . . . . . . . . . . . . . . . . . . . 87 3.2 XML Documents and Schema for EIS Records . . . . . . . . . . . . 88 3.2.1 No WSDL Doesn’t Necessarily Mean No Interfaces . . . . . . . 96 3.3 REST Clients with and without JWS . . . . . . . . . . . . . . . . . . . . 97 3.3.1 Getting EIS Records from a REST Service without Using JWS . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 3.3.2 Getting EIS Records from a REST Service with JWS . . . . . . 101 3.3.3 Sending EIS Records to a REST Service without Using JWS . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 3.3.4 Sending EIS Records to a REST Service with JWS . . . . . . . 110 3.4 SOA-Style Integration Using XSLT and JAXP for Data Transformation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114 3.4.1 How and Why to Use XSLT for Data Transformation . . . . . . 115 3.4.2 XSLT Processing Using JAXP. . . . . . . . . . . . . . . . . . . . . 121 3.5 RESTful Services with and without JWS . . . . . . . . . . . . . . . . 125 3.5.1 Deploying a REST Service without Using JWS . . . . . . . . . . 126 3.5.2 Deploying a RESTful Service with JWS. . . . . . . . . . . . . . . 131 3.6 Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136 Chapter 4 The Role of WSDL, SOAP, and Java/XML Mapping in SOA. . . . . . . . . . . . . . . . . . . . . . . . . . . . 137 4.1 The Role of WSDL in SOA . . . . . . . . . . . . . . . . . . . . . . . . . . 138 4.1.1 A WSDL Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141 4.2 The Role of SOAP in SOA. . . . . . . . . . . . . . . . . . . . . . . . . . . 145 4.3 Dispatching: How JAX-WS 2.0 Maps WSDL/SOAP to Java Invocation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151 4.3.1 Determining the WSDL Port . . . . . . . . . . . . . . . . . . . . . 151 4.3.2 The Role of the WS-I Basic Profile . . . . . . . . . . . . . . . . . 153 4.3.3 RPC/Literal. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154 4.3.4 Document/Literal. . . . . . . . . . . . . . . . . . . . . . . . . . . . 156 4.3.5 Document/Literal Wrapped . . . . . . . . . . . . . . . . . . . . . 159

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.