You are previewing Quickstart Apache Axis2.
O'Reilly logo
Quickstart Apache Axis2

Book Description

A practical guide to creating quality web services

  • Complete practical guide to Apache Axis 2

  • Using Apache Axis2 to create secure, reliable web services quickly

  • Write Axis2 modules to enhance web services’ security, reliability, robustness and transaction support

  • This book covers Apache Axis2 version 1.3

In Detail

Axis2 is an enterprise-ready web service engine that is very user friendly and provides web service interactions with a dynamic and flexible execution framework.

Apache Axis2 is a core engine for web services with two implementations: Apache Axis2/Java and Apache Axis2/C. It is a complete redesign and rewrite of the widely used Apache Axis SOAP stack that builds on the lessons learned from the Apache Axis implementation of the SOAP submission to W3C. Apache Axis2 not only supports SOAP 1.1 and SOAP 1.2, but also has integrated support for the widely popular REST-style of web services. The same business logic implementation can offer both a WS-* style interface and a REST/POX style interface simultaneously.

Apache Axis2 is more efficient, more modular, more scalable, and more XML-oriented than the older version. It is carefully designed to support the easy addition of plug-in modules that extend its functionality for features such as security and reliability. Apache Axis2 is built on Apache AXIOM, a new high performance, pull-based XML object model.

This book will take you through the basics of web services and Axis2 to the details of Axis2’s architecture.

