4.3 Evaluation
4.3.2 Apache Axis
The Apache Axis toolkit is a Java web service framework consisting of an implemen-tation of a SOAP server, a client library, and various utilities and APIs for generating and deploying web services. The version tested here is 1.4.
Availability
Axis is freely available from the project homepage, http://ws.apache.org/axis/.
Installation
Axis is installed within a servlet container, such as the freely available Apache Tomcat (http://tomcat.apache.org/). Once downloaded and extracted, the axis directory from the distribution is copied into the webapps directory under Tomcat. Successful installation can be checked by navigating to the Axis homepage in a web browser.
1http://search.cpan.org/dist/Pod-WSDL/
4.3 Evaluation
Figure 4.1: WSDL for the SOAP::Lite Calculator service scavenged from within the Taverna workbench. The add operation is used to create a simple workflow.
The URL takes the form http://<tomcat-host>:<tomcat-port>/axis/. This web page is likely to initially report errors regarding missing components. In particular one
‘required’ component, Activation API, should be downloaded separately1 and placed in the libdirectory under the axisdirectory. Tomcat should be restarted for this change to be recognised.
Two ‘optional’ JAR files, Mail API2 and XML Security3 may not be immediately necessary, but may be downloaded and copied into lib as before, whenever required.
All the JAR files inlibmust then be added to the AXISCLASSPATH environment variable to ensure Java can locate the necessary files when carrying out deployment activities and enabling client access.
Support
Support is available via a comprehensive user guide and active mailing list.
1http://java.sun.com/javase/technologies/desktop/javabeans/jaf/downloads/index.html
2http://java.sun.com/products/javamail/
3http://santuario.apache.org/
4.3 Evaluation
Web service protocols supported SOAP and WSDL.
Implementation of tasks as web services
The simplest approach to web service creation is to expose Java classes, by placing Java source code in the root axis directory, and changing the extension from .java to .jws. Axis automatically compiles the class and converts the SOAP calls correctly into Java invocations of the service class. Tasks are therefore public Java methods of a class, which are exposed as the operations of a web service. Appendix B contains the source code for a .jwsversion of the Calculator example.
Once the source code is placed in the root axis directory, it should be possible to navigate to the service location in a browser, using a URL which takes the form http://<tomcat-host>:<tomcat-port>/axis/Calculator.jws.
While JWS services are a very convenient and fast way to expose Java code as a web service, they are inflexible and offer limited functionality. Only source code can be used for deployment, which is not ideal if the service provider only has access to a compiled class. As the code is compiled at run-time, errors are not detected until after deployment. Also, packages are not supported.
A more powerful approach that offers greater flexibility makes use of a Web Service Deployment Descriptor (WSDD). The deployment descriptor contains metadata about a web service that is to be made available to the Axis engine. An example WSDD for the Calculator service is shown in Listing 4.2.
<deployment xmlns=” h t t p : / / xml . apache . o r g / a x i s /wsdd/ ”
xmlns : j a v a=” h t t p : / / xml . apache . o r g / a x i s /wsdd/ p r o v i d e r s / j a v a ”>
<s e r v i c e name=” C a l c u l a t o r ” p r o v i d e r=” j a v a :RPC”>
<parameter name=” className ” v a l u e=” C a l c u l a t o r ”/>
<parameter name=”methodName ” v a l u e=” ∗ ”/>
</ s e r v i c e >
</deployment>
Listing 4.2: deploy.wsdd
To use a WSDD, the Java source must be compiled, and the resulting class is given as a parameter of the service (className) in the WSDD. Other parameters are available, for example allowedMethods which tells the Axis engine which methods (i.e. tasks) in the code to make available as operations of the service.
4.3 Evaluation
The deployment is carried out using the AdminClient which is packaged with Axis.
The AdminClient is executed in a terminal as follows:
java -cp $AXISCLASSPATH org.apache.axis.client.AdminClient -lhttp://<tomcat-host>:\*<tomcat-port>
axis/services/AdminService deploy.wsdd
Successful deployment is indicated in the terminal with the <Admin>Done proce-ssing</Admin> message. This can be tested by clicking the ‘Available Services’ link displayed on the Axis homepage: the new Calculator service together with the avail-able methods add and subtract will appear, as shown in Figure 4.2. It is important to note that if the class file of the service is placed outside of theclasses directory under
axis, then the appropriate package name must be specified in the Java source, otherwise the Axis engine will be unable to locate the class.
Figure 4.2: The ‘Available Services’ links leads to a web page as shown in this figure.
The new Calculator service is listed along with the associated methods.
Invoking the service - built-in client
For services deployed using either the ‘drag and drop’ or deployment descriptor method, WSDL is generated automatically by appending?wsdl to the end of the unique service URL associated with that service. Client libraries within Axis can be used to construct clients that consume web services based on both their JWS endpoints or WSDL. Ap-pendix B contains an example client to consume the WSDL for the Calculator service.
4.3 Evaluation
Invoking the service - Taverna client
As described, the automatic generation of WSDL means that the service provider does not need to do any further work to enable compatibility with Taverna. The WSDL can be scavenged, making the WSDL processors add and subtract available for use in workflows, as shown in Figure4.3.
Figure 4.3: WSDL for the Apache Axis Calculator service scavenged within the Taverna workbench. Thesubtract operation is used to create a simple workflow