2 Replies Latest reply on Aug 3, 2015 6:49 PM by eminkevich

    The best approach to consume resftFull service in camel ?

    bharadwaj

      Hi Claus Ibsen ,

       

      We have differ options to consume reftful services like cxfRS, jetty, http.

      My requirement is to consume restful service without service class also it should be able to support CXF bus configuration to have global configuration cxf endpoints.

      I know we have cxfRS but it's mandatory to use service class in lesser than camel 2.15 version, camel 2.15 introduced modelRef which can be used without service class,

      currenlty we are using camel 2.12 version could please suggest us which step/approach use to consume reffull service without using service?(client doesn't provide us service class)

       

       

      Thanks,

      Bharadwaj nakka

        • 1. Re: The best approach to consume resftFull service in camel ?
          davsclaus

          I am afraid for CXF you would have to upgrade to JBoss Fuse 6.2 to get Camel 2.15.


          For fuse 6.1 you can look at camel-restlet which can do rest services (its a bit different than Apache CXF).

          • 2. Re: The best approach to consume resftFull service in camel ?
            eminkevich

            Hi, bharadwaj,

             

            We run 2.12 with CXF RS service endpoint imported into Camel context.

             

            The endpoint is declared in a class:

             

             

            public class RestInterface {

                @GET

                @Path("/{projectCode}/{subjectCode}")

                @Produces(MediaType.APPLICATION_JSON)

                public Response processRequest(@PathParam("projectCode") String projectCode, @PathParam("subjectCode") String requestCode) {

                    return null;

                }

            }

             

            And then it is exposed to camel as:

             

            <camelcxf:rsServer id="rsServer" address="https://localhost:9292/rest/solution/v1" staticSubresourceResolution="true"

                                   serviceClass="com.company.RestInterface"

                                   loggingFeatureEnabled="false" loggingSizeLimit="20">

                    <camelcxf:providers>

                        <ref component-id="authenticationFilter"/>

                        <ref component-id="authorizationFilter"/>

                    </camelcxf:providers>

                </camelcxf:rsServer>

             

            And camel context can access params:

             

              <log message="REQUEST : $simple{in.header.projectCode}/$simple{in.header.subjectCode}" loggingLevel="DEBUG" logName="REST-INTERFACE"/>

             

            Let me know if the question is still valid I will prepare a fully blown template for you.