3 Replies Latest reply on May 15, 2012 5:29 AM by gauravrishi

    Expose a web service with Camel

    manta7

      Hello everyone !

       

      I'm using the version "apache-servicemix-4.3.1-fuse-01-15" of Fuse ESB and I'm trying to do this little workflow : Consumer -> JAX-WS service -> Camel endpoint (let's say a bean to be simple).

       

      I started from the cxf-osgi example, to expose a JAX-WS web service. This example works well.

      My goal is easy, from this example I would like to redirect the request to a camel endpoint (a bean).

       

      I tried several things but could you please at least tell me if I'm following the right way : using the CXF camel component (http://camel.apache.org/cxf.html) and route to a bean component like that :

       

      from("cxf:bean:helloWorldBean").

      to("bean:test?method=test");

       

      Or do I have to use the jetty + cxfbean ? Or keep the CXF endpoint and communicate with camel via the NMR ?

       

      Thanks !!

        • 1. Re: Expose a web service with Camel
          njiang

          It really depends on what you need to do .

          If you want to a content base routing , you can redirect the request from camel-cxf endpoint to camel endpoint.

          If you just want to do some auditing work, you can simple add an interceptor and use CXF direly.

          If you just want to leverage the camel component from transport level you can use jetty + cxfbean.

          If you have lots of bundles and you want them to talk to each other, you can consider to use camel via NMR component.

           

          Willem

          • 2. Re: Expose a web service with Camel
            manta7

            Finally the only thing I want is : from the HelloWorldImpl.java, access to the CamelContext.

            Indeed, if from this class I can access to the CamelContext, so I could send messages to Camel endpoint.

             

            To resume, expose a web service to the real world (not the NMR) and from the java implementation of this service, access to the CamelContext.

             

            Is there a simple way ? I just found difficult solutions :/

             

            (I'm still talking about the cxf-osgi example project)

             

            Edited by: manta7 on Jun 16, 2011 4:42 PM

            • 3. Re: Expose a web service with Camel
              gauravrishi

              Hi,

               

              Even I am trying the same thing, can someone help me connecting JAX-WS service to a pojo in the camel context.

               

              Thanks