-
1. Re: CamelRoute from activemq to cxfrs
lusa Mar 10, 2011 2:59 AM (in response to lusa)Hi everybody,
I have test my issue with the org.apache.camel.Processor but I have same error:
<camel:route id="jmsToCxfrs" trace="true">
<camel:from uri="activemq:mqA"/>
<camel:process ref="cxfProcessor"/>
</camel:route>
And here are the processor:
public void process(Exchange exchange) throws Exception {
exchange.setPattern(ExchangePattern.InOut);
Message inMessage = exchange.getIn();
inMessage.setHeader(CxfConstants.CAMEL_CXF_RS_USING_HTTP_API, Boolean.FALSE);
inMessage.setHeader(CxfConstants.OPERATION_NAME, "getXXX");
inMessage.setHeader(CxfConstants.CAMEL_CXF_RS_RESPONSE_CLASS, XXX.class);
inMessage.setBody(null);
}
This produce the same exception:
java.lang.NoSuchMethodException: Can find the method getXXX with these parameter http://class org.apache.camel.component.jms.JmsMessage
at org.apache.camel.component.cxf.jaxrs.CxfRsProducer.findRightMethod(CxfRsProducer.java:221).
Is it possible to call a cxfrs method without parameters?
Thanks a lot for your help,
LuSa
-
2. Re: CamelRoute from activemq to cxfrs
davsclaus Mar 10, 2011 3:54 AM (in response to lusa)Hi
Yeah looks like the source code mandates a parameter. I will log an enhancement.
-
-
4. Re: CamelRoute from activemq to cxfrs
lusa Mar 10, 2011 4:33 AM (in response to davsclaus)Hi davsclaus ,
Thanks for your reply, for the moment I have make my own patch like this:
In my Processor I have add my own TypeConverter:
public class CXFConverter implements TypeConverter {
@SuppressWarnings({"unchecked"})
@Override
public type, Exchange exchange, Object value) throws NoTypeConversionAvailableException {
return convertTo(type, value);
}
}
and I have set it like this:
((SpringCamelContext) inMessage.getExchange().getContext()).setTypeConverter(new CXFConverter());
So my custom Processor is now:
public class CXFProcessor implements Processor {
@Override
public void process(Exchange exchange) throws Exception {
exchange.setPattern(ExchangePattern.InOut);
Message inMessage = exchange.getIn();
((SpringCamelContext) inMessage.getExchange().getContext()).setTypeConverter(new CXFConverter());
inMessage.setHeader(CxfConstants.CAMEL_CXF_RS_USING_HTTP_API, Boolean.FALSE);
inMessage.setHeader(CxfConstants.OPERATION_NAME, "getXXX");
inMessage.setHeader(CxfConstants.CAMEL_CXF_RS_RESPONSE_CLASS, XXX.class);
inMessage.setBody(null);
}
}
Greetings,
LuSa
-
5. Re: CamelRoute from activemq to cxfrs
davsclaus Mar 10, 2011 5:11 AM (in response to lusa)Hi
Thanks for posting the workaround.