7 Replies Latest reply on Feb 23, 2010 5:45 PM by lyfe

    suggestions on integrating web services using servicemix

    lyfe

      I'm looking for suggestions on accomplishing the following:

       

      I have web services running on multiple servers.  Currently, when a server (let's call it ServerA) wants to talk to a web services on another server (let's call it ServerB), ServerA would grab the wsdl for the services on ServerB, generate a web service client, then contact the services on ServerB directly.  I want to now use an ESB to eliminate ServerA from contacting ServerB directly.  Also, I would like to be able to use routing (servicemix-camel) to handle functions like aggregation and content-based routing.

       

      The only suggestion I came up with involves writing an API each server can write to in order to contact the ESB and pass the necessary parameters...but I'm sure there's another (better) way.

        • 1. Re: suggestions on integrating web services using servicemix
          martinmurphy

          You can just deploy a camel route that has two CXF endpoints in it. One that listens for Server A and another that sends to Server B. In between these endpoints in your route you can add any kind of content based routing you need.

          • 2. Re: suggestions on integrating web services using servicemix
            lyfe

            Thanks.

             

            I'm assuming you are referring to the servicemix-cxf-bc component.  There is an option to deploy a listener (consumer) and sender (producer).  This looks like it will lead me down the right path.

             

            I have a follow on question about using the servicemix-cxf-bc component.  I would like to make it where web services can contact servicemix (ie, make access a bit more generic) and servicemix will then do a bit of content routing.

             

            Is this possible in a more generic way or do I need to create a servicemix-cxf-bc consumer and producer for each interaction?

             

            Just for a bit more clarity, this is an example of what I'm thinking:

            1.  create a wsdl that represents a web service deployed inside servicemix

            2.  create and deploy a cxf web service inside servicemix that will route the request to my camel routing

            3.  in my camel routing, use the content-based routing pattern to analyze the soap msg and route accordingly

            • 3. Re: suggestions on integrating web services using servicemix
              lyfe

              As a first step to implementing this, I'm implementing a proxy (client --> consumer --> producer --> service).  Later, I'll add the camel routing.

               

              When I call my cxf consumer (http://localhost:8000/Calculate), I get a connection refused error.

               

              My xbean.xml is as follows:

               

              <cxfbc:consumer wsdl="classpath:Calculate.wsdl"

                                      service="calculate:ConsumerCalculateService"

                                      endpoint="ConsumerCalculateEndpoint"

                                      targetService="calculate:ProducerCalculateService"/>

               

              <cxfbc:producer wsdl="classpath:Calculate.wsdl"

                                     service="calculate:ProducerCalculateService"

                                     endpoint="ProducerCalculateEndpoint"/>

               

               

              My WSDL (for the service section) is as follows:

               

              <!-- real service -->

              <wsdl:service name="CalculateService">

                       <wsdl:port binding="impl:CalculateSoapBinding" name="Calculate">

                                <wsdl:address location="http://localhost:8080/Calculator/services/Calculate"/>

                       </wsdl:port>

              </wsdl:service>

               

              <!-- cxf consumer -->

              <wsdl:service name="ConsumerCalculateService">

                       <wsdl:port binding="impl:CalculateSoapBinding" name="ConsumerCalculateEndpoint">

                                <wsdl:address location="http://localhost:8000/Calculate"/>

                       </wsdl:port>

              </wsdl:service>

               

              <!-- cxf producer -->

              <wsdl:service name="ProducerCalculateService">

                       <wsdl:port binding="impl:CalculateSoapBinding" name="ProducerCalculateEndpoint">

                                <wsdl:address location="http://localhost:8090/Calculate"/>

                       </wsdl:port>

              </wsdl:service>

               

              For my WSDL, I took the actual service's WSDL and added a service entry for the cxf consumer and producer.

               

              Also, when I replaced the address for the producer with the actual service's address, I then get a not found error.

               

              FYI: some additional info when doing some testing from a browser

              When I try to access http://localhost:8000/Calculate from browser, I get a no such operation error.  However, I can access the WSDL via http://localhost:8000/Calculate?wsdl

               

              Edited by: lyfe on Nov 17, 2009 5:43 PM (added info from browser testing)

              • 4. Re: suggestions on integrating web services using servicemix
                lyfe

                I got the following flow to work:

                 

                external client --> cxf consumer --> cxf producer --> external service

                 

                The following things were done:

                - reboot my IDE (think an uncleared conflict with port 8080 never got cleared)

                - reboot servicemix

                - used an unedited WSDL file from external service

                - consumer

                <cxfbc:consumer wsdl="classpath:Calculate.wsdl"

                service="calculate:CalculateService"

                endpoint="soap"

                targetService="calculate:CalculateService"

                targetEndpoint="calculate:Calculate"

                locationURI="http://localhost:8000/Calculate"/>

                - producer

                <cxfbc:producer wsdl="classpath:Calculate.wsdl"

                service="calculate:CalculateService"

                endpoint="calculate:Calculate

                locationURI="http://localhost:8080/Calculator/services/Calculate"/>

                 

                Now, I'm going to work on the following flow:

                external client --> cxf consumer --> cxf web service --> camel routing --> cxf producer --> external service

                 

                My end goal is to create a way for external clients to access the ESB in a "generic way" as if it's a web service, then the ESB will route the request to the appropriate external web service based on the msg content.  When I state in a "generic way", I'm basically going to have one service deployed in the ESB that takes a SOAP msg containing XML.  From this service, I'm going to generate a WSDL file that external clients can use to generate the necessary classes to access the web service deployed in the ESB.

                 

                Does this plan sounds like it could work or am I going to bang my head into the wall?

                 

                Edited by: lyfe on Nov 17, 2009 7:51 PM

                • 5. Re: suggestions on integrating web services using servicemix
                  lyfe

                  I took a different approach and got this to work..and be much simpler.

                  • 6. Re: suggestions on integrating web services using servicemix
                    micdic

                    Hi lyfe,

                    i have a similar problem as the one you described. I'm using a little bit different approach, but with some problems

                     

                    see my post here :

                     

                    http://fusesource.com/forums/message.jspa?messageID=5775#5775

                     

                    I can (as a workaround) use the solution you got. Can you gice me some more explanations about? (an example could be appreciated).

                     

                    Thanks in advance.

                    • 7. Re: suggestions on integrating web services using servicemix
                      lyfe

                      For this situation, I took out the cxf components (however, I may need to use in the future).  I was able to achieve what I needed using http endpoints.

                       

                      For the provider endpoints (using http:endpoint since http:soap-provider has a bug in the version I'm using), I specified the locationURI and I placed the wsdl resource on the server with servicemix.  For my situation, this was an ok action.

                       

                      For the consumer endpoint (using http:soap-consumer), make sure to set the value for useJbiWrapper to false (useJbiWrapper="false").  If you don't, your message will be wrapped in an additional tag that you may not be expecting.  I also created a wsdl for the consumer endpoint.  Before I send to the provider endpoint, I do some transformation on the message.

                       

                      Back to the reason for using cxf components.  It looks like using cxf provides additional security features I want to take advantage of.  I'm using version 4.1.0.2.  I've hit many and plenty bugs (and finding "ok" work arounds).  I'm investigating the next release.  I'm hoping to set up a workflow to priduce similar results using cxf components.

                       

                      Regarding your post, I remember hitting the "operation not bound on this message."  I can't remember exactly what I did, if anything, to overcome it.