Web Service Project Sample Template
Introduction
Use the "blank" web service sample (located at <BeehiveRoot>/samples/wsm-blank) as a template for building your own web service applications.
The template contains everything needed in a basic web service application, except for the runtime JAR files.
Using the Web Service Template
The following instructions assume that you have completed all of required and optional steps in the Beehive set up procedure at Installation and Setup.
To use the template, follow these steps:
Copy and Rename the Template Folder
Copy the folder BEEHIVE_HOME/samples/wsm-blank to your development directory.
Rename wsm-blank to something more appropriate to your application. Below we assume that the path to the renamed wsm-blank is <Project-Folder>.
Edit the build.properties File
In this section you will edit the build.properties file--the file that sets the build-related properties for your web service.
Open the file <Project-Folder>/WEB-INF/src/build.properties in a text editor.
Edit the beehive.home property points to the top-level folder of your beehive installation.
Add the line service.name=<SomeContext> (as shown below).
For example, if your beehive installation resides at C:/apache/apache-beehive-1.0, then your build.properties file would appear as follows.
beehive.home=C:/apache/apache-beehive-1.0 service.name=<SomeContext>
Note: the value of <SomeContext> will determine (1) the name of the WAR file produced when the web service is compiled and the (2) part of the URL used by Tomcat to access the web service.
The WAR file will be named <SomeContext>WS.war
The URL will be http://localhost:8080/<SomeContext>/
Build and Deploy the Template Web App
To build the template web service and deploy it the resulting WAR file, run the following Ant command.
The following command assumes that you are using Tomcat server.
ant -f <Project-Folder>WEB-INF\build.xml -Dto.dir=%CATALINA_HOME%\webapps clean build deploy Copy and Paste version: ant -f <Project-Folder>\WEB-INF\build.xml -Dto.dir=%CATALINA_HOME%\webapps clean build deploy
To Run the Template Web Service
You can now try out the web service by pointing your browser at the following link.
- Run the controller file's begin() method: http://localhost:8080/<SomeContext>/