Apache Axis2 AXIOM - AXis Object Model. 2 Agenda Processing XML / Why AXIOM? AXIOM Architecture  Builders  Deferred Building  Caching  Factories 

Slides:



Advertisements
Similar presentations
J0 1 Marco Ronchetti - Web architectures – Laurea Specialistica in Informatica – Università di Trento Java XML parsing.
Advertisements

XB1: Xml Pull Builder V1 Design Notes Aleksander Slominski.
Apache Axis2 SOAP Primer. Agenda What is SOAP? Characteristics SOAP message structure Header blocks Fault notification Exercises.
Developing Application Extensions with Axis2 Chathura Herath Eran Chinthaka.
XML Parsing Using Java APIs AIP Independence project Fall 2010.
J2ME Web Services Specification.  With the promise to ease interoperability and allow for large scale software collaboration over the Internet by offering.
©Silberschatz, Korth and Sudarshan10.1Database System Concepts W3C Activities HTML: is the lingua franca for publishing on the Web XHTML: an XML application.
Java API for XML Processing (JAXP) CSE 4/586: Distributed Systems Department of Computer Science and Engineering University at Buffalo, New York Jia Zhao.
MC365 XML Parsers. Today We Will Cover: An overview of the Java API’s used for XML processing Creating an XML document in Java Parsing an XML document.
28-Jun-15 StAX Streaming API for XML. XML parser comparisons DOM is Memory intensive Read-write Typically used for documents smaller than 10 MB SAX is.
XML: Java Dr Andy Evans. Java and XML Couple of things we might want to do: Parse/write data as XML. Load and save objects as XML. We’ll mainly discuss.
Web Services with Apache CXF Part 2: JAXB and WSDL to Java Robert Thornton.
PHP and XML TP2653 Advance Web Programming. PHP and XML PHP5 – XML-based extensions, library and functionalities (current XAMPP PHP version is )
By: Shawn Li. OUTLINE XML Definition HTML vs. XML Advantage of XML Facts Utilization SAX Definition DOM Definition History Comparison between SAX and.
XML Fundementals XML vs.. HTML XML vs.. HTML XML Document (elements vs. attributes) XML Document (elements vs. attributes) XML and RDBMS XML and RDBMS.
By Deepal Jayasinghe / Ajith Ranabahu Apache Software Foundation & WSO2 Accelerating Web Services Development with Axis2.
PerfSONAR Client Construction February 11 th 2010, APAN 29 – perfSONAR Workshop Jeff Boote, Assistant Director R&D.
Networking Nasrullah. Input stream Most clients will use input streams that read data from the file system (FileInputStream), the network (getInputStream()/getInputStream()),
XML processing in ColdFusion MX Everything you wanted to know about XML, but were afraid to ask October 2006 Jaxfusion User Group.
Introducing Axis2 Eran Chinthaka. Agenda  Introduction and Motivation  The “big picture”  Key Features of Axis2 High Performance XML Processing Model.
XML and its applications: 4. Processing XML using PHP.
XML Parsers Overview  Types of parsers  Using XML parsers  SAX  DOM  DOM versus SAX  Products  Conclusion.
SAX. What is SAX SAX 1.0 was released on May 11, SAX is a common, event-based API for parsing XML documents Primarily a Java API but there implementations.
XML DOM Functionality in.NET DSK Chakravarthy
Intro to XML Originally Presented by Clifford Lemoine Modified by Box.
Openadaptor XML Support Using openadaptor for XML processing Oleg Dulin,
Java API for XML Processing (JAXP) Dr. Rebhi S. Baraka Advanced Topics in Information Technology (SICT 4310) Department of Computer.
Web Services with Apache CXF Part 2: JAXB and WSDL to Java Robert Thornton.
Sheet 1XML Technology in E-Commerce 2001Lecture 3 XML Technology in E-Commerce Lecture 3 DOM and SAX.
XFSP : Cross Format Schema Protocol Flexible Networking via XML-Defined Packet Payloads Ltjg. Ekrem Serin TU Navy.
Web Services with Apache CXF Part 2: JAXB and WSDL to Java Robert Thornton.
XML Study-Session: Part III
SAX2 and DOM2 Kanda Runapongsa Dept. of Computer Engineering Khon Kaen University.
COSC617 Project XML Tools Mark Liu Sanjay Srivastava Junping Zhang.
Axis2 - Overview. Agenda  What is already there Overall Architecture Core AXIOM WSDL Deployment Client API  What is yet to come Encoding – Pluggable.
CS 157B: Database Management Systems II February 13 Class Meeting Department of Computer Science San Jose State University Spring 2013 Instructor: Ron.
1 Java Servlets l Servlets : programs that run within the context of a server, analogous to applets that run within the context of a browser. l Used to.
XML and Object Serialization. Structure of an XML Document Header Root Element Start Tags / End Tags Element Contents – Child Elements – Text – Both (mixed.
INT-2: XQuery Levels the Data Integration Playing Field Carlo (Minollo) Innocenti DataDirect XML Technologies, Program Manager.
Web services. DOM parsing and SOAP.. Summary. ● Exercise: SAX-Based checkInvoice(), ● push parsing, ● event-based parsing, ● traversal order is depth-first.
Martin Kruliš by Martin Kruliš (v1.1)1.
© Blackboard, Inc. All rights reserved. SOAP-based Mobilization for an Efficient Personal Learning Environment Nick Schiavi Blackboard R&D.
Java Programming: Advanced Topics 1 Input/Output and Serialization.
USING ANDROID WITH THE DOM. Slide 2 Lecture Summary DOM concepts SAX vs DOM parsers Parsing HTTP results The Android DOM implementation.
XML & JSON. Background XML and JSON are to standard, textual data formats for representing arbitrary data – XML stands for “eXtensible Markup Language”
I Copyright © 2004, Oracle. All rights reserved. Introduction.
5/3/2004 XMLMap and xsd2java Luigi Zangrando
XML. Contents  Parsing an XML Document  Validating XML Documents.
Apache Axis2 XML Based Client API.
DHTML.
XML Parsers Overview Types of parsers Using XML parsers SAX DOM
Spark Presentation.
Intro to XML.
Application with Cross-Platform GUI
Web UI Basics ITM 352.
{ XML Technologies } BY: DR. M’HAMED MATAOUI
XML in Web Technologies
Introducing Axis2 Ajith Ranabahu
XML Parsers Overview Types of parsers Using XML parsers SAX DOM
Apache Sandesha and Apache Axis2
Chapter 9 Web Services: JAX-RPC, WSDL, XML Schema, and SOAP
A parser for XML Documents
XML: eXtensible Markup Language
CS 240 – Advanced Programming Concepts
Python and XML Styling and other issues XML
XML and its applications: 4. Processing XML using PHP
XML Parsers.
XML Programming in Java
WaysInJavaToParseXML
XML and Web Services (II/2546)
Presentation transcript:

Apache Axis2 AXIOM - AXis Object Model

2 Agenda Processing XML / Why AXIOM? AXIOM Architecture  Builders  Deferred Building  Caching  Factories  Input/Output Using AXIOM – Code examples Resources Exercises

3 Processing XML XML related applications work with  Raw XML data XML files, strings containing XML, I/O streams,...  XML parsers SAX, StAX, DOM (parser),...  XML object models Represent an XML infoset as an object hierarchy (e.g. DOM – JDOM, dom4j)‏  Application data object models Represent data in an application specific entity (object) hierarchy (e.g. By using XMLBeans, ADB)‏

4 Why AXIOM? A high performance object model specifically developed to address the needs of Web services environments  Fast  Low memory footprint What are the differences found in AXIOM?

5 AXIOM Way of Treating SOAP... MEGABYTES OF DATA HERE... An arbitrary header: Preferred to be processed through an OM (with read/write capabilities)‏ Body: Preferred to be processed through a data binding framework (if ever required by a SOAP node)‏

6 XML Programming Models Current Models  Document object models (eg : DOM)‏ Complete XML in memory (A tree hierarchy)‏  Document stream models (eg : SAX)‏ XML infosets are parsed serially Can only go forward (no reverse gear)‏

7 Streaming Push/Pull Parsers Streaming push  Emits (or “pushes”) events for the entire XML stream from the beginning to the end.  SAX Streaming pull  Let the client iterate though events or “pull” them.  StAX – JSR pus h pul l parse r clien t

8 Advantages of Pull Parsing The client controls the application thread Pull parsing libraries can be much smaller and the client code to interact with those libraries are much simpler Pull clients can read multiple documents at one time with a single thread Can filter XML documents such that elements unnecessary to the client can be ignored

9 AXIOM Architecture

10 AXIOM Architecture Builders StAXOMBuilder  Generic builder StAXSOAPModelBuilder  Can read SOAP messages and builds SOAP object model based on AXIOM MTOMStAXSOAPModelBuilder  Can read MTOM messages

11 AXIOM Architecture - Deferred Building Partial building of object model in memory Model is built on-demand and only up to the extent information is required. Saves memory, without compromising performance. Transparent to the user

12 AXIOM Architecture - Deferred Building Cont… MEGABYTES OF DATA h = envelope.getHeader(securityQName)‏ Build object model to here...and then you can do body = envelope.getBody(); reader = body.getXMLStreamReader(); while (reader.hasNext()) {... }

13 AXIOM Architecture - Caching Information can be accessed with or without building the object model Enables intelligent and controlled use of memory  example: sending messages doesn't require to build the object model

14 AXIOM Architecture - Concept of Factories

15 AXIOM Architecture- Input/Output Pull Event Stream Push Event Stream Pull Event Stream Programmatic Creation Push Event Stream

16 AXIOM Architecture – Input/Output Cont... AXIOM Pull stream Push stream API Read (tree)‏ API Write (tree )‏ STAXOMBuilder. getDocumentElement()‏ OMElement.getChildren() etc OMFactory.createOMElement()‏ OMElement.serialize()‏ OMElement. getXMLStreamReader()‏ SAXOMBuilder. getDocumentElement()‏

17 Using AXIOM StAXOMBuilder builder = new StAXOMBuilder(new FileInputStream(xmlFile)); OMElement documentElement = builder.getDocumentElement(); System.out.println("xml = " + documentElement.toStringWithConsume()); Example :  Read an XML File in to AXIOM and print it our to Sytem.out

18 Using AXIOM (Cont…)‏ StAXOMBuilder builder = new StAXOMBuilder(new FileInputStream(xmlFile)); OMElement documentElement = builder.getDocumentElement(); System.out.println("xml = " + documentElement.toStringWithConsume()); Create an OM Builder from the given FileInputStream

19 Using AXIOM (Cont…)‏ StAXOMBuilder builder = new StAXOMBuilder(new FileInputStream(xmlFile)); OMElement documentElement = builder.getDocumentElement(); System.out.println("xml = " + documentElement.toStringWithConsume()); Get the document element from the builder

20 Using AXIOM (Cont…)‏ StAXOMBuilder builder = new StAXOMBuilder(new FileInputStream(xmlFile)); OMElement documentElement = builder.getDocumentElement(); System.out.println("xml = " + documentElement.toStringWithConsume()); Print the document element. toStringWithConsume() method will print the xml in to the out stream without building an OM tree

21 Navigating Object Model Iterator allChildren = presentationElement.getChildren(); while (allChildren.hasNext()) { OMNode omNode = (OMNode) allChildren.next(); omNode.serialize(System.out); System.out.println(""); }

22 Navigating Object Model Cont… Iterator allChildren = presentationElement.getChildren(); while (allChildren.hasNext()) { OMNode omNode = (OMNode) allChildren.next(); omNode.serialize(System.out); System.out.println(""); } Provides an iterator API to navigate children. This enables to differ building of object model

23 Navigating Object Model Cont… Iterator allChildren = presentationElement.getChildren(); while (allChildren.hasNext()) { OMNode omNode = (OMNode) allChildren.next(); omNode.serialize(System.out); System.out.println(""); } All AXIOM objects (OMElement, OMText, etc.,) extends from OMNode

24 Navigating Object Model Cont… OMElement presenter = presentationElement.getFirstChildWithName( new Qname("Presenter")); System.out.println("presenter = " + presenter); Searching for a specific element

25 Getting Events From Objects // Get an XMLStreamReader from the article element with // caching XMLStreamReader xmlStreamReader = presentationElement.getXMLStreamReader(); // Get an XMLStreamReader from the article element // without caching XMLStreamReader xmlStreamReaderWithoutCaching = presentationElement.getXMLStreamReaderWithoutCaching();

26 Resources AXIOM Project  AXIOM API Documentation  Available on-line (see above URL) or with AXIOM download Performance of AXIOM  A comparison with other XML object model mechanisms found here:

27 Exercises Download AXIOM binary distribution from Look at the API documentation for the details of OMNode, OMElement, OMContainer, StAXOMBuilder, StAXSOAPModelBuilder The sample code contains the file SOAPHeaderProcessor.java. Follow the instructions given in the file to modify a SOAP header using AXIOM.