Axis2 Study Notes (axiom)

Source: Internet
Author: User

1. Abstract

     
 

Axis2 is the implementation product of the next-generation WebService launched by Apache Software organization after axis1. Compared with 1.0, axis2 has the following major improvements:

 

1. It is not extended based on axis1, but re-developed and re-implemented.

 

2. Supports soap1.1, soap1.2. and rest styles.

 

3. The new XML processing object model axiom is faster and more efficient.

 

4. The client supports synchronous, asynchronous, single-channel, and dual-channel.

 

5. Support multiple http smtp jms tcp Protocols.

 

6. Supports pluggable modules to process data.

       

2. Axiom

     
  The SOAP protocol is based on XML as the data exchange format, so before learning about the working principle of axis2, we need to understand the object model of axiom and axis2 ing XML data. The main class diagram is as follows:
 
    <Figure 1>  
 

Axiom adopts the latest pulling XML Processing Method: Stax, which is the latest XML parsing method. Compared with the previous push processing methods such as Dom and sax, pull gives control of XML parsing to the clientProgramOnly when the client program needs data will the parsing class actually read data from the data stream, so this method is more efficient when parsing a little larger XML data.

       
 

I. axiom at the highest abstraction level is divided into three major parts: omxmlparserwrapper, omfactory, omnode, ominer iner, and omxmlparserwrapper, which are mainly used to encapsulate pull XML data streams. This is similar to the decoration mode and further enhances data processing functions, omfactory is the factory class of omnode and omcontainer, used to generate the object of its implementation class. The implementation class of omxmlparserwrapper has the instance reference of omfactory. It can be said that omxmlparserwrapper is like an assembly workshop, produce raw materials (from pulling XML data streams) into products (Implementation classes of omnode or ominer INER) using machines (omfactory ), in the end, omnode and omcontainer are not to mention the objects mapped to nodes in XML document data. The End Node of the table XML document tree. The ominer iner can contain nodes of other nodes, which can have both parent and child nodes.

       
 

A typical XML document parsing process through axiom is as follows:

       
     
    <Figure 2>  

2. It shows the process for a client program to obtain the root node of an XML document. staxombuilder is the implementation class of omxmlparserwrapper, and om1_listimplfactory is the implementation class of omfactory, omdocumentimpl is the implementation class of omdocument (omdocument extends ominer INER). Let's take a look at a typical Implementation of Code to help you understand:

1. bufferedreader reader = new bufferedreader (New inputstreamreader (New fileinputstream ("myfilepath");

2. xmlstreamreader parser = xmlinputfactory. newinstance (). createxmlstreamreader (Reader);

3. staxombuilder builder = new staxombuilder (omabstractfactory. getomfactory (), Parser);

4. omelement root = builder. getdocumentelement ();

       
 

Step 1: generate an original XML data stream

 

Step 2: generate a pull (pull) XML data stream

 

Step 3: generate the staxombuilder object

Step 4: Get the Root Node object. The next () method of staxombuilder is called to obtain this node. The next () method first calls next () of xmlstreamreader () method (to extract data from the data stream), and then call the createomelement method of om1_listimplfactory to generate an omelementimpl object, during the object construction process, the addchild () method of the omdocumentimpl object generated when the staxombuilder object is initially instantiated is called to assign itself to a documentelement of the omdocumentimpl object. Attribute, which equals to the final returned value is this object. From this, we can see that omdocument and Its Implementation class omelementimpl are not directly provided for external use, and another omelementimpl object is finally returned to the client, we can also understand that data is extracted from the data stream only when the data is actually needed.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.