Axis2 Tutorial
Chathura Herath, Eran Chinthaka
Lanka Software Foundation and Apache Software Foundation
Overview
Introduction
Installation
Client demonstration - Accessing existing endpoint
Implementing and deploying a service
Developing extensions
Writing handlers and modules
Extending MessageReceiver
Supporting custom MEPs
Other features
Introduction
In a nutshell
New XML Infoset Representation
Deferred building
StAX integrated
Extensible Messaging Engine
Pluggable Module Architecture
Improved Deployment Model
New Client API
Extensible Data Binding Support
Other features
In a Nutshell
Small
Should be embeddable
Should be able to handle larger messages
Performance (fast + efficient)
XML Pull parsing / streaming support
Clean
Well designed developer and user convenient APIs
Flexible / Extensible
Module Architecture and plugability
Axis Object Model - AXIOM (OM)
!(Yet another XML Object Model)
Interfaces Messages to the engine
Reads StAX (pull) events into Java objects
Caches when asked, but can also stream
Light weight and fast
Simple and Convenient API
Optimized for SOAP
Integrates MTOM/XOP
Leave room for data binding tools to layer on top
Axis Object Model - AXIOM (OM)
Pull Event
Stream Pull Event
Stream
Push Event
Stream
AXIOM
Programmatical
Push Event
Creation
Stream
How streaming works ..
<soap:Envelope>
<soap:Header>
<myNS:Security soap:mustUnderstand=“true”>
</myNS:Security>
</soap:Header>
<soap:Body> Build object model to here
<doSomethingCool> h = [Link](securityQName)
... MEGABYTES OF DATA HERE ...
</doSomethingCool> ...and then you can do
</soap:Body> body = [Link]();
</soap:Envelope>
reader = [Link]();
while ([Link]()) {
...
}
Extensible Messaging Engine
It is the “core”
A pure SOAP processor
Not aware of any java web service
specifications (e.g. JAX-RPC)
Contains
A Context Hierarchy
Concept of descriptors and contexts
Phases
The Messaging Engine - Pipe
view
Can be viewed as a pipe
The Messaging Engine - Pipe
view
XML Transpor Message
Message t Receiver
Engine
XML
Message
Transport
Message
Receiver/ MEP
Client
The Messaging Engine -
Message Exchange Patterns
Describes the exchange pattern of
SOAP messages per given operation.
E.g.
In – Out
In only
In – In – Out !
WSDL 2.0 defines 8 standard MEPs.
The Messaging Engine -
Message Exchange Patterns
(cont..)
Axis2 supports MEPs with the piped model
of the engine
Can be easily extended to support custom
MEPs
Context and Configuration
Hierarchy
Engine is stateless !!
Context and Configuration Hierarchy
maintains Engine State
Context – running state
Configuration – deployment state
Extensible Messaging Engine
The Messaging Engine - Phases
What are Handlers
Concept of Phases
A phase is a particular stage in execution.
E.g. pre-dispatch, Transport
Each Phase contains a group of Handlers
Handlers are linked to rules that say where
the handler should go
The Messaging Engine - Phases
(Cont…)
Standard Phases
Transport phase
Pre-dispatch phase
Dispatch phase
Post-dispatch phase
Policy determination phase
Pluggable Modules
Extensions for the server
Meant to provide a specific functionality
E.g. Security,Reliability etc
Consists of
Handlers
Special Module class
A Descriptor ([Link])
The Messaging Engine – Detailed
Components View
Engine
Registry
Contexts
Modules
Pluggable Modules (Cont..)
Archived to make a single bundle
Known as a “.mar” file
Concept of Engaging
Engaging a module means activating it
Can be done
Per System
Per Service
Per Operation
Pluggable Modules - Example
The WS-Addressing module
Contains
Addressing-in handler
Placed in the pre-dispatch phase – in pipe
Addressing out handler
Placed in the message-out – out pipe
Improved Deployment Model
Faster and Easier Deployment
Service Archive files (.aar files)
A collection of resources needed for a service
Includes
Service implementation
Handlers (optional)
Service descriptor ([Link])
Improved Deployment Model
(Cont…)
Hot Deployment
“Dropin” deployment
Uploaded through
File system
Axis2 web application
New Client API
Supports an Asynchronous programming
style
Concept of callbacks for the client
Can handle both transport dependent and
transport independent asynchrony.
Based on the “MEP Client”
Can be extended to support custom MEPs
Extensible Data Binding
How to provide data binding support ?
Use a well established framework
Avoid reinventing the wheel!
Flexible
Adds more functionality
E.g. XMLBeans supports the complete XML Schema
Features an API that can bind to another
data binding framework
Extensible Data Binding (Cont …)
Currently supported frameworks
XMLBeans
We also plan to Axis data binding
framework by default.
Sufficient for simple data binding needs
Installation
Download distribution from
[Link]
Deploying in a servlet container
Using web administration interface
Installing Axis2 Eclipse plug-ins
Sample 1 - Client Demonstration
Accessing an existing endpoint
Interoperabilitytest 2 hosted at
[Link]
Sample 2 - Implementing and
Deploying a service
Airline Reservation System
Lets start with the “contract”
Implementing and the contract
Accessing the Service
Now, lets start with implementation
Using web admin
Sample 3 - Developing Extensions
- Modules
Modules
Logging Module
Writing a module
Writing handlers
Handler API
Accessing SOAP message content
Context Hierarchy
Adding handlers to phases
Deploying the module
Engaging the module to the service
Developing Extensions – Extending
Message Receiver
Interfaces engine and service implementation
Help to support different MEPs
Supporting services written in languages that are
being compiled to JVM
Groovy Sample
Developing Extensions –
Supporting Custom MEPs
Writing a new Message Receiver
Introducing an Operation Context
If time permits ….
MTOM support
Multiple Transport support
REST Support
Synergy
Become a contributor
Join axis-dev (filter on “[axis2]”)
axis-dev-request@[Link]
You can find this presentation there
Weekly IRC chats on Wednesdays
Submit ideas, code
Become a committer
Use it. Yes, It’s a help !!!
Submit ideas, bugs
Share experience
Summary
Introduction
Installation
Client demonstration - Accessing Google spell checker
service
Implementing and deploying a service
Developing extensions
Writing handlers and modules
Supporting custom MEPs
Other features (Sessions, Phases, REST, MTOM)
Thank You ….
Question Time ………..
Transport and Data binding
Module
Framework
Engine Registry
Core
(Modules, Handlers and Phases)
AXIOM
StAX
Engine
XML Tran
Messag sport
e Message
Phase
Phase
Phase
Application
Receiver
X
Z
Engine
Registry
Contexts
Modules
Engine
Registry
Contexts
Modules