1、ByDeepal Jayasinghe / Ajith RanabahuApache Software Foundation & WSO2Accelerating Web Services Development with Axis2About usBoth Apache commiters Axis2 SynapsePart of the Axis2 team from Day 1Working for WSO2 Motivation for Axis2 History of ASF SOAP engines (paradigm) Apache SOAP Axis 1.x designed
2、as a follow-on Why do we need a new SOAP engine? Changes to the Web services landscape WS-A, WS-RM Performance Parsers, Optimizing based on use Ease of use Deployment of new capabilities, service deploymentAxis2 features High Performance XML Processing Model Extensible Messaging Engine Improved Cont
3、ext Hierarchy Pluggable Module Architecture Improved Deployment Model New Client API Optional Pluggable Data Binding WSDL 2.0 Support REST SupportHigh Performance XML Processing ModelNew XML Infoset RepresentationKnown as AXIOM (AXIS Object Model)NOT, Yet another XML object model API is more like a
4、simplified DOMFundamental difference ? Objects are created “on demand” using a pull model Allows direct access to the underlying pull stream with or without building the tree Support for storing binary dataNew XML Infoset Representation (Cont)API also provides a StAX parser interface at any element
5、Allows the event based navigation of the OM tree. New XML Infoset Representation (Cont)AXIOMPull Event StreamPush Event StreamPull Event StreamProgrammatic Creation Push Event StreamNew XML Infoset Representation (cont)In built binary storage support Can store binary (unchanged) Natively supports XO
6、P/MTOMXOP? MTOM?AXIOM and Axis2AXIOM is the primary means of representing / manipulating the XML message inside Axis2Time to Dig Into Code Code samples to explain AXIOM Serialization De-serialization Caching XPath navigationExtensible Messaging EngineAxis2 TerminologyHandlerPhase Phase rulesFlow (Ex
7、ecution chain)Extensible moduleServiceMessage ContextA Word About Phase and Phase Rules.Phase is logical collection of handlersWhy do we need phase rules? dynamic handler chainsWriting phase rules Phase Name PhaseFirst PhaseLast Before After Before and AfterHow phase resolving happens at the deploym
8、ent time and module engagement timePhase and Phase Rules (Cont.)Example Extensible Messaging EngineApplicationTransportPhase ZPhase YPhase XXMLMessageEngineMessageReceiverThe Message FlowThe Flow of a Message Steps of handling a message inside Axis2 Transport Receiver Engine Dispatching Message Rece
9、iverStep1 : Transport ReceiverCreate a Message Context (MC)Add transport information into MCCreate an AxisEngine Remember, AxisEngine is stateless Call engine.receive()Step 2 : EngineInvoke the global phases Why do we need global phases ?Dispatch (wait till next slide )Invoke service phasesCall the
10、Message Receiver Can we pause the execution ? Yes , but there are things to keep in mind!Step 2.5 - Dispatching Two types of dispatching Finding the corresponding descriptions Finding the corresponding contextsDefault dispatchers AddressingBasedDispatcher RequestURIBasedDispatcher SOAPActionBasedDis
11、patcher SOAPMessageBodyBasedDispatcherStep 2.5 : Dispatching (Cont)Order of tasks in dispatching Finding Operation context Finding Service context Finding Service group contextStep 3 : Message ReceiverThe last handler of the execution chainMEP dependent (MEP ? )Does the actual business logic invocat
12、ionAbility to write custom Message ReceiversSupports Dependency injection !Some default Message Receivers RawXMLINOnlyMessageReceiver RawXMLINOutMessageReceiver RPCMessageReceiverMessage Exchange Patterns - MEPDescribes the exchange pattern of SOAP messages per given operation.E.g. In Out In Only In
13、 In Out !WSDL 2.0 defines 8 standard MEPs.Axis2 supports all inbound MEPsCoding time again.Write a Custom Message ReceiverContexts and Descriptions HierarchyWhy are the Contexts and Descriptions Needed ? Descriptions keep static information Information extracted from deployment descriptorsContexts k
14、eep runtime informationThis Information needs to be in various scopesGood to keep them seperate!Life Time of Descriptions and ContextsAxis* life time = System life time*Context life time variesSharing data across different level of descriptions and contextsParameters and PropertiesParameters Defining parameters The “locked” attribute Setting and getting Parameter can be any object Can get an OMElement as the parameterProperties Difference between property and parameter Accessing and retrieving property appropriatelyPluggable Module Architecture