Creating a JAX-WS
-
Upload
loardzero1 -
Category
Documents
-
view
29 -
download
1
Transcript of 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):
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.
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.
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
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
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
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.
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…