Tutorial Cara Membuat JAX-WS menggunakan Eclipse, CXF dan Glassfish V3

Dengan begitu bersemangat berselancar di dunia mencari tutorial programming java kesana kemari akhirnya ketemua dengan tutorial yang satu ini. belum sempat siy untuk mempelajarinya secara detail, namun dari pada hilang dan ga ketemu lagi ama nich website, mending gw mejengin dulu disini untuk sementara waktu biar kalo gw udah punya waktu luang gw bisa dengan mudah mencarinya di blog gw ini

dalam bahasa inggris siy. gpp lah, itung itung mempermahir bahasa inggris kita ya ga. bahasa inggris untuk jaman sekarang ini penting banget lho. rugi kalo ga bisa. ok lah, simak aja tutorial dibawah ini

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.Create a Dynamic Web Project in eclipse.
    • CXF 2.x Web Services
    • Dynamic Web Module
    • Glassfish Deployment description Files
    • Java
Figure 1
On the configuration Panel, click on modify and select the following options (also shown in figure 2):
Figure 2
Figure 2
When finished, click ok à and then finish. A project structure as showed in figure 3 would be created.
Figure 3
Create a Web Service interface and an implementation class of your web Service.
Figure 4
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.
Figure 5
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.
Figure 6
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
Figure 7
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 my 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
Figure 8
Click only Generate Wrapper and Fault Beans.  You really don’t need the WSDL since it is regenerated automatically when deployed. Now click finish
Figure 8
The Wrapper classed and annotations will be generated and the project will be deployed into Glassfish
Figure 10
Now the service is deployed into Glassfish. Go to Glassfish admin console (http://localhost:4848) à Web Application and click on the ConverterEAR.?
Figure 11
A new window will be opened where are all deployed components are showed.
Figure 12
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…
Figure 13

Artikel Lainnya