9 Replies Latest reply on Sep 18, 2010 1:05 AM by Freeman(Yue) Fang

    camel routing to jaxws:client endpoint

    Tao Xiao Newbie

      Hi,

       

      I am looking for a way that I can route a message to jaxws:client using camel.

       

      My scenario is that I have a message that is routed by camel to a webservices consumer which talks to webservices producer deployed outside fuse.

       

      I was wondering if I could use jaxws:client as the webservices consumer in this scenario then jaxws:client sends out the message to the external webservices.

       

       

      Any examples / code snippets are much appreciated.

       

      Thanks

        • 1. Re: camel routing to jaxws:client endpoint
          Freeman(Yue) Fang Master

          Hi,

           

          Generally you should use cxfbc:provider which play the role as webservice consumer to send request to external service.

           

          cxfbc:provider is JBI endpoint, so you can use camel jbi[1] component in your camel router to send message to cxfbc:provider.

          Take a look at[2] to get details how to configure cxfbc:provider

           

          http://camel.apache.org/jbi.html

          http://servicemix.apache.org/servicemix-cxf-bc.html

           

          Freeman

          • 2. Re: camel routing to jaxws:client endpoint
            Tao Xiao Newbie

            Thanks for your reply freeman.

             

            what are the differences between cfxbc:provider and jaxws:client? As per your comment it seems that jaxws:client is not capable of interacting with external service

            • 3. Re: camel routing to jaxws:client endpoint
              Freeman(Yue) Fang Master

              Hi,

               

              It's cxfbc but not cfxbc.

              jaxws:client can interact with external service directly, but per JBI spec, all protocol handle stuff should be delegate to BindingComponent(cxfbc is BindingComponent). As you deploy camel router in JBI container, I suggest you use cxfbc:provider.

               

              Freeman

              • 4. Re: camel routing to jaxws:client endpoint
                Tao Xiao Newbie

                Hi,

                 

                Sorry for not making my requirement clearer the first time. I actually want to deploy the webservices client as OSGi bundle.

                 

                I have an existing OSGi bundle which does the content based routing and sends the message to nmr. Then the other OSGi bundle which I would like to implement receives the message from nmr, does the message transformation (xml to object) and then invokes an external webservices.

                 

                So do you think cxfbc would suit my requirement?

                 

                I am new to FUSE

                • 5. Re: camel routing to jaxws:client endpoint
                  Freeman(Yue) Fang Master

                  Yeah, I think so.

                   

                  You can add cxfse endpoint in your camel router target, and in cxf:se endpoint you can use proxy which target is cxfbc:provider to send outgoing message to external service.

                   

                  Take a look at[1] to get more details about how proxy works in cxfse

                   

                  http://servicemix.apache.org/servicemix-cxf-se.html

                   

                  Freeman

                  • 6. Re: camel routing to jaxws:client endpoint
                    Freeman(Yue) Fang Master

                    Another option is you can deploy a jaxws:endpoint with NMR transport, put this endpoint as "to" uri for your camel router(we have cxf-camel-nmr example shipped with kit which is very similar with this scenario), then in the implementor of this jaxws:endpoint, you can use normal cxf client to invoke exteranl webservice, it's should be same as you do with standalone cxf. In this case, you only use NMR layer, NO JBI get involved at all, and your normal cxf client handle the transport protocol.

                     

                    Both option should work, all depend on your specific requirement.

                     

                    Freeman

                    • 7. Re: camel routing to jaxws:client endpoint
                      Tao Xiao Newbie

                      Thanks again.

                       

                      Correct me if I am wrong. My understanding is cxf:se is a webservices provider which provides the ability to generate webservices and exposes to outside world (generates WSDL). So why do we need to use cxf:se in this case?

                       

                      Can I route the message via camel directly to cxfbc:provider which then invokes external webservices (WSDL based)?

                       

                      Thanks

                      • 8. Re: camel routing to jaxws:client endpoint
                        Freeman(Yue) Fang Master

                        Hi,

                         

                        About your question on cxfse

                        cxfse generate and expose serivice/wsdl to JBI.

                         

                        Yeah, your camel router can directly point to cxfbc:provider.

                        The reason I insert cxfse/cxfse:proxy between the flow is that you get the change to do some work in cxfse endpoint and using cxfse:proxy to invoke another SEI in the flow.

                        Sth like

                        your camel router--->cxfse(BookService) 

                        cxfse proxy (CheckServiceAvailable), the cxfse code can get some response from cxfse proxy and then return to camel router, this is a general use case.

                        We have lots of testcase with servicemix-cxf-bc and serivicemix-cxf-se  which IMHO is used for typical scenario and very helpful, you may need take a look, it's good material for newbie.

                         

                        Freeman

                        • 9. Re: camel routing to jaxws:client endpoint
                          aarong Newbie

                          We are doing something very similar, what we did is use a cxfEndpoint bean in our XML.  We the address, wsdlURL, serviceName & endpointName were filled out,  and we added a cxf:property as dataFormate=MESSAGE

                           

                          and we then in our route did something like (this is a our test case to load a file to the external web service).

                           

                                

                           

                          We did have to add a XSL so that the it would create the SOAP envelop, with soap header & body.