Consume JAX-WS Web Service Using Eclipse

6) Now click OK button and click Finish

Consume Simple JAX-WS Web Service

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

Consume Simple JAX-WS Web Service

8) Create a Main class in order to invoke this service

Main.java

package com.student;
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

 





Previous 1 2 3








Your email address will not be published. Required fields are marked *