Creating a JAX-WS

9
Step by Step tutorial to create a JAX-WS with Eclipse Helios and Glassfish V3 Creating a JAX-WS under eclipse is not a big problem when using Tomcat. According to CXF developers, deploying a JAX-WS under glassfish SHOULD not be a problem, however, when using glassfish, things does not work as expected. Not because glassfish and CXF are not compatible, but because some steps or extra steps were made wrong. This step by step tutorial should show how to create a JAX-WS with Eclipse and Glassfish. This step by step tutorial should show how to create a JAX-WS with Eclipse and Glassfish. 1. Create a Dynamic Web Project in eclipse. 2. On the configuration Panel, click on modify and select the following options (also shown in figure 2):

Transcript of Creating a JAX-WS

Page 1: Creating a JAX-WS

Step by Step tutorial to create a JAX-WS with Eclipse Helios and Glassfish V3

Creating a JAX-WS under eclipse is not a big problem when using Tomcat. According to CXF

developers, deploying a JAX-WS under glassfish SHOULD not be a problem, however, when using

glassfish, things does not work as expected. Not because glassfish and CXF are not compatible, but

because some steps or extra steps were made wrong. This step by step tutorial should show how to

create a JAX-WS with Eclipse and Glassfish.

This step by step tutorial should show how to create a JAX-WS with Eclipse and Glassfish.

1. Create a Dynamic Web Project in eclipse.

2. On the configuration Panel, click on modify and select the following options (also shown in

figure 2):

Page 2: Creating a JAX-WS

CXF 2.x Web Services

Dynamic Web Module

Glassfish Deployment description Files

Java

3. When finished, click ok and then finish. A project structure as showed in figure xx would

be created.

Page 3: Creating a JAX-WS

4. Create a Web Service interface and an implementation class of your web Service.

5. Once all the classes are implemented, right click on the implementation class of the Service

and go to new Others Web Services Web Service and then click next.

6. A web service wizard will be started. In this tutorial we will create a Bottom up java Web

Service. Your implementation class will be automatically selected. If not, select the

implementation class in the Service Implementation tab. On the configuration console,

please select the right deployment server (Glassfish) and the right Web Service Runtime

environment. (Normally an Apache Tomcat as well as Axis2 Runtime will be automatically

selected; this must change as shown in figure 6). Once finished, click on next.

Page 4: Creating a JAX-WS

7. Click on Use Service Endpoint Interface and select your service endpoint interface (SEI) from

your project. If you still don’t’ have one, the wizard could create one for you. Click next

Page 5: Creating a JAX-WS

8. Now select the JAX-WS annotation to be added to your Implementation class. Now, this step

is really important. Only select @ WebMethod and @WebParam annotations. Selecting

other ones will result that your Web Service may have some deployment difficulties or that

the Web Service WSDL URL on the Glassfish Admin console (See figure 13) will not work

properly. When finished, click next

Page 6: Creating a JAX-WS

9. Click only Generate Wrapper and Fault Beans. You really don’t need the WSDL since it is

regenerated automatically when deployed. Now click finish

Page 7: Creating a JAX-WS

10. The Wrapper classed and annotations will be generated and the project will be deployed

into Glassfish

11. Now the service is deployed into Glassfish. Go to Glassfish admin console

(http://localhost:4848) Web Application and click on the ConverterEAR.

Page 8: Creating a JAX-WS

12. A new window will be opened where are all deployed components are showed.

13. On the Action Tab (Aktion in the figure) please click on show. The new web site will have two

links, one for the WSDL and the other for a test Site where the Web Service would be

tested…

Page 9: Creating a JAX-WS