Almost pure console Web Service development walkthrough
Almost pure console Web Service development walkthrough
In some cases the dashboard might not work and maybe you are tired of setting up everything in Eclipse. This section will go through all steps by working (almost) only with the console - and you will see how fast one can develop services :)
-
Prerequisites
- Java (http://java.sun.com/javase/downloads/index.jsp)
- Download the current java version from the URL above. For the work with BioMoby the Java SE is sufficient
- Install Java and set the JAVA_HOME variable to your installation and also make sure the bin directory of the installation is added to the PATH variable
- Please make sure you are installing the JDK and not the JRE !
- Apache (http://httpd.apache.org/)
- Download the current version (at least Apache 2.0)
- Install it and test it if its running correctly
- Tomcat (http://tomcat.apache.org/download-55.cgi)
- We suggest to use Tomcat5.5
- Download Tomcat, install it and test if its running correctly.
- Set the CATALINA_HOME variable to your tomcat installation
- Axis (http://www.apache.org/dyn/closer.cgi/ws/axis/1_4)
- Dont use Axis2. The current BioMoby implementation does not work with Axis2. So please download version 1.4 (the binaries)
- If you untared/unzipped the file, go into the axis-1_4/webapps directory and copy the axis directory into the webapps directory of your tomcat
- ANT (http://ant.apache.org/bindownload.cgi)
- Download and unpack it.
- Set the ANT_HOME variable to your ant installation and add the bin directory to our PATH variable.
- mod_jk
- If you want to have a redirection from the apache to tomcat (because of security issues only the apache is visible from the outside, but the Web Services will be in tomcat) you need to download the mod_jk.so (http://www.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/). A short introduction how to install it can be found here: http://tomcat.apache.org/connectors-doc/generic_howto/quick.html
-
Walkthrough
- Get the JMoby code from CVS... go to any directory in which you want to have the checkout and type:
-
cvs -d :pserver:cvs@cvs.open-bio.org:/home/repository/moby login (password is 'cvs') cvs -d :pserver:cvs@cvs.open-bio.org:/home/repository/moby co -P moby-live/Java
- go into the moby-live/Java directory and call ant install (this will download all dependencies and can take up to 10 minutes). If you doing this the first time you have to call ant bootstrap before !
-
hint: if you dont have admin rights to deploy your service later on tomcat and e.g. need to use sudo or something similar, it is best to do all ant calls also as root (using sudo e.g.)
- Register your service online here.
-
Call ant moses-datatypes. This will generate and compile all dataypes so that they are available for your implementation.
- Ant takes input values from a file called build.properties, so copy the build.properties.template to build.properties
- Open build.properties with your favorite editor and add the following two lines
-
moses.authority = YOUR-AUTHORITY // the name of your authority you used to register the service
-
moses.service = SERVICE_NAME // the name of the service you registered and want to develop
- Now we want to have the skeleton for our service - so call ant moses-services.
- Now its your part. You have to implement your service by creating a class which extends the skeleton which was just created. You can do that with your favorite editor. Normally as naming convention the implementing class has the suffix Impl (e.g. your service is called MyBlastService, ergo the implementing class is then MyBlastServiceImpl).
- To deploy we need to specify the service(s) to be deployed. Add to your build.properties
-
service.NAME = IMPL_CLASS // NAME is the service name (e.g. MyBlastService) and IMPL_CLASS the implementing class (with the full package structure !)
- Make sure that your tomcat is running and type ant deploy.
- We need to copy the implementating class to tomcat. So copy your Impl class (with the complete package structure !) into CATALINA_HOME/webapps/axis/WEB-INF/classes.
- Restart tomcat and call the service.
Done.... great job :)