Showing posts with label Axis2. Show all posts
Showing posts with label Axis2. Show all posts

Saturday, May 14, 2016

Creating Web Service Using Axis2(Servlet.init() fir servlet AxisServlet threw exception)

When i tried to create Web Service using Axis2, i successfully get the Apache welcome page. But when i click the Services i got error like below,


I solve this by downloading xmlschema-core-2.2.1  and copy the xmlschema-core-2.2.1.jar file inside the lib folder and paste it to the project WebContent/WEB-INF/lib. Then right click --> Build path --> Configure Build Path

Then the Servlet.init is gone.

Friday, May 13, 2016

Axis 2

Axis 2 is a web service/SOAP/WSDL engine provided by Apache. It is a java based implementation.

Think about a bank doing day to day transactions on their hundreds of branches and each one of them are connected with each other. In this scenario, you can understand that the computing resources are “Distributed” among several locations (Branches). To achieve this kind of computing need, we use a Distributed Computing System in which the computers and resources are distributed in several physical and logical locations.

These systems need to be developed as separate systems but they need to be interconnected when needed and all of these systems should be accessible from the web interface which is present at the computers of bank officers. We can develop these systems as Services and then we can inter-connect these services in to a common architecture (platform). This kind of system is called as a Service Oriented Architecture (SOA).


Representation of what is happening inside an axis2 engine :



Handlers

Handler is the message interceptor. Which intercepts the messaging flow and does whatever task it is assigned to do. In fact, the interceptor is the smallest execution unit in a messaging system.

Handlers, in Axis, are stateless, meaning they do not keep their past execution states in memory.
Handler can read SOAP messages, remove elements from the message (mostly headers), add new elements (headers), or modify elements as well as add, delete,
or modify content from the Message Context.




Phases


The concept of a phase is introduced by Axis2 and it was mainly to support the dynamic ordering of handlers to provide better extensible, and better flexibility of the handler chain. A phase can be defined in various ways:
•  It can be considered as a logical collection of handlers
•  It can be considered as a specific time interval in the message execution
•  It can be considered as a bucket into which one can put his/her handler
•  One can consider a phase as a handler too


Pipe (Flow)

A flow is the message pipe where the message enters from one end of the flow and leaves from the other end of the flow. A flow or execution chain can be considered as a collection of phases.
At a very high level, what the engine really does is call the invoke method of each phase in a given flow, and then the phase will sequentially invoke all the handlers in it.

Axis2, Tomcat and Eclipse setup

Download Axis 2 WAR Distribution :

Find latest WAR Distribution and download it here 

Install WAR to Tomcat Server :

Extract WAR Distribution ZIP contents and Copy axis2.war to the webapps directory of your Tomcat installation.

Start Eclipse :

Navigate to Server view and start Tomcat,

In a browser navigate to http://localhost:8080/axis2,
Click Validate link – validation report shouldn’t contain any errors.

If any error comes,
Here is how I did it :

  1. Right click on my tomcat server in "Servers" view, select "Properties…"
  2. In the "General" panel, click on the "Switch Location" button
  3. The "Location: [workspace metadata]" bit should have been replaced by something else.
  4. Open (or close and reopen) the Overview screen for the server.