0 Replies Latest reply on Apr 15, 2011 11:14 AM by cogofuse

    How can I validate a REST payload with its xsd using cxfrs?

    cogofuse

      Hi,

       

      I use camel cxfrs to build REST servers.

      Cxfrs is very powerful. It takes a REST request and maps it to the definition of the resource class.

      So for building a REST server all you need to do is defining the operations in the resource class

      and writing an osgi bundle with a camel route that consumes from cxfrs component.

       

      cxfrs "magically" fits the request in with the parameters of the resource operation.

      My question is: Is there any way to instruct cxfrs to validate the REST request payload with an xsd?

       

      Thank you in advance,

      Cogo

       

      the code below illustrates the way I write REST servers

      -


       

      public class ServiceRouter extends RouteBuilder {

         public void configure() throws Exception {

            from("cxfrs://")

            ...

         }

      }

       

       

      @Produces("application/xml")

      @Consumes("application/xml")

      public class MyResource {

                  public MyResource() {}

       

                  @POST

                  public void apply (MyRequestType payload,   // MyRequestType class was generated from and xsd

                              @QueryParam("Application") String application,                      

                              @Context HttpServletRequest request) {}

      }