Table of Contents

  1. Quickstart Apache Axis2
  2. Credits
  3. About the Author
  4. About the Reviewer
  5. Preface
    1. What This Book Covers
    2. What You Need for This Book
    3. Who This Book is For
    4. Conventions
    5. Reader Feedback
    6. Customer Support
      1. Downloading the Example Code for the Book
      2. Errata
      3. Questions
  6. 1. Introduction
    1. Web Service History
    2. Web Services Overview
      1. How Do Organizations Move into Web Services?
    3. Web Services Model
    4. Web Services Standards
      1. XML-RPC
      2. SOAP
      3. Web Services Addressing (WS-Addressing)
      4. Service Description
        1. Web Services Description Language (WSDL)
    5. Web Services Life Cycle
    6. Apache Web Service Stack
    7. Why Axis2?
    8. Download and Install Axis2
      1. Binary Distribution
      2. WAR Distribution
      3. Source Distribution
      4. JAR Distribution
    9. Summary
  7. 2. Looking into Axis2
    1. Axis2 Architecture
    2. Core Modules
      1. XML Processing Model
      2. SOAP Processing Model
      3. Information Model
      4. Deployment Model
      5. Client API
      6. Transports
    3. Other Modules
      1. Code Generation
      2. Data Binding
    4. Extensible Nature of Axis2
      1. Service Extension of the Module
      2. Custom Deployers
      3. Message Receivers
    5. Summary
  8. 3. AXIOM
    1. Overview and Features
      1. What is Pull Parsing?
    2. AXIOM — Architecture
    3. Working with AXIOM
      1. Creating an AXIOM
      2. Creating an AXIOM from an Input Stream
      3. Creating an AXIOM Using a String
      4. Creating an AXIOM Programmatically
      5. Adding a Child Node and Attributes
      6. Working with OM Namespaces
      7. Working with Attributes
      8. Traversing the AXIOM Tree
      9. Serialization
      10. Advanced Operations with AXIOM
      11. Using OMNavigator for Traversing
      12. Xpath Navigation
      13. Accessing the Pull-Parser
      14. AXIOM and SOAP
    4. Summary
  9. 4. Execution Chain
    1. Handler
      1. Writing a Simple Handler
    2. Phase
      1. Types of Phases
        1. Global Phase
        2. Operation Phase
      2. Phase Rules
        1. Phase Name
        2. phaseFirst
        3. phaseLast
        4. before
        5. after
        6. after and before
      3. Invalid Phase Rules
      4. Flow
    3. Module Engagement and Dynamic Execution Chain
    4. Special Handlers in the Chain
      1. TransportReceiver
      2. Dispatchers
      3. MessageReceiver
      4. TransportSender
    5. Summary
  10. 5. Hacking Deployment
    1. What's New in Axis2 Deployment?
    2. J2EE-like Deployment Mechanism
    3. Hot Deployment and Hot Update
    4. Repository
    5. Change in the Way of Deploying Handlers (Modules)
    6. New Deployment Descriptors
      1. Global Descriptor (axis2.xml)
      2. Service Descriptor (services.xml)
      3. Module Descriptor (module.xml)
    7. Available Deployment Options
      1. Archive-Based Deployment
      2. Directory-Based Deployment
      3. Deploying a Service Programmatically
      4. POJO Deployment
      5. Deploying and Running a Service in One Line
    8. Summary
  11. 6. Information Model
    1. Introduction
    2. Axis2 Static Data
      1. AxisConfiguration
      2. Parameters
      3. MessageFormatters and MessageBuilders
      4. TransportReceiver and TransportSender
      5. Flows and PhaseOrder
    3. AxisModule
    4. Service Description Hierarchy
      1. AxisServiceGroup
      2. AxisService
      3. AxisOperation
      4. AxisMessage
    5. Axis2 Contexts
      1. ConfigurationContext
      2. ServiceGroupContext
      3. ServiceContext
      4. OperationContext
      5. MessageContext
    6. Summary
  12. 7. Writing an Axis2 Service
    1. Introduction
    2. Code-First Approach
      1. Single-Class POJO Approach
      2. POJO with Class Having Package Name
    3. Deploying a Service Using a Service Archive File
      1. Writing the services.xml File
      2. Service Implementation Class
      3. Specifying the Message Receiver
      4. Creating a Service Archive File
      5. Different Ways of Specifying Message Receivers
        1. Specify Message Receivers at the Operation Level
        2. Specify Message Receivers at the Service Level for the Whole Service
        3. Specify Service-Level Message Receivers and Override Them with Operations
      6. Service Group and Single Service
      7. Adding Third-Party Resources
      8. Service WSDL and Schemas
    4. Contract-First Approach — Starting from WSDL
      1. Generating Code
      2. Filling the Service Skeleton
      3. Running the Ant Build File
      4. Deploying the Ant-Created Service Archive File
    5. Summary
  13. 8. Writing an Axis2 Module
    1. Introduction
    2. Module Concept
    3. Module Structure
      1. Module Configuration File (module.xml)
        1. Handlers and Phase Rules
        2. Parameters
    4. Module Implementation Class
        1. WS-Policy
        2. Endpoints
    5. Writing the module.xml File
    6. Deploying and Engaging the Module
        1. Advanced module.xml
    7. Summary
  14. 9. Client API
    1. Introduction
    2. Blocking and Non-Blocking Invocation
    3. Inside Axis2 Client API
      1. ServiceClient API
        1. Available Ways of Creating a ServiceClient
          1. Type 1: Creating a ServiceClient using Its Default Constructor
          2. Type 2: Creating a ServiceClient with Your Own ConfigurationContext
          3. Type 3: Creating a Dynamic Client (Client on the Fly)
        2. ServiceClient with a Working Sample
          1. Scenario 1: Invoking a service in Blocking Manner (sendReceive())
          2. Scenario 2: Utilizing a Service in a Non-Blocking Manner (sendReceiveNonBlocking())
          3. Scenario 3: Utilizing a Service using Two Transports
          4. Scenario 4: Utilizing an In-Only MEP (FireAndForget())
          5. Scenario 5: Utilizing an In-Only MEP (sendRobust())
      2. Working with OperationClient
    4. Summary
  15. 10. Session Management
    1. Introduction
    2. Stateless Nature of Axis2
    3. Types of Sessions in Axis2
    4. Session Creation and Session Destruction
      1. Java Reflection
      2. Using the Optional Interface
      3. Accessing MessageContext
    5. Request Session Scope
    6. SOAP Session Scope
    7. Transport Session Scope
    8. Application Scope
      1. Managing Session Using ServiceClient
    9. Summary
  16. 11. Contract First or Code First
    1. Introduction
    2. Code-First Approach
    3. Why Not the Code-First Approach?
    4. Contract-First Approach: Why is it So Special?
    5. Code-Generation Support in Axis2
      1. Sample 1: Use Default Code-Generation Options to Generate Server-Side Code
      2. Sample 2: Use a Different Databinding
      3. Sample 3: Generate an Interface Instead of a Concrete Class
      4. Sample 4: Generating Client-Side Code
    6. Summary
  17. 12. Advanced Topics
    1. REST — Representational State Transfer
      1. Features of REST
      2. REST Services in Axis2
    2. MTOM — Message Transmission Optimization Mechanism
      1. MTOM on the Client Side
      2. MTOM on the Service Side
    3. Axis2 ClassLoader Hierarchy
    4. Sharing Libraries Using the Class Loader Hierarchy
    5. Axis2 Configurator
    6. Deploying Axis2 in Various Application Servers
    7. Summary