The main thing to understand is that MoSeS does not give you a full implementation of your service. You still need to program the business logic (e.g. to extract data from your database) - but you do not need to worry about the BioMoby and SOAP protocol details.
A typical situation is to develop (to implement) your service in a separate directory, not within your local copy of jMoby. This document describes exactly that.
The major jMoby components used for a new service development are:
Second, you will need jMoby itself. Take it using a CVS checkout. Details are in a separate document, here only a quick guide:
cvs -d :pserver:cvs@cvs.open-bio.org:/home/repository/moby login cvs -d :pserver:cvs@cvs.open-bio.org:/home/repository/moby co -P moby-live/Java cd moby-live/Java
ant jars
ant dashboard
Then, you need a space (a directory) where you are going to develop your service. One possible way is to use an empty project in empty_project.tar.gz. You can develop anywhere, and you can use any tools, of course. This document just needs to explain connections between the jMoby (now checked-out in moby-live/Java directory) and your project. It will be, therefore, using the suggested empty project as an example. Note, that especially you can develop using Eclipse - and still using the suggested empty project.
I will be using a name MyPoject for the new project directory. Go where you wish to have your new project and:
cp ....moby-live/Java/docs/empty_project.tar.gz . tar xzf empty_project.tar.gz mv EmptyProject-RENAME-ME MyProject cd MyProject cp ....moby-live/Java/build/lib/jmoby.jar lib/Note that the last line filled the new project with the jMoby libraries. But you need more libraries. There are third-party libraries that are used by jMoby so you can take them from your jMoby copy:
cp ....moby-live/Java/lib/alltools.jar lib/ cp ....moby-live/Java/lib/jdom.jar lib/ cp ....moby-live/Java/lib/xercesImpl.jar lib/ cp ....moby-live/Java/lib/xml-apis.jar lib/
In order to build everything you need an Apache Ant installed, a Java-based build tool. If you are using Eclipse, it is already part of it.
This is how you will be building everything (now it does little because you do not have any source code there yet):
ant allFor a compilation only, it is enough to day:
ant
cd moby-live/Java ant dashboard Setting -> Panel selection -> Registration -> Service Registration
cd moby-live/Java ant dashboard Setting -> Panel selection -> MoSeS Generator Select service...: your-service-name Button: All-in-One: Do it all
This also packs generated code into two jar files that you need to copy to your project directory:
cd MyProject cp ...moby-live/Java/build/lib/biomoby-datatypes.jar lib/ cp ...moby-live/Java/build/lib/biomoby-skeletons.jar lib/
Put your implementation sources into MyProject/src/main - using any package structure as you wish. An example of an implementation is in MoSeS.
The skeleton API documentation (you need to know it in order to find what methods are available in your implementing class) is available in moby-live/Java/docs/APIservice/index.html.
You compile by calling:
antIn order to learn what Ant's tasks are available in your project, type:
ant -projecthelp
There are many BioMoby clients that can be used to call our services. Let's show two of them. One is a command-line program that is the best for fast debugging, the other one is again the BioMoby Dashboard.
build/run/run-service -helpand its details are described in the Moses documentation. Start testing with parameter -class - it calls your local implementation directly. This is good for debugging. You may use the same program to call a real service later, just use instead a parameter -e with a service endpoint.
Check also the log file project.log.
cd moby-live/Java ant dashboard Setting -> Panel selection -> Simple Client Select service...: your-service-name add your input data on the right Button: Call service
Here also, you can test your service before it is deployed. Check the box Use this local class and enter a full name of your service implementation class. This, however, will not work - because Dashboard is started from the jMoby directory and it does not know anything about your implementation classes. Your classes are not on the Dashboard's CLASSPATH. The best way to rectify this is to copy script moby-live/Java/build/run/run-service to your project directory, edit it (see what build/run/run-* scripts how to set your CLASSPATH), and start Dashboard by calling the new script.
Before any deployment, make sure that:
The Dashboard knows what jMoby files are needed and what are the service and implementation class names. But Dashboard does not know anything about files coming from your project. For that, there is an Ant task that collects all needed files and put them in MyProject/build/lib:
cd MyProject ant pre-deployRemember this directory - you will need it in a minute in Dashboard.
The core of deployment is done by the BioMoby Dashboard in the MoSeS Generator Panel:
cd moby-live/Java ant dashboard Setting -> Panel selection -> MoSeS Generator Pattern for implementation class names: your-package-name.{SERVICE}Impl Select service...: your-service-name Button: Deploy
Before you press the Deploy button check at least these three things:
After deployment, restart your Tomcat (I recommend to use Tomcat Manager and to reload only Axis), and try the service, now using its real endpoint.