CXF REST Without Spring

Create a Service Interface

This service interface will defines which methods of restful service, to be invoked by the client

package com.student;

public interface ChangeStudentDetails {
Student changeName(Student student);
  Student getName

Implement the Service Interface

Here we implement the service interface created on the previous step

Here we are using one example showing with GET method& another with POST method

GET---> Calling this method will not result any changes to the server

POST---> Calling this method will result changes to the server, This have more secure than GET method

package com.student;


public class ChangeStudentDetailsImpl implements ChangeStudentDetails {

public Student changeName(Student student) {
student.setName("HELLO " + student.getName());
return student;

public Student getName() {
Student student = new Student();
return student;

Note; On the above ChangeStudentDetailsImpl class, implementing an interface is not necessity, you can create restful services without implementing an interface.

@Consumes annotation specifies, the request is coming from the client

you can specify the Mime type as @Consumes("application/xml"), if the request is in xml format

@Produces annotation specifies, the response is going to the client

you can specify the Mime type as @Produces ("application/xml"), if the response need to be in xml format


<web-app id="WebApp_ID" version="3.0" xmlns=""

Previous 1 2 3 Next

3 Responses to "CXF REST Without Spring"
  1. jan 2012-10-11 08:09:53.0
  1. Demerre 2016-07-27 08:10:38.0
  1. RAJESH C 2019-01-08 05:19:30.0

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