Perhaps the CXF JAX-RS examples will help. http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/jax_rs/basic/
I believe it includes the case for passing a custom object. There is a How-To link on the main page http://cxf.apache.org/docs/sample-projects.html On Saturday, July 12, 2014, Puneet Gupta <[email protected]> wrote: > 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. > -- Regards, Mark Sent from Gmail Mobile on iPhone
