2 Replies Latest reply on Mar 13, 2015 5:15 AM by mfernandezmartinez

    Consuming Services from Java Camel Implementation

    mfernandezmartinez

      Hi!

       

      I'm trying to consume a service from a Processor in a Java Camel implementation. The service reference is a gateway to a external SOAP WebService.

      I tried to used a ReferenceInvoker with annotations as explained in the documentation, but it doesn't get injected...throwing a NPE when I try to use it.

       

      This is what I tried:

      @Inject

      @Reference("CamelServiceRoute/MonitoringWS")

        private ReferenceInvoker service;

       

      and:

      @Inject

      @Reference("MonitoringWS")

        private ReferenceInvoker service;

       

      And this is how the project looks like:

      sy.PNG

       

      Camel route:

      from("switchyard://ProxyService")

           .to("switchyard://ProxifiedService")

           .process(processorThatTriesToInvokeMonitoringWithTheReferenceInvoker)

           .end();

       

      What can I do to achive my objective?

       

      Thank you.

      Regards,

       

      Miguel

        • 1. Re: Consuming Services from Java Camel Implementation
          kcbabo

          Tough to say without seeing your project, but the yellow warning icon on your Camel service component is something to investigate.  If you hover over it you should get details on the warning or just check the Problems view in Eclipse.  Reference injection is meant for classes managed through SY, which means there's a component definition and a reference definition in switchyard.xml.  Any reason why you are calling the service from a processor instead of calling it via a switchyard:// endpoint in the Camel route?

          • 2. Re: Consuming Services from Java Camel Implementation
            mfernandezmartinez

            Thank you Keith.

             

            I was trying to do the call in a processor due to the fact that the request for the Monitoring reference was completely different from the original one.

            Anyway, ReferenceInvoker succesfully worked with a normal Bean declared in the switchyard.xml as you said.