JBoss.orgCommunity Documentation
This chapter describes how to create a simple web service.
A simple web service can be created by using the Simple Web Service wizard as described in Generate a simple web service
Procedure 2.1. Generate a simple web service
Access the New - Select a wizard dialog
Right click on the project name in the Project Explorer view.
Select
→ .Expand the
folder and click on the option.The New - Select a wizard dialog displays with the selected wizard type highlighted.
Access the Simple Web Service dialog
Click the
button to proceed.The Simple Web Service - Project and Web Service Details dialog displays.
Define the service attributes
Define the project, web service, package and class names according to the options displayed in Table 2.1, “Project and Web Service Details”
Table 2.1. Project and Web Service Details
Dialog group | Field | Mandatory | Instruction | Description |
---|---|---|---|---|
Technology | yes | Select the technology the Web Service will be based on. | A simple web service can be based on either the Web Service Definition Language (WSDL) or RESTful (REST) API. Click the radio button beside the technology your web service should use. | |
Dynamic web project | yes | Select the project name. | The project name will default to the highlighted project in the Project Explorer. A different project can be selected from the drop-down list. | |
Service details | Service name | yes | Enter the name for the web service. | The web service name will be the URL for the service as mapped in the deployment descriptor (web.xml ). |
Update web.xml | no | Checkbox is checked by default, but is not mandatory. | Leaving this checked will add your new service to the web.xml in your project. | |
Add RESTEasy Jars from root runtime directory | no | Check this box to add RESTEasy JARs to the project. | This option allows you to add RESTEasy JARs to the project if they appear in the root runtime directory but are not installed in the runtime. While this is not required, it will assist when working with JBoss Application Server 5 and JBoss Enterprse Application Platform 5 web service projects. | |
Service implementation | Package | yes | Enter the package for the web service servlet. | The default package is org.jboss.samples.websevices . Select your own package using the button. |
Class | yes | Enter the name of the web service servlet. | The default class name will correspond to the default web service name resulting in an equivalent URL to servlet name mapping in the deployment descriptor (web.xml ). | |
Application class | only when the JAX-RS technology option is selected | Enter the name of the JAX-RS application class to use. | The default application class is MyRESTApplication .Select your own application class using the button. |
Generate the web service
Click the
button to complete the web service setup.
The web service classes will be generated and the web.xml
file updated with the deployment details if the Update web.xml option was selected.