WSDL Client Without Proxy
WSDL Client Without Proxy explains step by step details of how to create a CXF web service client / CXF wsdl soap client without using any proxy or tools
Other options like Wsimport tool available with JDK are standard, but here we are not using any tools
For publishing a CXF Web Service, you can follow CXF Web Service Tutorial. This client is generated after the deployment of above service.
Required Libraries
You need to download following libraries in order to run CXF WSDL Client Without Proxy
- JDK 6
- Eclipse 3.7
- For running this client you need to refer the classes generated on CXF Web Service Tutorial
WSDL Client Without Proxy
package com.student;
import java.net.MalformedURLException;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import com.student.ChangeStudentDetails;
import com.student.Student;
//CXF WSDL client example
public class StudentClient {
public static void main(String[] args) throws MalformedURLException {
URL url = new URL("http://localhost:8080/CXFTutorial/ChangeStudent?wsdl");
QName qname = new QName("http://student.com/", "ChangeStudentDetailsImplService");
Service service = Service.create(url, qname);
ChangeStudentDetails changeStudentDetails = service.getPort(ChangeStudentDetails.class);
Student student = new Student();
student.setName("Rockey");
System.out.println("Server said: " + changeStudentDetails.changeName(student).getName());
}
}
import java.net.MalformedURLException;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import com.student.ChangeStudentDetails;
import com.student.Student;
//CXF WSDL client example
public class StudentClient {
public static void main(String[] args) throws MalformedURLException {
URL url = new URL("http://localhost:8080/CXFTutorial/ChangeStudent?wsdl");
QName qname = new QName("http://student.com/", "ChangeStudentDetailsImplService");
Service service = Service.create(url, qname);
ChangeStudentDetails changeStudentDetails = service.getPort(ChangeStudentDetails.class);
Student student = new Student();
student.setName("Rockey");
System.out.println("Server said: " + changeStudentDetails.changeName(student).getName());
}
}
Output
Server said: Hello Rockey
2 Responses to "WSDL Client Without Proxy"