12 Replies Latest reply on Nov 6, 2011 8:09 PM by njiang

    Simple Route Question

    gt6081a

      Greetings,

       

      I have a fairly simple route setup that is to login to a remote webservice and capture the response from that service.  This webservice will always get the same SOAP message so I have stored it in a velocity template.  The route is as follows:

       

       

            

       

      When this is run what ends up in the sforceLoginResponse.xml file is the request sent to the salesforce endpoint, or what was in the velocity template.  I have checked the logs at salesforce and this route is definitely working and logging in and squiring the session ID, but for some reason the body responded from the jbi endpoint is not the response but instead the original request.

       

      Does anyone know why this would happen or how I should go about troubleshooting that?

       

      Thanks,

      Eric

        • 1. Re: Simple Route Question
          davsclaus

          You most likely need to use InOut MEP for the JBI endpoint if you want to do a request/reply.

           

          So set the pattern to InOut

           

           

          • 2. Re: Simple Route Question
            gt6081a

            Makes sense.  I changed the route to do that and redeployed it.  Now when it hits the salesforce jbi point I get a org.apache.camel.InvalidPayloadException: No body available of type: java.lang.String...

             

            I attached the tracer from the attempted run.  Also for verbosity since there is a chance I am doing something blatantly wrong since this is all very new to me.  I have also attached the route (camel-context.xml)  and cxfbc endpoint (xbean.xml) along with the WSDL in case it helps.

             

            Thanks for your help, the community has been invaluable in starting the process with all of this.

            • 3. Re: Simple Route Question
              davsclaus

              Add a  before the JBI endpoint.

              • 4. Re: Simple Route Question
                davsclaus

                What version of ServiceMix or Fuse ESB are you using?

                 

                And is there a particular reason for using JBI? eg you are already using JBI etc?

                • 5. Re: Simple Route Question
                  gt6081a

                  There isn't really a reason I am using JBI other than I had a friend help me create the endpoint initially.  Interactions with Salesforce just use SOAP of HTTP, so if there is a better way to set up the endpoint I'd love to hear it. 

                   

                  In all honesty endpoint creation has been the largest headache for me, I've been sticking to CXF-BC for their creation and deployment thus far because that is what was shown to me initially. 

                   

                  Is there a better way to hit web services exposed over http through servicemix / camel?

                  • 6. Re: Simple Route Question
                    gt6081a

                    Unfortunately I got the same error.  I think when it gets to the jbi endpoint it is formatted properly since the login through the endpoint's web service happens properly, just what comes out is the same as what went in to camel.

                    • 7. Re: Simple Route Question
                      gt6081a

                      Perhaps something related to the error message farther down is the issue?  Though that may just be a symptom of the data conversion not working with the InOut pattern.

                       

                      Caused by: javax.xml.transform.TransformerException: org.xml.sax.SAXParseException: The prefix "xmlns" cannot be bound to any namespace explicitly; neither can the namespace for "xmlns" be bound to any prefix explicitly.

                      • 8. Re: Simple Route Question
                        davsclaus

                        Yeah just use the camel-cxf component, and ditch JBI all together. JBI is legacy and not recommend to use for new projects.

                        • 9. Re: Simple Route Question
                          gt6081a

                          Sounds good.

                           

                          Does that then mean I only need to define the CXF endpoints within the camel-context.xml and no longer need to deploy cxf-bc bundles as their own endpoints, or so I keep the existing cxf-bc bundle as is and just change what is used on the camel route itself?

                          • 10. Re: Simple Route Question
                            davsclaus

                            Yes you can have it all in one Camel XML file.

                             

                            There is a CXF example at Apache. Albeit the documentation is a bit overloaded as there are multiple ways.

                             

                            But in the XML basically its the <cxf:cxfEndpoint> you use

                            http://camel.apache.org/cxf-example.html

                             

                            However if you use Blueprint XML then it may be good to check this source code

                            https://svn.apache.org/repos/asf/camel/trunk/examples/camel-example-cxf-blueprint/

                             

                            And there is also webinars which covers using CXF and web servies with Camel and Fuse ESB at

                            http://fusesource.com/resources/video-archived-webinars/

                            • 11. Re: Simple Route Question
                              gt6081a

                              Ok looking that over and checking in the Camel in Action book, the only thing I don't really understand is the serviceClass option.  In the sfdc.wsdl I posted there are obviously a substantial number of operations, so is there a way to forgo the serviceClass and be able to leverage all of the operations contained in the wsdl?

                              • 12. Re: Simple Route Question
                                njiang

                                The serviceClass is used to generated the data binding information for marshaling and ummarshaling even you already specify the WSDL operation.

                                 

                                If you are using MESSAGE or PAYLOAD dataformat, you don't need to specify the serviceClass option, because CXF doesn't need the serviceClass for marshaling and unmarshaling.

                                 

                                Willem