7 Replies Latest reply: Jan 23, 2012 9:18 AM by Tomohisa igarashi RSS

Injecting service reference with different interface

Tomohisa igarashi Expert

Hi all,

 

I'm now struggling with modifying transform-json quickstart in order to add hornetq-binding. I have got a problem to inject service reference with differenct interface. this is the testcase.

https://github.com/igarashitm/quickstarts/tree/SWITCHYARD-594_reftest/transform-json-reftest

 

I'm trying to inject a "OrderService" bean service using another interface, "JsonOrderService" into "ProcessJsonOrderService" bean service. like this:

public class ProcessJsonOrderServiceBean implements ProcessJsonOrderService {

    @Inject @Reference("OrderService")

    JsonOrderService _orderService;

......

 

"JsonOrderService" interface is like this:

public interface JsonOrderService {

    @OperationTypes(in="{urn:switchyard-quickstart:transform-json:1.0}order",

            out="{urn:switchyard-quickstart:transform-json:1.0}orderResponse")

    String submitOrder(String orderJson);

}

Original "OrderService" interface defines the method "OrderAck submitOrder(Order order)" and the above interface is just needed to trigger the Json transformation.

 

The first problem is that, maven build seems to ignore the @Reference("OrderService") annotation when manipulating switchyard.xml. The output includes the reference to "JsonOrderService" service which doesn't exist so it couldn't be deployed. That should be the reference to "OrderService".

 

The second problem is that, even if I change this reference from "JsonOrderService" to "OrderService" manually, it couldn't work. I have got following log.

17:44:24,509 ERROR [org.switchyard.internal.DefaultHandlerChain] (Thread-0 (group:HornetQ-client-global-threads-343697155)) org.switchyard.component.bean.BeanComponentException: Invocation of operation 'processOrder' on bean component 'org.switchyard.quickstarts.transform.json.ProcessOrderServiceBean' failed with exception.  See attached cause.

17:44:24,510 WARN  [org.switchyard.internal.ExchangeImpl] (Thread-0 (group:HornetQ-client-global-threads-343697155)) Fault generated during exchange without a handler: org.switchyard.component.bean.BeanComponentException: Invocation of operation 'processOrder' on bean component 'org.switchyard.quickstarts.transform.json.ProcessOrderServiceBean' failed with exception.  See attached cause.

ServiceProxyHandler#handle() in the bean component impl caught InvocationTargetException and outputted above.

 

Things I already know is above and still investigating. If you find any point I have missed, please let me know.

 

Thanks,

Tomo