www.it-ebooks.info Apache Axis2 Web Services 2nd Edition Create secure, reliable, and easy-to-use web services using Apache Axis2 Deepal Jayasinghe Afkham Azeez BIRMINGHAM - MUMBAI www.it-ebooks.info Apache Axis2 Web Services 2nd Edition Copyright © 2011 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 authors, 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 of 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: May 2008 Second Edition: February 2011 Production Reference: 1110211 Published by Packt Publishing Ltd. 32 Lincoln Road Olton Birmingham, B27 6PA, UK. ISBN 978-1-849511-56-8 www.packtpub.com Cover Image by Ed Maclean (edmaclean@gmail.com) www.it-ebooks.info Credits Authors Deepal Jayasinghe Afkham Azeez Reviewer Deepak Vohra Development Editors Ved Prakash Jha Maitreya Bhakal Technical Editor Pooja Pande Copy Editors Leonard D'Silva Lakshmi Menon Indexers Hemangini Bari Tejal Daruwale Editorial Team Leader Aanchal Kumar Project Team Leader Ashwin Shetty Project Coordinator Joel Goveya Proofreader Aaron Nash Graphics Nilesh R. Mohite Production Coordinator Adline Swetha Jesuthas Cover Work Adline Swetha Jesuthas www.it-ebooks.info About the Authors Deepal Jayasinghe is a Computer Science PhD student at Georgia Institute of Technology and he is afliated with Center for Experimental Research in Computer Systems. Prior to joining Georgia Tech, he was a Technical Lead at WSO2 Inc., an open source software development company that creates middleware platforms for web services. Deepal has over six years of experience with SOA and web services in addition to being a contributing member of the Apache Axis2 project since its inception. He is a key architect and developer of the Apache Axis2 Web service project and has led a number of releases. In addition to Axis2, he has made major contributions to Apache Synapse, Apache Axiom, and Apache XMLSchema projects. Deepal has written more than 30 technical magazine articles, written research papers, and has delivered speeches at various SOA and web services conferences. He is an Apache Member and PMC members at several Apache projects. His expertise lies mainly in distributed computing, SOA and web services, Cloud computing, and performance analysis. Deepal holds a B.Sc. Engineering degree from the University of Moratuwa, Sri Lanka. He can be reached at deepalk@gmail.com. First of all, I want to thank Apache Axis2 developers and the Axis2 community who has contributed towards making this web services framework a world renowned success in a relatively short period of time. Thank you! I owe countless thanks to my dear wife and parents for always being there and supporting me in so many ways. This book would not have been possible without everything that they have done for me. Special thanks to Srinath Hemapani, Ajith Ranabahu, Eran Chinthaka, Sanjiva Weerawarana, Davanam Sirinivas, Glen Daniels, Paul Fremantle, Chathura Herath, Jaliya Ekanayake, and all the other key members of the Axis2 team without whose tremendous contributions and wisdom, Axis2 would not have been possible. For the creation of this work, I am blessed with a strong team of technical reviewers and superior editorial and production professionals from Packt Publishing. My sincere thanks to all of you for your tireless efforts. www.it-ebooks.info Afkham Azeez is a Member, Project Management Committee (PMC) member, and a committer of the Apache Software Foundation. He works as a Senior Software Architect and Senior Manager, Platform as a Service, at WSO2 Inc. His specializations include distributed computing, Cloud computing, SOA and J2EE technologies. He is a long time open source contributor and is the author of the clustering implementation for Apache Axis2. Azeez holds a Masters degree in Computer Science, specializing in Software Architecture and B.Sc. rst class honors degree in Computer Science and Engineering, from the University of Moratuwa, Sri Lanka. He is a regular presenter at many open source conferences including the Apache Conferences. Azeez is a petrolhead and an active member of the AutoLanka forum. He enjoys a game of basketball and also loves spending time with his three kids. I would like to express profound gratitude to the open source communities backing the Apache Axis, Apache Web Services, and Apache Synapse projects. Their contributions were the foundation upon which work was built. I would like to thank Asanka Abeysinghe, Director of Solutions Architecture at WSO2, and SOA solutions and patterns expert, for providing, guidance and some content for the Enterprise Integration Patterns chapter. I am as ever indebted to my parents specially, for their love and support throughout my life. I also wish to thank my wife, who supported me throughout my work. www.it-ebooks.info About the Reviewers Deepak Vohra is a consultant and a principal member of the NuBean.com software company. Deepak is a Sun Certied Java Programmer and Web Component Developer, and has worked in the elds of XML and Java programming and J2EE for over ve years. Deepak is the co-author of the Apress book Pro XML Development with Java Technology and was the technical reviewer for the O'Reilly book WebLogic: The Denitive Guide. Deepak was also the technical reviewer for the Course Technology PTR book Ruby Programming for the Absolute Beginner, and the technical editor for the Manning Publications book Prototype and Scriptaculous in Action. Deepak is also the author of the Packt Publishing books JDBC 4.0 and Oracle JDeveloper for J2EE Development, and Processing XML Documents with Oracle JDeveloper 11g. www.it-ebooks.info www.PacktPub.com Support les, eBooks, discount offers and more You might want to visit www.PacktPub.com for support les and downloads related to your book. Did you know that Packt offers eBook versions of every book published, with PDF and ePub les available? You can upgrade to the eBook version at www.PacktPub. com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at service@packtpub.com for more details. At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks. http://PacktLib.PacktPub.com Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can access, read and search across Packt's entire library of books. Why Subscribe? • Fully searchable across every book published by Packt • Copy & paste, print and bookmark content • On demand and accessible via web browser Free Access for Packt account holders If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view nine entirely free books. Simply use your login credentials for immediate access. www.it-ebooks.info www.it-ebooks.info Table of Contents Preface 1 Chapter 1: Apache Web Services and Axis2 7 Service Oriented Architecture (SOA) 8 Web service overview 10 How do organizations move into web services? 11 Web services model 12 Web services standards 13 XML-RPC 14 SOAP 14 Web Services Addressing (WS-Addressing) 15 Service description 15 Web Services Description Language (WSDL) 16 Web services lifecycle 16 Apache Web Service stack 18 Why Axis2? 19 Downloading and installing Apache Axis2 21 Binary distribution 22 WAR distribution 23 Source distribution 25 Document distribution 25 JAR distribution 25 Summary 26 Chapter 2: Looking inside Axis2 27 Axis2 architecture 27 Core modules 28 XML processing model 30 SOAP processing model 30 Information model 32 www.it-ebooks.info [...]... simple web services to complex web services By the end of this book, you will have learned about Axis2, its architectures and features, writing and deploying a simple service, writing service extensions and quality of services, POJO and JAX-WS services, clusters, and secure reliable web services What this book covers Chapter 1, Apache Web Services and Axis2 - Gives you an introduction to web services. .. www.it-ebooks.info Apache Web Services and Axis2 Apache Axis2 is the next generation web service framework from Apache The Apache software foundation started Apache SOAP as its first web service framework Next, they developed Apache Axis, which became one of the very successful projects at Apache and is still used heavily in the industry Due to rapid changes in the industry and demands from the user community, Apache. .. in practicality web services, is becoming the enabler for application integration Since the introduction of web services, Apache Software Foundation has played a major role and produced several good web services frameworks This book covers the defector Java Web Service framework, also known as Apache Axis2 This book covers several important facts that you would want to know about web services and writing,... will learn more about web services, its history, standards, as well as the components of web services At the end of the chapter, we will discuss the need for a new web service engine, and finally how to install and run Axis2 Here, we focus more on the web services and related technologies In particular, we will cover: • Service Oriented Architecture • Overview of web services • Web services standers and... www.it-ebooks.info Apache Web Services and Axis2 Web Services Description Language (WSDL) WSDL, developed by IBM, Ariba, and Microsoft, is an XML-based language that provides a model for describing web services The standard defines services as network endpoints or ports WSDL is normally used in combination with SOAP and XML schema to provide web services over networks A service requester who connects to a web service... to use the existing applications Web services describe a new model for using the web; the model allows publication of business functions to the Web and provide universal access to those business functions Both developers and end users benefit from web services The web service model simplifies business application development and interoperation Web services model Web services model consists of a set... organizations move into web services? There are three main ways in which an organization could possibly use to move into the web services, listed next: • Create a new web service from scratch The developer creates the functionalities of the services as well as the description [ 11 ] www.it-ebooks.info Apache Web Services and Axis2 • Expose the existing functionality through a web service Here the functionalities... 218 Highly available load balancing 220 The Axis2 clustering management API 220 org .apache. axis2. clustering.ClusteringAgent 221 org .apache. axis2. clustering.state.StateManager 222 org .apache. axis2. clustering.management.NodeManager 223 org .apache. axis2. clustering.management.GroupManagementAgent 223 Summary 223 Chapter 13: Enterprise Integration Patterns 225 Apache Synapse 226 WSO2 ESB 227 OpenESB 230... Axis alone was not able to fulfill those requirements, thus the Apache Web Service community initiated Apache Axis2 project in 2004 In a short period of time, Apache Axis2 has become the de facto open source Java Web Service framework, which is now heavily used in both the industry and in academia Axis2, the next generation of the Apache Web Service stack, takes one more step closer to the first production... invoking a service Web services standards So far we have discussed SOA, standard bodies of web services, and the web service model In this section, we are going to discuss more about standards, which make web services more usable and flexible In the past few years, there has been a significant growth in the usage of web services as application integration mechanism As mentioned earlier, a web service is . www.it-ebooks.info Apache Axis2 Web Services 2nd Edition Create secure, reliable, and easy-to-use web services using Apache Axis2 Deepal Jayasinghe. 1: Apache Web Services and Axis2 7 Service Oriented Architecture (SOA) 8 Web service overview 10 How do organizations move into web services? 11 Web services