Monday, September 05, 2005
How to create Web Service in Sun App Server
1. File list
Under the project directory, you prepare
build.xml -----> makefile for asant
build.properties ----> customized properties
targets.xml ----> common targets for j2ee web services
src/${interface}.java ----> definition of the interface
src/${implementation}.java ----> implementation of the interface
conf/config-interface.xml ---> used by wscompile
conf/admin-password.txt ---> for asadmin command
lib/ ---> put any library you need
build/ ---> store the compiled class files
2. In build.properties fileSet the following properties
j2ee.home=C:/Sun/AppServer note:using slash "/" for path
project.home=project-path
project.name=project-name
3. run "asant build-service
4. start Sun App Server by running "asadmin start-domain domain1"
5. To deploy by GUI tool by running "deploytool"
- choose "new"-->"web component"
- create module file project-directory/project-name.war
- edit contents: select your project directory, click Add
- in Context root field, enter your context root; the URI for the service will look like http://localhost:8080/
context-root/alias - use the default values for the following steps
- add alias for implementation: select implementation component then Tab "Aliases", add alias; then select Tab "endpoint address", choose alias
- save and deploy
- extract from the generated WAR file \WEB-INF\webservice.xml, \WEB-INF\sun-web.xml, \WEB-INF\web.xml to project-directory/conf
- then run “asant create-war” to update the WAR by asant
- run “asant deploy-war” to deploy the WAR file
A sample template zip file
http://rommel.cs.binghamton.edu/~pliu/Template-SunContainer.zip