blob: aaacf512544ad956383afa674fcd6378f2206911 [file] [log] [blame]
<!DOCTYPE html>
<!--
| Generated by Apache Maven Doxia at 2015-07-03
| Rendered using Apache Maven Fluido Skin 1.3.0
-->
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="Date-Revision-yyyymmdd" content="20150703" />
<meta http-equiv="Content-Language" content="en" />
<title>Apache Axis &#x2013; Architecture Guide</title>
<link rel="stylesheet" href="./css/apache-maven-fluido-1.3.0.min.css" />
<link rel="stylesheet" href="./css/site.css" />
<link rel="stylesheet" href="./css/print.css" media="print" />
<script type="text/javascript" src="./js/apache-maven-fluido-1.3.0.min.js"></script>
</head>
<body class="topBarDisabled">
<div class="container-fluid">
<div id="banner">
<div class="pull-left">
<div id="bannerLeft">
<h2>Axis</h2>
</div>
</div>
<div class="pull-right"> <a href="./" id="bannerRight">
<img src="images/axis-small.png" alt="Apache Axis"/>
</a>
</div>
<div class="clear"><hr/></div>
</div>
<div id="breadcrumbs">
<ul class="breadcrumb">
<li class="">
<a href="http://www.apache.org/" class="externalLink" title="Apache">
Apache</a>
</li>
<li class="divider ">/</li>
<li class="">
<a href="../../" title="Axis">
Axis</a>
</li>
<li class="divider ">/</li>
<li class="">
<a href="../" title="Axis 1.x">
Axis 1.x</a>
</li>
<li class="divider ">/</li>
<li class="">
<a href="./" title="Java">
Java</a>
</li>
<li class="divider ">/</li>
<li class="">Architecture Guide</li>
<li id="publishDate" class="pull-right">Last Published: 2015-07-03</li> <li class="divider pull-right">|</li>
<li id="projectVersion" class="pull-right">Version: 1.4.1-SNAPSHOT</li>
</ul>
</div>
<div class="row-fluid">
<div id="leftColumn" class="span3">
<div class="well sidebar-nav">
<ul class="nav nav-list">
<li class="nav-header">About</li>
<li>
<a href="index.html" title="Introduction">
<i class="none"></i>
Introduction</a>
</li>
<li>
<a href="issue-tracking.html" title="Issue Tracking">
<i class="none"></i>
Issue Tracking</a>
</li>
<li>
<a href="mail-lists.html" title="Mailing Lists">
<i class="none"></i>
Mailing Lists</a>
</li>
<li>
<a href="source-repository.html" title="Source Repository">
<i class="none"></i>
Source Repository</a>
</li>
<li>
<a href="artifacts.html" title="Artifacts & Dependencies">
<i class="none"></i>
Artifacts & Dependencies</a>
</li>
<li>
<a href="apiDocs/index.html" title="Javadocs">
<i class="none"></i>
Javadocs</a>
</li>
<li class="nav-header">Downloads</li>
<li>
<a href="releases.html" title="Releases">
<i class="none"></i>
Releases</a>
</li>
<li>
<a href="changelog.html" title="Changelogs">
<i class="icon-chevron-right"></i>
Changelogs</a>
</li>
<li>
<a href="snapshots.html" title="Snapshots">
<i class="none"></i>
Snapshots</a>
</li>
<li class="nav-header">Documentation</li>
<li>
<a href="overview.html" title="Overview">
<i class="none"></i>
Overview</a>
</li>
<li>
<a href="install.html" title="Installation">
<i class="none"></i>
Installation</a>
</li>
<li>
<a href="user-guide.html" title="User's Guide">
<i class="none"></i>
User's Guide</a>
</li>
<li>
<a href="developers-guide.html" title="Developer's Guide">
<i class="none"></i>
Developer's Guide</a>
</li>
<li>
<a href="integration-guide.html" title="Integration Guide">
<i class="none"></i>
Integration Guide</a>
</li>
<li class="active">
<a href="#"><i class="none"></i>Architecture Guide</a>
</li>
<li>
<a href="reference.html" title="Reference Guide">
<i class="none"></i>
Reference Guide</a>
</li>
<li>
<a href="reading.html" title="Reading Guide">
<i class="none"></i>
Reading Guide</a>
</li>
<li class="nav-header">More...</li>
<li>
<a href="ant/ant.html" title="Ant Tasks">
<i class="none"></i>
Ant Tasks</a>
</li>
<li>
<a href="maven/index.html" title="Maven Plugins">
<i class="none"></i>
Maven Plugins</a>
</li>
<li>
<a href="castor/index.html" title="Castor Databinding">
<i class="none"></i>
Castor Databinding</a>
</li>
<li>
<a href="xmlbeans/index.html" title="XmlBeans Databinding">
<i class="none"></i>
XmlBeans Databinding</a>
</li>
<li>
<a href="transports/jms/index.html" title="JMS Transport">
<i class="none"></i>
JMS Transport</a>
</li>
<li>
<a href="transports/http-hc3/index.html" title="HttpClient 3 Transport">
<i class="none"></i>
HttpClient 3 Transport</a>
</li>
<li>
<a href="transports/http-javanet/index.html" title="java.net HTTP Transport">
<i class="none"></i>
java.net HTTP Transport</a>
</li>
<li>
<a href="standalone-server/index.html" title="Stand-alone Server">
<i class="none"></i>
Stand-alone Server</a>
</li>
<li class="nav-header">Apache</li>
<li>
<a href="http://www.apache.org/licenses/LICENSE-2.0.html" class="externalLink" title="License">
<i class="none"></i>
License</a>
</li>
<li>
<a href="http://www.apache.org/foundation/sponsorship.html" class="externalLink" title="Sponsorship">
<i class="none"></i>
Sponsorship</a>
</li>
<li>
<a href="http://www.apache.org/foundation/thanks.html" class="externalLink" title="Thanks">
<i class="none"></i>
Thanks</a>
</li>
<li>
<a href="http://www.apache.org/security/" class="externalLink" title="Security">
<i class="none"></i>
Security</a>
</li>
</ul>
<form id="search-form" action="http://www.google.com/search" method="get" >
<input value="ws.apache.org/axis/java" name="sitesearch" type="hidden"/>
<input class="search-query" name="q" id="query" type="text" />
</form>
<script type="text/javascript" src="http://www.google.com/coop/cse/brand?form=search-form"></script>
<hr class="divider" />
<div id="poweredBy">
<div class="clear"></div>
<div class="clear"></div>
<div class="clear"></div>
<a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy">
<img class="builtBy" alt="Built by Maven" src="./images/logos/maven-feather.png" />
</a>
</div>
</div>
</div>
<div id="bodyColumn" class="span9" >
<!-- ~ Licensed to the Apache Software Foundation (ASF) under one
~ or more contributor license agreements. See the NOTICE file
~ distributed with this work for additional information
~ regarding copyright ownership. The ASF licenses this file
~ to you under the Apache License, Version 2.0 (the
~ "License"); you may not use this file except in compliance
~ with the License. You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing,
~ software distributed under the License is distributed on an
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
~ KIND, either express or implied. See the License for the
~ specific language governing permissions and limitations
~ under the License. -->
<div class="section">
<h2><a name="Table_of_Contents"></a>Table of Contents</h2>
<ul>
<li><a href="#Table_of_Contents">Table of Contents</a></li>
<li><a href="#Introduction">Introduction</a></li>
<li><a href="#Architectural_Overview">Architectural Overview</a>
<ul>
<li><a href="#Handlers_and_the_Message_Path_in_Axis">Handlers and the Message Path in Axis</a></li>
<li><a href="#Message_Path_on_the_Server">Message Path on the Server</a></li>
<li><a href="#Message_Path_on_the_Client">Message Path on the Client</a></li></ul></li>
<li><a href="#Subsystems">Subsystems</a></li>
<li><a href="#Message_Flow_Subsystem">Message Flow Subsystem</a>
<ul>
<li><a href="#Handlers_and_Chains">Handlers and Chains</a>
<ul>
<li><a href="#Targeted_Chains">Targeted Chains</a></li>
<li><a href="#Fault_Processing">Fault Processing</a></li></ul></li>
<li><a href="#Message_Contexts">Message Contexts</a></li>
<li><a href="#Engine">Engine</a>
<ul>
<li><a href="#Engine_Configuration">Engine Configuration</a></li></ul></li></ul></li>
<li><a href="#Administration_Subsystem">Administration Subsystem</a>
<ul>
<li><a href="#WSDD-Based_Administration">WSDD-Based Administration</a></li></ul></li>
<li><a href="#Message_Model_Subsystem">Message Model Subsystem</a>
<ul>
<li><a href="#SOAP_Message_Model">SOAP Message Model</a></li>
<li><a href="#Message_Elements">Message Elements</a></li>
<li><a href="#Deserialization">Deserialization</a></li></ul></li>
<li><a href="#Encoding_Subsystem">Encoding Subsystem</a></li>
<li><a href="#WSDL_Tools_Subsystem">WSDL Tools Subsystem</a>
<ul>
<li><a href="#WSDL2Java">WSDL2Java</a></li>
<li><a href="#Java2WSDL">Java2WSDL</a></li></ul></li>
<li><a href="#Interaction_Diagrams">Interaction Diagrams</a>
<ul>
<li><a href="#Client_Side_Processing">Client Side Processing</a></li></ul></li>
<li><a href="#Pluggable-Component_Discovery">Pluggable-Component Discovery</a></li>
<li><a href="#Open_Issues">Open Issues</a></li></ul>
</div>
<div class="section">
<h2><a name="Introduction"></a>Introduction</h2>
<p>This guide records some of the rationale of the architecture and design of Axis.</p>
</div>
<div class="section">
<h2><a name="Architectural_Overview"></a>Architectural Overview</h2>
<p>Axis consists of several subsystems working together, as we shall see later. In this section we'll give you an overview of how the core of Axis works.</p>
<div class="section">
<h3><a name="Handlers_and_the_Message_Path_in_Axis"></a>Handlers and the Message Path in Axis</h3>
<p>Put simply, Axis is all about processing Messages. When the central Axis processing logic runs, a series of <b>Handlers</b> are each invoked in order. The particular order is determined by two factors - deployment configuration and whether the engine is a client or a server. The object which is passed to each Handler invocation is a <b>MessageContext</b>. A MessageContext is a structure which contains several important parts: 1) a &quot;request&quot; message, 2) a &quot;response&quot; message, and 3) a bag of properties. More on this in a bit.</p>
<p>There are two basic ways in which Axis is invoked:</p>
<ol style="list-style-type: decimal">
<li>As a <b>server</b>, a <b>Transport Listener</b> will create a MessageContext and invoke the Axis processing framework.</li>
<li>As a <b>client</b>, application code (usually aided by the client programming model of Axis) will generate a MessageContext and invoke the Axis processing framework.</li>
</ol>
<p>In either case, the Axis framework's job is simply to pass the resulting MessageContext through the configured set of Handlers, each of which has an opportunity to do whatever it is designed to do with the MessageContext.</p>
</div>
<div class="section">
<h3><a name="Message_Path_on_the_Server"></a>Message Path on the Server</h3>
<p>The server side message path is shown in the following diagram. The small cylinders represent Handlers and the larger, enclosing cylinders represent <b>Chains</b> (ordered collections of Handlers which will be described shortly).</p>
<p><img src="images/ServerMessagePath.jpg" vspace="30" height="282" width="602" alt="ServerMessagePath" /></p>
<p>A message arrives (in some protocol-specific manner) at a Transport Listener. In this case, let's assume the Listener is a HTTP servlet. It's the Listener's job to package the protocol-specific data into a <b>Message</b> object (org.apache.axis.Message), and put the Message into a <b>MessageContext</b>. The MessageContext is also loaded with various <b>properties</b> by the Listener - in this example the property &quot;http.SOAPAction&quot; would be set to the value of the SOAPAction HTTP header. The Transport Listener also sets the <b>transportName</b> String on the MessageContext , in this case to &quot;http&quot;. Once the MessageContext is ready to go, the Listener hands it to the AxisEngine.</p>
<p>The AxisEngine's first job is to look up the transport by name. The transport is an object which contains a <b>request</b> Chain, a <b>response</b> Chain, or perhaps both. A <b>Chain</b> is a Handler consisting of a sequence of Handlers which are invoked in turn -- more on Chains later. If a transport request Chain exists, it will be invoked, passing the MessageContext into the invoke() method. This will result in calling all the Handlers specified in the request Chain configuration.</p>
<p>After the transport request Handler, the engine locates a global request Chain, if configured, and then invokes any Handlers specified therein.</p>
<p>At some point during the processing up until now, some Handler has hopefully set the <b>serviceHandler</b> field of the MessageContext (this is usually done in the HTTP transport by the &quot;URLMapper&quot; Handler, which maps a URL like &quot;http://localhost/axis/services/AdminService&quot; to the &quot;AdminService&quot; service). This field determines the Handler we'll invoke to execute service-specific functionality, such as making an RPC call on a back-end object. Services in Axis are typically instances of the &quot;SOAPService&quot; class (org.apache.axis.handlers.soap.SOAPService), which may contain <b>request</b> and <b>response</b> Chains (similar to what we saw at the transport and global levels), and must contain a <b>provider</b>, which is simply a Handler responsible for implementing the actual back end logic of the service.</p>
<p>For RPC-style requests, the provider is the org.apache.axis.providers.java.RPCProvider class. This is just another Handler that, when invoked, attempts to call a backend Java object whose class is determined by the &quot;className&quot; parameter specified at deployment time. It uses the SOAP RPC convention for determining the method to call, and makes sure the types of the incoming XML-encoded arguments match the types of the required parameters of the resulting method.</p>
</div>
<div class="section">
<h3><a name="Message_Path_on_the_Client"></a>Message Path on the Client</h3>
<p>The Message Path on the client side is similar to that on the server side, except the order of scoping is reversed, as shown below.</p>
<p><img src="images/ClientMessagePath.jpg" vspace="30" height="281" width="592" alt="ClientMessagePath" /></p>
<p>The <b>service</b> Handler, if any, is called first - on the client side, there is no &quot;provider&quot; since the service is being provided by a remote node, but there is still the possibility of request and response Chains. The service request and response Chains perform any service-specific processing of the request message on its way out of the system, and also of the response message on its way back to the caller.</p>
<p>After the service request Chain, the global request Chain, if any, is invoked, followed by the transport. The <b>Transport Sender</b>, a special Handler whose job it is to actually perform whatever protocol-specific operations are necessary to get the message to and from the target SOAP server, is invoked to send the message. The response (if any) is placed into the responseMessage field of the MessageContext, and the MessageContext then propagates through the response Chains - first the transport, then the global, and finally the service.</p>
</div>
</div>
<div class="section">
<h2><a name="Subsystems"></a>Subsystems</h2>
<p>Axis comprises several subsystems working together with the aim of separating responsibilities cleanly and making Axis modular. Subsystems which are properly layered enable parts of a system to be used without having to use the whole of it (or hack the code).</p>
<p>The following diagram shows the layering of subsystems. The lower layers are independent of the higher layers. The 'stacked' boxes represent mutually independent, although not necessary mutually exclusive, alternatives. For example, the HTTP, SMTP, and JMS transports are independent of each other but may be used together.</p>
<p><img src="images/subsystems.jpg" alt="subsystems" /></p>
<p>In fact, the Axis source code is not as cleanly separated into subsystems as the above diagram might imply. Some subsystems are spread over several packages and some packages overlap more than one subsystem. Proposals to improve the code structure and make it conform more accurately to the notional Axis subsystems will be considered when we get a chance.</p>
</div>
<div class="section">
<h2><a name="Message_Flow_Subsystem"></a>Message Flow Subsystem</h2>
<div class="section">
<h3><a name="Handlers_and_Chains"></a>Handlers and Chains</h3>
<p>Handlers are invoked in sequence to process messages. At some point in the sequence a Handler may send a request and receive a response or else process a request and produce a response. Such a Handler is known as the <i>pivot point</i> of the sequence. As described above, Handlers are either transport-specific, service-specific, or global. The Handlers of each of these three different kinds are combined together into Chains. So the overall sequence of Handlers comprises three Chains: transport, global, and service. The following diagram shows two sequences of handlers: the client-side sequence on the left and the server-side sequence on the right.</p>
<p><img src="images/pivots.jpg" height="240" width="403" alt="pivots" /></p>
<p>A web service does not necessarily send a response message to each request message, although many do. However, response Handlers are still useful in the message path even when there isn't a response message, e.g. to stop timers, clean up resources, etc.</p>
<p>A Chain is a composite Handler, i.e. it aggregates a collection of Handlers as well as implementing the Handler interface as shown in the following UML diagram:</p>
<p><img src="images/chainclasses.jpg" alt="chainclasses" /></p>
<p>A Chain also has similarities to the Chain of Responsibility design pattern in which a request flows along a sequence of Handlers until it is processed. Although an Axis Chain may process a request in stages over a succession of Handlers, it has the same advantages as Chain of Responsibility: flexibility and the ease with which new function can be added.</p>
<p>Back to message processing -- a message is processed by passing through the appropriate Chains. A message context is used to pass the message and associated environment through the sequence of Handlers. The model is that Axis Chains are constructed offline by having Handlers added to them one at a time. Then they are turned online and message contexts start to flow through the Chains. Multiple message contexts may flow through a single Chain concurrently. Handlers are never added to a Chain once it goes online. If a Handler needs to be added or removed, the Chain must be 'cloned', the modifications made to the clone, and then the clone made online and the old Chain retired when it is no longer in use. Message contexts that were using the old Chain continue to use it until they are finished. This means that Chains do not need to cope with the addition and removal of Handlers while the Chains are processing message contexts -- an important simplification.</p>
<p>The deployment registry has factories for Handlers and Chains. Handlers and Chains can be defined to have 'per-access', 'per-request', or 'singleton' scope although the registry currently only distinguishes between these by constructing non-singleton scope objects when requested and constructing singleton scope objects once and holding on to them for use on subsequent creation requests.</p>
<div class="section">
<h4><a name="Targeted_Chains"></a>Targeted Chains</h4>
<p>A <b>Targeted Chain</b> is a special kind of chain which may have any or all of: a request Handler, a pivot Handler, and a response Handler. The following class diagram shows how Targeted Chains relate to Chains. Note that a Targeted Chain is an aggregation of Handlers by virtue of extending the Chain interface which is an aggregation of Handlers.</p>
<p><img src="images/targetedchainclasses.jpg" alt="targetedchainclasses" /></p>
<p>A service is a special kind of Targeted Chain in which the pivot Handler is known as a &quot;provider&quot;.</p>
</div>
<div class="section">
<h4><a name="Fault_Processing"></a>Fault Processing</h4>
<p>Now let's consider what happens when a fault occurs. The Handlers prior to the Handler that raised the fault are driven, in reverse order, for onFault (previously misnamed 'undo'). The scope of this backwards scan is interesting: all Handlers previously invoked for the current Message Context are driven.</p>
<p><i>Need to explain how &quot;FaultableHandlers&quot; and &quot;WSDD Fault Flows&quot; fit in.</i></p>
</div></div>
<div class="section">
<h3><a name="Message_Contexts"></a>Message Contexts</h3>
<p>The current structure of a MessageContext is shown below. Each message context may be associated with a request Message and/or a response Message. Each Message has a SOAPPart and an Attachments object, both of which implement the Part interface.</p>
<p><img src="images/messagecontext.jpg" alt="messagecontext" /></p>
<p>The typing of Message Contexts needs to be carefully considered in relation to the Axis architecture. Since a Message Context appears on the Handler interface, it should not be tied to or biassed in favour of SOAP. The current implementation is marginally biassed towards SOAP in that the setServiceHandler method narrows the specified Handler to a SOAPService.</p>
</div>
<div class="section">
<h3><a name="Engine"></a>Engine</h3>
<p>Axis has an abstract AxisEngine class with two concrete subclasses: AxisClient drives the client side handler chains and AxisServer drives the server side handler chains. The relationships between these classes is fairly simple:</p>
<p><img src="images/engineclasses.jpg" alt="engineclasses" /></p>
<div class="section">
<h4><a name="Engine_Configuration"></a>Engine Configuration</h4>
<p>The EngineConfiguration interface is the means of configuring the Handler factories and global options of an engine instance. An instance of a concrete implementation of EngineConfiguration must be passed to the engine when it is created and the engine must be notified if the EngineConfiguration contents are modified. The engine keeps a reference to the EngineConfiguration and then uses it to obtain Handler factories and global options.</p>
<p>The EngineConfiguration interface belongs to the Message Flow subsystem which means that the Message Flow subsystem does not depend on the Administration subsystem.</p>
</div></div>
</div>
<div class="section">
<h2><a name="Administration_Subsystem"></a>Administration Subsystem</h2>
<p>The Administration subsystem provides a way of configuring Axis engines. The configuration information an engine needs is a collection of factories for runtime artefacts such as Chains and SOAPServices and a set of global configuration options for the engine.</p>
<p>The Message Flow subsystem's EngineConfiguration interface is implemented by the Administration subsystem. FileProvider enables an engine to be configured statically from a file containing a deployment descriptor which is understood by the WSDDDeployment class. SimpleProvider, on the other hand, enables an engine to be configured dynamically.</p>
<p><img src="images/engineconfig.jpg" alt="engineconfig" /></p>
<div class="section">
<h3><a name="WSDD-Based_Administration"></a>WSDD-Based Administration</h3>
<p>WSDD is an XML grammer for deployment descriptors which are used to statically configure Axis engines. Each Handler needs configuration in terms of the concrete class name of a factory for the Handler, a set of options for the handler, and a lifecycle scope value which determines the scope of sharing of instances of the Handler.</p>
<p>The structure of the WSDD grammar is mirrored by a class hierarchy of factories for runtime artefacts. The following diagram shows the classes and the types of runtime artefacts they produce (a dotted arrow means &quot;instantiates&quot;).</p>
<p><img src="images/wsddclasses.jpg" alt="wsddclasses" /></p>
</div>
</div>
<div class="section">
<h2><a name="Message_Model_Subsystem"></a>Message Model Subsystem</h2>
<div class="section">
<h3><a name="SOAP_Message_Model"></a>SOAP Message Model</h3>
<p>The XML syntax of a SOAP message is fairly simple. A SOAP message consists of an <i>envelope</i> containing:</p>
<ul>
<li>an optional <i>header</i> containing zero or more <i>header entries</i> (sometimes ambiguously referred to as <i>headers</i>),</li>
<li>a <i>body</i> containing zero or more <i>body entries</i>, and</li>
<li>zero or more additional, non-standard elements.</li>
</ul>
<p>The only body entry defined by SOAP is a <i>SOAP fault</i> which is used for reporting errors.</p>
<p>Some of the XML elements of a SOAP message define namespaces, each in terms of a URI and a local name, and encoding styles, a standard one of which is defined by SOAP.</p>
<p>Header entries may be tagged with the following optional SOAP attributes:</p>
<ul>
<li><i>actor</i> which specifies the intended recipient of the header entry in terms of a URI, and</li>
<li><i>mustUnderstand</i> which specifies whether or not the intended recipient of the header entry is required to process the header entry.</li>
</ul>
<p>So the SOAP message model looks like this:</p>
<p><img src="images/soapmessagemodel.jpg" alt="soapmessagemodel" /></p>
</div>
<div class="section">
<h3><a name="Message_Elements"></a>Message Elements</h3>
<p>The classes which represent SOAP messages form a class hierarchy based on the MessageElement class which takes care of namespaces and encodings. The SOAPHeaderElement class looks after the actor and mustUnderstand attributes.</p>
<p><img src="images/messagemodelclasses.jpg" alt="messagemodelclasses" /></p>
<p>During deserialization, a parse tree is constructed consisting of instances of the above classes in parent-child relationships as shown below.</p>
<p><img src="images/messagetree.jpg" alt="messagetree" /></p>
</div>
<div class="section">
<h3><a name="Deserialization"></a>Deserialization</h3>
<p>The class mainly responsible for XML parsing, i.e. deserialization, is DeserializationContext ('DC'). DC manages the construction of the parse tree and maintains a stack of SAX handlers, a reference to the MessageElement that is currently being deserialized, a stack of namespace mappings, a mapping from IDs to elements, a set of type mappings for deserialization (see <a href="#EncodingSubsystem">Encoding Subsystem</a>) and a SAX event recorder. </p>
<p>Elements that we scan over, or ones for which we don't have a particular deserializer, are recorded - in other words, the SAX events are placed into a queue which may be 'played back' at a later time to any SAX ContentHandler.</p>
<p>Once a SOAPEnvelope has been built, either through a parse or manual construction by the user, it may be output using a SerializationContext (also see <a href="#EncodingSubsystem">Encoding Subsystem</a>). MessageElements all have an output() method which lets them write out their contents.</p>
<p>The SAX handlers form a class hierarchy:</p>
<p><img src="images/SAXHandlerClasses.jpg" alt="SAXHandlerClasses" /></p>
<p>and stack up as shown in the following diagram:</p>
<p><img src="images/SAXhandlers.jpg" alt="SAXhandlers" /></p>
<p>Initially, the SAX handler stack just contains an instance of EnvelopeHandler which represents the fact that parsing of the SOAP envelope has not yet started. The EnvelopeHandler is constructed with a reference to an EnvelopeBuilder, which is the SAX handler responsible for parsing the SOAP envelope.</p>
<p>During parsing, DC receives the events from the SAX parser and notifies either the SAX handler on the top of its handler stack, the SAX event recorder, or both.</p>
<p>On the start of an element, DC calls the SAX handler on the top of its handler stack for onStartChild. This method returns a SAX handler to be used to parse the child, which DC pushes on its SAX handler stack and calls for startElement. startElement, amongst other things, typically creates a new MessageElement of the appropriate class and calls DC for pushNewElement. The latter action creates the parent-child relationships of the parse tree. </p>
<p>On the end of an element, DC pops the top SAX handler from its handler stack and calls it for endElement. It then drives SAX handler which is now on the top of the handler stack for onEndChild. Finally, it sets the MessageElement that is currently being deserialized to the parent of the current one.</p>
<p>Elements which are not defined by SOAP are treated using a SOAPHandler as a SAX event handler and a MessageElement as a node in the parse tree.</p>
</div>
</div>
<div class="section">
<h2><a name="Encoding_Subsystem"></a>Encoding Subsystem</h2>
<p>Encoding is most easily understood from the bottom up. The basic requirement is to transform between values of programming language datatypes and their XML representations. In Axis, this means encoding (or 'serializing') Java objects and primitives into XML and decoding (or 'deserializing') XML into Java objects and primitives. The basic classes that implement these steps are <i>serializers</i> and <i>deserializers</i>.</p>
<p><img src="images/serclasses.jpg" alt="serclasses" /></p>
<p>Particular serializers and deserializers are written to support a specific XML processing mechanism such as DOM or SAX. So <i>serializer factories</i> and <i>deserializer factories</i> are introduced to construct serializers and deserializers for a XML processing mechanism which is specified as a parameter.</p>
<p><img src="images/serfactoryclasses.jpg" alt="serfactoryclasses" /></p>
<p>As is apparent from the above class diagrams, each pair of Java type and XML data type which needs encoding and decoding requires specific serializers and deserializers (actually one of each per XML processing mechanism). So we need to maintain a mapping from a pair of Java type and XML data type, identified by a QName, to a serializer factory and a deserializer factory. Such a mapping is known as a <i>type mapping</i>. The type mapping class hierarchy is shown below. Notice how the default type mapping instantiates the various serializer and deserialiser factories.</p>
<p><img src="images/typemappingclasses.jpg" alt="typemappingclasses" /></p>
<p>There is one final level of indirection. How do we know which type mapping to use for a particular message? This is determined by the encoding which is specified in the message. A <i>type mapping registry</i> maintains a map from encoding name (URI) to type mapping. Note that the XML data type QNames are defined by the encoding.</p>
<p><img src="images/typemappingclasses.jpg" alt="typemappingclasses" /></p>
<p>So, in summary, to encode a Java object or primitive data value to a XML datatype or to decode the latter to the former, we need to know:</p>
<ul>
<li>the Java type we are dealing with,</li>
<li>the QName of the XML data type we want to encode it as,</li>
<li>the XML processing mechanism we are using, and</li>
<li>the encoding name.</li>
</ul>
</div>
<div class="section">
<h2><a name="WSDL_Tools_Subsystem"></a>WSDL Tools Subsystem</h2>
<p>The WSDL Tools subsystem contains WSDL2Java and Java2WSDL. The Axis runtime does not depend on these tools -- they are just there to make life easier for the user. </p>
<div class="section">
<h3><a name="WSDL2Java"></a>WSDL2Java</h3>
<p>This tool takes a description of a web service written in WSDL and emits Java artefacts used to access the web service.</p>
<p>There are three layers inside the tool:</p>
<ul>
<li>framework: SymbolTable, Emitter, WriterFactory</li>
<li>WSDL2Java plugin to the framework: WSDL2Java (the main), JavaWriterFactory, and all the WSDL-relative writers: JavaPortTypeWriter, JavaBindingWriter, etc.</li>
<li>The actual WSDL2Java emitters, one for each file generated: JavaInterfaceWriter, JavaStubWriter, etc.</li>
</ul>
</div>
<div class="section">
<h3><a name="Java2WSDL"></a>Java2WSDL</h3>
<p>tbd.</p>
</div>
</div>
<div class="section">
<h2><a name="Interaction_Diagrams"></a>Interaction Diagrams</h2>
<div class="section">
<h3><a name="Client_Side_Processing"></a>Client Side Processing</h3>
<p>The client side Axis processing constructs a Call object with associated Service, MessageContext, and request Message as shown below before invoking the AxisClient engine.</p>
<p><img src="images/clientobjects.jpg" height="120" width="349" alt="clientobjects" /></p>
<p>An instance of Service and its related AxisClient instance are created before the Call object. The Call object is then created by invoking the Service.createCall <i>factory method</i>. Call.setOperation creates a Transport instance, if a suitable one is not already associated with the Call instance. Then Call.invoke creates a MessageContext and associated request Message, drives AxisClient.invoke, and processes the resultant MessageContext. This significant method calls in this sequence are shown in the following interaction diagram.</p>
<p><img src="images/clientinteraction.jpg" height="503" width="731" alt="clientinteraction" /></p>
</div>
</div>
<div class="section">
<h2><a name="Pluggable-Component_Discovery"></a>Pluggable-Component Discovery</h2>
<p>While most pluggable components infrastructures (jaxp/xerces, commons-logging, etc) provide discovery features, it is foreseen that there are situations where these may evolve over time. For example, as leading-edge technologies are reworked and adopted as standards, discovery mechanisms are likely to change.</p>
<p>Therefore, component discovery must be relegated to a <b>single</b> point of control within AXIS, typically an AXIS-specific factory method. These factory methods should conform to current standards, when available. As technologies evolve and/or are standardized, the factory methods should be kept up-to-date with appropriate discovery mechanisms.</p>
</div>
<div class="section">
<h2><a name="Open_Issues"></a>Open Issues</h2>
<ol style="list-style-type: decimal">
<li>The relationship between the Axis subsystems needs to be documented and somewhat cleaned up as there is leakage of responsibilities between some of the subsystems. For example, there is some SOAP and HTTP bias in the basic MessageContext type and associated classes.</li>
<li>What classes are included in the &quot;encoding&quot; subsystem? Are the encoding and message model subsystems independent of the other subsystems which depend on &quot;message flow&quot;?</li>
<li>(Possibly related to the previous issue) How should we distribute the classes in the above diagram between the Axis subsystems taking into account SOAP-specific and HTTP-specific features?</li>
<li>The Axis Engine currently knows about three layers of handlers: transport, global, and service. However, architecturally, this is rather odd. What &quot;law&quot; of web services ensures that there will always and only ever be <i>three</i> layers? It would be more natural to use Targeted Chains with their more primitive notion of request, pivot, and response Handlers. We would then implemented the Axis Engine as a Targeted Chain whose pivot Handler is itself a Targeted Chain with global request and response Handlers and a service pivot Handler (which is itself a Targeted Chain as we have just described). Such an Axis Engine architecture is shown in the diagram below.
<p><img src="images/stcengine.jpg" height="312" width="667" alt="stcengine" /></p>
</li>
<li>WSDDService.faultFlows is initialised to an empty Vector and there is no way of adding a fault flow to it. Is this dead code or is something else missing?</li>
<li>If a fault occurs after the pivot Handler, should the backwards scan notify Handlers which were invoked prior to the pivot Handler? The current implementation does notify such Handlers. However, this is not consistent with the processing of faults raised in a downstream system and stored in the message context by the pivot Handler. These faults are passed through any response Handlers, but do not cause onFault to be driven in the local engine.
<p>We need to consider what's going on here. If you take a sequence of Handlers and then introduce a distribution boundary into the sequence, what effect should that have on the semantics of the sequence in terms of its effects on message contexts? The following diagram shows a client-side
Handler sequence invoking a server-side Handler sequence. We need to consider how the semantics of this combined sequence compares with the sequence formed by omitting the transport-related Handlers.</p>
<p><img src="images/pivots2.jpg" height="413" width="658" alt="pivots2" /></p>
</li>
</ol>
</div>
</div>
</div>
</div>
<hr/>
<footer>
<div class="container-fluid">
<div class="row span12">Copyright &copy; 2000-2015
<a href="http://www.apache.org/">The Apache Software Foundation</a>.
All Rights Reserved.
</div>
</div>
</footer>
</body>
</html>