Consume JAX-WS Web Service Using Eclipse

Consume JAX-WS Web Service Using Eclipse explains about how to consume a JAX-WS web Service using in built Eclipse plugin wizard
How to create jax-ws web service client using Eclipse?
Required Libraries
You need to download
Steps For Consuming 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, which we select on step 5
3) Right Click on our created project(JAXWSEclipse) (File->New->Other->Web Services->Web Service Client)
4) Just Browse your WSDL Location, in our case (http://localhost:8080/CXFTutorial/ChangeStudent?wsdl),You can also change the Web service runtime by clicking Web service runtime link (see next step)
5) You can select your Web Service Framework of your choice, You have two options 1) CXF 2) AXIS which we configured on step 2
6) Now click OK button and click Finish
7) On below screen shot, 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 wsdl2java tool inorder to generate artifacts.
Loading FrontEnd jaxws ... Loading DataBinding jaxb ... wsdl2java -client -d C:\Documents and Settings\test\workspace_test\JAXWSEclipse\.cxftmp/src -classdir C:\Documents and Settings\test\workspace_test\JAXWSEclipse\build\classes -p http://student.com/=com.student -impl -validate -exsh false -dns true -dex true -wsdlLocation http://localhost:8080/CXFTutorial/ChangeStudent?wsdl -verbose -defaultValues -fe jaxws -db jaxb -wv 1.1 http://localhost:8080/CXFTutorial/ChangeStudent?wsdl wsdl2java - Apache CXF 2.6.1
8) Create a Main class in order to invoke this service
Main.java
import com.student.ChangeStudentDetails;
import com.student.ChangeStudentDetailsImplService;
import com.student.Student;
// jax-ws example
public class Main {
public static void main(String[] args) {
ChangeStudentDetailsImplService service = new ChangeStudentDetailsImplService();
ChangeStudentDetails changeStudentDetailsImplPort = service.getChangeStudentDetailsImplPort();
Student student = new Student();
student.setName("Rockey");
Student changeName = changeStudentDetailsImplPort.changeName(student);
System.out.println("Server said: " + changeName.getName());
}
}
Output
Nov 09, 2013 8:36:16 PM org.apache.cxf.service.factory.ReflectionServiceFactoryBean buildServiceFromWSDL INFO: Creating Service {http://student.com/}ChangeStudentDetailsImplService from WSDL: http://localhost:8080/CXFTutorial/ChangeStudent?wsdl Server said: Hello Rockey