Hi All,

I am working on Apache CXF rest services from past few days. I am stuck at
one place. I am not able to figure out how to create a rest web service
call that excepts that custom object and perform some operation. For Ex:

Assume I have a custom object like below:

public class SampleObject {
  String x;
  String y;
  Integer i;
  Calendar c;
}

Now I want to create a rest web service like below:

        @POST
@Path("addSampleObject")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML,
MediaType.APPLICATION_FORM_URLENCODED })
public SampleObject addSampleObject(@FormParam("sampleObject") SampleObject
sampleObject) throws WebServiceFault {
/**
* Perform some operation with SampleObject and return same object
*
*/
return sampleObject;
}

Can anyone help me find an example which I can use to fulfill my scenario.

I would also like to understand how client can call this service.

Any help is highly appreciated.

Regards, Puneet.

Reply via email to