( A ----<> B says, B has 1 or more objects of A. A------>B says, the given relationship holds between A and B.)
There may be other handlers in any of these phases. Users may use custom handlers to override the mechanics in each of these phases.
First, an AxisService is populated from a WSDL. Then the code generator extracts information from the AxisService and creates an XML, which is language independent. This emitted XML is then parsed with the relevant XSL to generate code for the relevant language.
Databinding has not been included in the core deliberately, and hence the code generation allows different data binding frameworks to be plugged in. This is done through an extension mechanism where the codegen engine first calls the extensions and then executes the core emitter.
Introduction:<br />Apache Axis2/C is a Web services engine implemented in the C programming language.<br />Apache Axis2/C can be used to provide and consume Web Services. It has been implemented with portability and ability to embed in mind, hence could be used as a Web services enabler in other software.<br />The extensible design allows it to support the full WS-* stack with the concept of modules.<br />Apache Axis2/C is the Web services engine that supports the most number of WS-* specification implementations in C, with guaranteed interoperability.<br />
Features:<br />Support for one-way messaging (In-Only) and request response messaging (In-Out).<br />Client APIs: Easy to use service client API and more advanced operation client API.<br />Module architecture, mechanism to extend the SOAP processing model.<br />WS-Addressing support, both the submission (2004/08) and final (2005/08) versions, implemented as a module,<br />MTOM/XOP support.<br />XPathsupport for Axiom XML Object model.<br />AXIOM, an XML object model optimized for SOAP 1.1/1.2 messages; This has complete XML infosetsupport.<br />
Transport proxy support.<br />REST support (more POX like) using both HTTP POST and GET .<br />WS-Policy implementation called Neethi/C, with WS-SecurityPolicyextension.<br />TCP Transport, for both client and server side .<br />Transports supported: HTTP Inbuilt HTTP server called simple axis server<br />Apache2 httpd module called mod_axis2 for server side<br />IIS module for server side. Supports IIS 5.1, 6 and 7<br />Client transport with ability to enable SSL support<br />Basic HTTP Authentication<br />AMQP Transport based on Apache Qpid (Experimental)<br />libcurl based client transport<br />CGI interface<br />
Architecture:<br />The Big Picture…<br />Each SOAP Node may be written in specific programming language, may it be Java, C++, .NET or Perl, but the Web services allow them to interoperate. This is possible because on the wire each Web service interaction is done via SOAP, which is common to every SOAP Node.<br />
Axis2 architecture lays out some principals to preserve the uniformity. They are as follows: <br />Axis2 architecture separates the logic and the states. Code that does the processing does not have a state inside Axis2. This allows code to be executed freely by parallel threads.<br />All the information is kept in one information model, allowing the system to be suspended and resumed.<br />
Core Modules:<br />Information Model:<br />Axis2 defines a model to handle information and all states are kept in this model. The model consists of a hierarchy of information. The system manages the life cycle of the objects in this hierarchy.<br />Information Model has two main hierarchies-Contexts and Descriptions. These two hierarchies create a model that provides the ability to search for key value pairs. <br />
XML Processing Model:<br />AXIOM(Axis Object Model) – <br />AXIOM is a lightweight, differed built XML infoset representation based on StAX API derived from JSR 173, which is the standard streaming pull parser API.<br />FEATURES:<br />Lightweight<br />Pull - Based<br />
SOAP Processing Model:<br />The architecture identified two basic actions a SOAP processor should perform, sending and receiving SOAP messages. The architecture provides two Pipes ('Flows'), to perform these two basic actions. The Axis Engine or the driver of Axis2 defines two methods send() and receive() to implement these two Pipes. The two pipes are named In Pipe and Out Pipe, and the complex Message Exchange Patterns (MEPs) are constructed by combining these two pipes.<br />
Axis2 Default Processing Model:<br />Axis2 has some inbuilt handlers that run in inbuilt phases and they create the default configuration for Axis2. We will be looking more in to how to extend the default processing Model in the next section.<br />There are three special handlers defined in Axis2. <br />Dispatchers - Finds the service and the operation the SOAP message is directed to. Dispatchers always run on the In-Pipe and inside the Dispatch phase. The in-built dispatchers dispatch to a particular operation depending on various conditions like WS-Addressing information, URI information, SOAP action information, etc. ( See more information on Dispatching)<br />Message Receiver - Consumes the SOAP message and hands it over to the application. The message receiver is the last handler of the in-pipe<br />Transport Sender - Sends the SOAP message to the SOAP endpoint the message is destined to. Always runs as the last handler in the out-pipe<br />
Processing an Incoming SOAP Message:<br />An incoming SOAP message is always received by a Transport Receiver waiting for the SOAP messages. Once the SOAP message arrives, the transport Headers are parsed and a Message Context is created from the incoming SOAP message. This message context encapsulates all the information, including the SOAP message itself, transport headers, etc., inside it. Then the In Pipe is executed with the Message Context.<br />
Let us see what happens at each phase of the execution. This process can happen in the server or in the client.<br />Transport Phase - The handlers are in the phase that processes transport specific information such as validating incoming messages by looking at various transport headers, adding data into message context, etc.<br />Pre-Dispatch Phase- The main functionality of the handlers in this phase is to populate message context to do the dispatching. For example, processing of addressing headers of the SOAP message, if any, happens in this phase. Addressing handlers extract information and put them in to the message context.<br />Dispatch Phase - The Dispatchers run in this phase and try to find the correct service and operation this particular message is destined for.The post condition of the dispatch phase (any phase can contain a post condition) checks whether a service and an operation were found by the dispatchers. If not, the execution will halt and give a "service not found' error.<br />User Defined Phases - Users can engage their custom handlers here.<br />Message Validation Phase - Once the user level execution has taken place, this phase validates whether SOAP Message Processing has taken place correctly.<br />Message Processing Phase - The Business logic of the SOAP message is executed here. A Message Receiver is registered with each Operation. This message receiver (associated to the particular operation) will be executed as the last handler of this phase.<br />
Processing of the Outgoing Message:<br />The Out Pipe is simpler because the service and the operation to dispatch are known by the time the pipe is executed. The Out Pipe may be initiated by the<br />Message Receiver or the Client API implementation. Phases of the Out Pipe are described below: <br />Message Initialize Phase - First phase of the Out Pipe. Serves as the placeholder for the custom handlers.<br />User Phases - Executes handlers in user-defined phases.<br />Transports Phase - Executes any transport handlers taken from the associated transport configuration. The last handler would be a transport sender which will send the SOAP message to the target endpoint.<br />
Extending the SOAP Processing Model with Handlers:<br />The handlers in a module can specify the phase they need to be placed in. Furthermore, they can specify their location inside a phase by providing phase rules. Phase rules will place a handler,<br />as the first handler in a phase,<br />as the last handler in a phase,<br />before a given handler,<br />or after a given handler.<br />
Extending the SOAP Processing Model with Modules<br />Axis2 defines an entity called a 'module' that can introduce handlers and Web service operations. A Module in terms of Axis2 usually acts as a convenient packaging that includes:<br />A set of handlers and<br />An associated descriptor which includes the phase rules<br />Modules have the concept of being 'available' and 'engaged'. 'Availability' means the module is present in the system, but has not been activated, The handlers will act in the same way as explained in the previous section. Usually a module will be used to implement a WS-* functionality such as WS-Addressing.<br />
Deployment Model:<br />The Deployment Model provides a concrete mechanism to configure Axis2. This model has three entities that provide the configuration.<br />The axis2.xml file <br />Service Archive<br />Module Archive<br />
Client API<br />There are three parameters that decide the nature of the Web service interaction.<br />Message Exchange Pattern (MEP)<br />The behavior of the transport, whether it's One-Way or Two-Way<br />Synchronous/ Asynchronous behavior of the Client API.<br />
Message Exchange pattern(MEP)<br />The two supported MEPs are One-Way and the In-Out (Request-Response) scenarios in the Client API. <br />One Way Messaging Support:<br />The One-Way support is provided by the fireAndForget method of ServiceClient. For one way invocations, one can use HTTP , SMTP and TCP transports. In the case of the HTTP transport, the return channel is not used, and the HTTP 202 OK is returned in the return channel.<br />In-Out (Request Response) Messaging Support:<br />The In-Out support is provided by the sendReceive() method in ServiceClient. This provides a simpler interface for the user. The Client API has four ways to configure a given message exchange.<br />Blocking or Non-Blocking nature<br />Sender transport<br />Listener transport <br />Use Separate Channel<br />
Transports<br />Axis2 has two basic constructs for transports, namely: Transport Senders and Transport Receivers.<br />Axis2 presently supports the following transports:<br />HTTP - In HTTP transport, the transport listener is a servlet or org.apache.axis2.transport.http.SimpleHTTPServer provided by Axis2. The transport sender uses commons-httpclient to connect and send the SOAP message.<br />TCP - This is the simplest transport, but needs the WS - Addressing support to be functional.<br />SMTP - This works off a single email account. Transport receiver is a thread that checks for emails in fixed time intervals.<br />JMS<br />
The following databinding extensions are available:<br />ADB - ADB (Axis Data Binding ) is a simple framework that allows simple schemas to be compiled. It is lightweight and simple, works off StAX and fairly performant. However, it does not support the complete set of schema constructs and is likely to complain for certain schemas!<br />XMLBeans - XMLbeans claims that it supports the complete schema specification, and it is preferred if full schema support is needed!<br />JAX-Me - JaxMe support has been added in a similar manner to XMLbeans and serves as another option for the user<br />JibX - This is the most recent addition to the family of databinding extensions, and it is also another option the users have for data binding.<br />