Web Service development using Netbeans and JBoss
This article is an introduction to creating JavaFirst JAX-WS web service using Netbeans IDE and JBoss Application Server.
Web Services are playing a major part in the enterprise application domain. Before JAX-WS, JAX-RPC was used to develop web services in Java. Apache Axis has been one of the popular implementation for development of Web Services for Java. With the advent of JAX-WS developing web services has become much simpler. This article explains how to create simple web service using Netbeans and JBoss Application Server.
Prerequisites
- - Download and Install Netbeans from Downloads.
- - Download and Install Jboss Application Server.
- - Download and Intsall JBossWS for your JBoss Application Server. Check the tutorial for the same here.
- - Configure Netbeans to use JBoss Server using Server Manager.
Create Project
Netbeans provides very easy way to develop web services. First we need to create an EJB application. Start Netbeans and select File -> New Project. Select EJB Project as shown below:
Step 1. Creating a project
Name the Module as JBossWSEJBModule or something you like.Make sure that you select JBoss Application Server as the Server. Select JavaEE5 for the JavaEE Version.
Step 2. Provide project properties
Once the project is created, you can check the files in the Projects window of Netbeans. Right click on the project name and select New -> Web Service ...
Step 3. Create new web service
Provide values for the new web service
Step 4. Web service properties
Expand the Web services node in the project, and right click the Web Service. Add a new operation to your web site by clicking on New operation .. as shown below:
Step 6. New Webservice Operation
Finally your web service should look like the following in the editor:
Step 7. New Webservice Operation
You can Click on the Source button to edit your web service Java Code. Update the sayHello method as follows:
17:35:26,221 INFO [BasicEndpointRegistry] register: jboss.ws:context=JBossWSEJBModule,endpoint=HelloWebService
17:35:26,237 INFO [LifecycleHandlerImpl] WebService started: http://127.0.0.1:8080/JBossWSEJBModule/HelloWebService
You can check your web service status by going to http://localhost:8080/jbossws/services
Also, you can see that your new web service's WSDL is available at: http://127.0.0.1:8080/JBossWSEJBModule/HelloWebService?wsdl
Comments
Post new comment