Astronomical Data Query Language >> Creating a new Java Web service
Creating a new Java Web Service
Let us now look at how we create a new Java web service. You can either start by generating code on your machine or you can use the already generated code provided in the Download Code section.
Requirements
Java SDK, available at http://www.java.sun.com/
For web service code generation, Apache Axis, a SOAP implementation for Java, available at http://ws.apache.org/axis/.
For deployment, Resin, a web application server, available at http://www.caucho.com/.
Apache Ant, (Preferable) as a build tool, available at http://wwww.ant.apache.org/.
Next Run java org.apache.axis.wsdl.WSDL2Java -s -v Archive.wsdl on the command line.
This generates the skeleton web service, ArchiveSoapImpl.java file in the /net/ivoa/voql folder.
Write your implementation inside this file for the different methods of the ADQL web service.
Compile all the java files into a single ArchiveWS.jar file.
Download Code
You can download the entire source code in a zip format over here. This includes the WSDL file, the generated java files, deployment files {deploy.wsdd and undeploy.wsdd}, the ArchiveWS.jar file and build.xml file. Once you have tested the deployment of this code, feel free to change the implementation of the web service in ArchiveSoapImpl.java file based on your needs.
Here is some help on the ant build file.
Run ant Generate to generate the java files, ant to compile the code, ant Compress to generate the jar file.
Deployment
Have Resin installed on the webserver.
Have Axis configured for Resin. { This is simple, Once you install resin, just copy \webapps\axis folder in the axis installation to the \webapps\axis folder of Resin installation}.
Create a new directory ArchiveWS under the \webapps\axis\WEB-INF folder.
Copy the generated deploy.wsdd and undeploy.wsdd files into the \webapps\axis\WEB-INF\ ArchiveWS folder.
Copy the generated ArchiveWS.jar file onto the \webapps\axis\WEB-INF\lib folder of the resin installation.
Run java org.apache.axis.client.AdminClient -p8090 list. This will list all the web services registered under Resin.
Now, from the \webapps\axis\WEB-INF\classes folder, Run java org.apache.axis.client.AdminClient -p8090 deploy.wsdd
Now, Run java org.apache.axis.client.AdminClient -p8090 list. This will list all the web services registered under Resin. You should see your web service also listed here.
Later, when you want to remove the web service, Run java org.apache.axis.client.AdminClient -p8090 undeploy.wsdd
Check for proper deployment of the web service using the http://localhost:8090/axis/services/ArchiveSoap?wsdl
Vivek Haridas
Last Modified :Friday, July 25, 2003 at 3:34:45 PM
, $Revision 1.1 $