Axis-Mora is a server side java implementation of a SOAP engine. It reuses all the subsystems of Axis1.1 except deserialization part and introduces a new concept called "wrappers" that is used to eliminate reflection. If you are interested in what are the changes in axis-Mora please refer "Change-log"
Please send feedback about the axis-Mora to "axis-user@ws.apache.org". If you feel the code could use some new features or fixes, please get involved and lend a hand!
We welcome your participation in axis-Mora discussion at axis-user@ws.apache.org .
Axis-Mora uses pull structure for parsing xml. It eliminates reflection using a concept called "wrappers". Essentially the deserialization part of Axis1.1 has been replaced to produce Axis-Mora. Therefore it keeps all the key features of axis such as flexibility, stability, component-oriented deployment, transport framework and while it shows improvements in following areas.
Binary is not available. Source can be downloaded from the repository. See build guide
Let's invoke a simple web service. You can get the code from samples/usergiude/example1/TestClient. We have the client as follows in
1 package userguide.example1;
2
3 import javax.xml.namespace.QName;
4 import javax.xml.rpc.ParameterMode;
5 import org.apache.axis.client.Call;
6 import org.apache.axis.client.Service;
7 import org.apache.axis.encoding.XMLType;
8
9 public class TestClient {
10
11 public static void main(String[] args)throws Exception {
12 try{
13 String endpoint= "http://127.0.0.1:8080/axismora/servlet/AxisServlet";
14
15 String SOAPAction = "Echo"; //you have to specify the service name as 16 //SOAPAction
17 QName method = new QName("someuri", "echoString");
18
19 String echoString= args[0];
20
21 Service service = new Service();
22 Call call = (Call) service.createCall();
23 call.setOperationName(method);
24 call.setSOAPActionURI(SOAPAction);
25 call.addParameter("parameter", XMLType.XSD_STRING,ParameterMode.IN);
26 call.setReturnType(XMLType.XSD_STRING);
27 call.setTargetEndpointAddress(endpoint);
28 String ret = (String) call.invoke( new Object [] { echoString });
29 System.out.println("sent : '"+echoString + "', got :'"+ret+"'");
30 } catch (Exception e) {
31 System.err.println(e.toString());
32 }
33 }
34 }
This program could be run as follows,
% java userguide.example1.TestClient Hello
Sent :'Hello!', got :'Hello!'
%
So what's happening here? On lines 21 and 22 we create new Service and Call objects. These are the standard JAX-RPC objects that are used to store metadata about the service to invoke. on line 15, we specify the soapAction header and on line 24 we set up the soapAction header. Actually we send the service name through the soapAction header. On line 27, we set up our endpoint URL - this is the destination for our SOAP message. On line 17 we define the operation (method) name of the Web Service and we set that operation on the line 23. on line 26 we specify the return type. And on line 28 we actually invoke the desired service, passing in an array of parameters - in this case just one String.
Step 1 : We should deploy the web service in Axis-Mora first.
Open the "deploy.wsdd" in samples/services/Calculator/deploy.wsdd. It looks as follows.
<?xml version="1.0" encoding="UTF-8"?>
<deployment xmlns="http://xml.apache.org/axis/wsdd/"xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
<service name="Calculator" provider="java:RPC">
<parameter name="allowedMethods" value="*"/>
<parameter name="className" value="services.calculator.CalculatorService"/>
</service>
</deployment>
The outermost element tells the engine that this is a WSDD deployment, and defines the "java" namespace. Then the service element actually defines the service for us. Using these
Copy the contents within the
Open build/webapps/axismora/WEB-INF/mora-server.wsdd. Paste it as a immediate child of the
<deployment xmlns="http://xml ........>
<globalConfiguration>
....................
<service name="CalculatorService" provider="java:RPC">
...........................................
</service>
<transport name="http">
....................................................
</transport>
</deployment>
Step 2: Client implementation of axis-Mora is not available. Client of Axis1.1 could be used to send SOAP request to Axis-MORA.You can get the Test Client from samples/userguide/example2/TestClient To execute the client program run the program.
%java samples.userguide.example2.TestClient -llhttp://localhost
:8080/axis/services/Calculator add 2 3
The result : 5
Axis-Mora supports WSDL for getting the service information and other details. The tool WSDL2Ws takes the wsdl and and get the information and create the web service, wrapper and necessary type classes. These classes will be generated automatically by this tool.
You can find the WSDL2Ws tool in "org.apache.axismora.wsdl2ws.WSDL2Ws". The basic invocation form looks like this:
java org.apache.axismora.wsdl2ws.WSDL2ws
wsdlfile -optionChar value
Way to get the arguments
* wsdlfile: give the wsdl file name with correct path
* optionChar: Optional characters can be given depends on the needs.
Optional Characters
* -o target output folder\n"
* -l target language (c|java|c++) default is java
* -i implementation style (struct|order|simple) default is struct
* -s (client|server|both)
we have a wsdl file named "ArrayCalc.wsdl" in the samples/userguide/example3 folder. So the command will be
% java org.apache.axismora.wsdl2ws.WSDL2Ws ArrayCalc.wsdl -s server -o./example3 -ljava
<service name=="ArrayCalc" provider="java:RPC">
<parameter name="allowedMethods" value="*"/>
<parameter name="className" value=" userguide.example3.ArrayCalc"/>
</service>
Handlers do not implement the JAX-RPC Handler interface. They follow axis handlers.
The Handler should implements the org.apache.axismora.Handler interface. The invoke method will be called by the axis engine.
public interface Handler {
public void invoke(MessageContext msg);
public void onFalult(MessageContext msg);
public void init(Hashtable conf);
public void cleanup();
public void setOption(String name, Object value);
public Object getOption(String name);
public String getName();
public QName[] getUnderstandHeaders();
}
A SOAP message handler class is required to implement the org.apache.axismora.Handler interface. This handler gets access to the SOAP message (that carries either an RPC request or response in the SOAP Body element) from the org.apache.axismora.MessageContext.
The org.apcahe.axismora.handlers.BasicHandler class is an abstract class that implements the Handler interface. Handler developers should typically subclass the BasicHandler class unless the Handler implementation class needs another class as its super class.
The org.apache.axismora.HandlerChain represents an ordered list of handlers. All Elements in the HandlerChain are of the type org.apache.axismora.Handler.
public interface HandlerChain extends Handler {
public void add(Handler handler);
public void remove(Handler handler);
}
The org.apache.axismor.handlers.HandlerInfo class represents the configuration data for a Handler. A HandlerInfo instance is passed in the Handler.init() method to initialize a Handler instance.
public class HandlerInfo implements java.io.Serializable {
public HandlerInfo(Hashtable config) {...}
public Hashtable getConfig() {...}
}