Java Web Services, part 2nd: Deep Exploration Axis2:axiom

Source: Internet
Author: User
Tags soap min web services wrapper xmlns java web

Why do I need another document model?

The Apache AXIS2 1.1 has been released, offering exciting new features for those loyal users who run the Apache WEB Services Framework series for a long time. We will discuss the content of Axis2 in subsequent articles, and this article will delve into the AXIs object Model (AXIOM) XML document model, which is the core of Axis2. AXIOM is one of the major innovations in Axis2, and one of the reasons AXIS2 can provide better performance than the original Axis. This article will show you how AXIOM works, how parts of Axis2 are built on top of AXIOM, and AXIOM performance comparisons with other Java™ Document object models.

The document model is typically used to process XML, and there are many different document models available in Java development, including various implementations of the original common-system DOM specification, JDOM, dom4j, XOM, and so on. Each model claims to have some advantages over other models, either in terms of performance, flexibility, or the degree to which the XML standards are strictly adhered to, and each model has a loyal supporter. So why does Axis2 need a new model? The answer lies in the structure of the SOAP message, especially how to add the appropriate extensions to the basic SOAP framework.

Introduction to SOAP

SOAP itself is simply a simple wrapper for the load of an XML application. Listing 1 provides an example in which only elements with the SOAPENV prefix are truly defined in SOAP. Most of the documents are application data, which form the content of the soapenv:body element.

Listing 1. SOAP sample

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
 <soapenv:Header/>
 <soapenv:Body>
  <matchQuakes xmlns="http://seismic.sosnoski.com/types">
   <min-date>2001-01-06T11:10:43.446Z</min-date>
   <max-date>2001-10-24T19:49:13.812Z</max-date>
   <min-long>-150.94307</min-long>
   <max-long>-22.594208</max-long>
   <min-lat>-11.44651</min-lat>
   <max-lat>55.089058</max-lat>
  </matchQuakes>
 </soapenv:Body>
</soapenv:Envelope>

Although the basic SOAP wrapper is simple, it provides unrestricted scalability by using an optional component called the Header. The Header provides the right place to add a wide variety of metadata that is not seen by the application in conjunction with the application data (you can include application data in the Header, but it is not reasonable to do so and you should place the application data in the body of the message). Extensions built on SOAP, such as the entire ws-* series, can be used to achieve the corresponding goals without any impact on the application. This allows extensions to be used as add-ins, and you can select the specific extension functionality that an application needs at deployment time without having to process it in code.

Listing 2 shows the same application data as the listing 1 SOAP example, but includes ws-addressing information. Although the original SOAP message can only be used for HTTP transmissions (because HTTP provides a two-way connection so that the response can be sent back to the client immediately), the version in Listing 2 can be used for other protocols, because the response metadata is directly included in the SOAP request message. In the process of processing the messages in Listing 2, even store-and-forward operations are possible because they provide both the request target and the response target information.

Listing 2. Examples of SOAP using ws-addressing

<soapenv:envelope xmlns:soapenv= "http://schemas.xmlsoap.org/soap/envelope/"
xmlns:wsa= http:// Www.w3.org/2005/08/addressing "
<soapenv:header>
<wsa:to>http://localhost:8800/axis2/ Services/seisaxis2xbean</wsa:to>
<wsa:replyto>
<wsa:address>http://www.w3.org/2005/08/ Addressing/anonymous</wsa:address>
</wsa:replyto>
<wsa:messageid>urn:uuid    : 97ae2b17231a8584d811537402403691</wsa:messageid>
</soapenv:header>
<soapenv:Body>
<matchquakes xmlns= "Http://seismic.sosnoski.com/types"
<min-date>2000-03-28t13:13:08.953z</ Min-date>
<max-date>2001-03-11t02:26:54.283z</max-date>
<min-long>-81.532234</ Min-long>
<max-long>65.25895</max-long>
<min-lat>-14.234512</min-lat>
& Lt;max-lat>57.174187</max-lat>
</matchquakes>
≪/soapenv:body>
</soapenv:envelope>

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.