Create JAX-WS Web Service Using Eclipse

Create JAX-WS Web Service Using Eclipse explains about how to create a JAX-WS web Service using in built Eclipse plugin wizard
How to create jax-ws web service using Eclipse?
Required Libraries
You need to download
Steps For Creating JAX-WS Web Service:
1) Firstly create a Dynamic Web Project (File->New->Dynamic Web Project) named "JAXWSEclipse" according to following screenshot
2) You need to configure the framework, you can have two options CXF or Axis (We will do this on step 5)
3) Right Click on our created project(JAXWSEclipse) (File->New->Other->Web Services->Web Service)
4) We need to create following 3 classes
Create a Student Object
public class Student {
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
Create a Service Interface
This service interface will defines which methods of web service, to be invoked by the client
import javax.jws.WebService;
@WebService
public interface ChangeStudentDetails {
Student changeName(Student student);
}
Implement the Service Interface
Here we implement the service interface created on the previous step
import javax.jws.WebService;
@WebService(endpointInterface = "com.student.ChangeStudentDetails")
public class ChangeStudentDetailsImpl implements ChangeStudentDetails {
public Student changeName(Student student) {
student.setName("Hello "+student.getName());
return student;
}
}
5) see the project structure below
6) Just Browse your Web Service Implementation class created on step 4 (com.student.ChangeStudentDetailsImpl), You can also change the Web service runtime by clicking Web service runtime link (see next step)
7) You can select your Web Service Framework of your choice, You have two options 1) CXF 2) AXIS (We have configured this on step 2)
8) Now click Next button, Now you can select existing Service Endpoint Interface
9) Now click Next button, Now you can annotate @WebMethod, @WebParam, @RequestWrapper, @ResponseWrapper, @WebResult etc (Just tick the checkboxes)
10) Now click Next button, Now you can see various Java2WS generation options (Just tick the checkboxes) & you can select different SOAP versions (SOAP 1.1 & SOAP 1.2)
11) Now click Next button, you can see all the artifacts are created, you can also see following logs on console
You can see that Eclipse internally using CXF's java2ws tool inorder to generate artifacts.
java2ws -cp C:\Documents and Settings\test\workspace_test\JAXWSEclipse\build\classes -s C:\Documents and Settings\test\workspace_test\JAXWSEclipse\.cxftmp/src -d C:\Documents and Settings\test\workspace_test\JAXWSEclipse\.cxftmp/wsdl -classdir C:\Documents and Settings\test\workspace_test\JAXWSEclipse\build\classes -o changestudentdetailsimpl.wsdl -soap12 -createxsdimports -verbose -frontend jaxws -databinding jaxb -wsdl -wrapperbean com.student.ChangeStudentDetailsImpl java2ws - Apache CXF 2.6.1 Nov 15, 2013 10:40:52 PM org.apache.cxf.service.factory.ReflectionServiceFactoryBean buildServiceFromClass INFO: Creating Service {http://student.com/}ChangeStudentDetailsImplService from class com.student.ChangeStudentDetails
Now click Start server to start the server to deploy
Deployed CXF Web Service