Message inMessage = exchange.getIn();
Object[] varValues = inMessage.getHeader(CxfConstants.CAMEL_CXF_RS_VAR_VALUES, Object[].class);
String methodName = inMessage.getHeader(CxfConstants.OPERATION_NAME, String.class);
Client target = null;
JAXRSClientFactoryBean cfb = clientFactoryBeanCache.get(CxfEndpointUtils
.getEffectiveAddress(exchange, ((CxfRsEndpoint)getEndpoint()).getAddress()));
Bus bus = ((CxfRsEndpoint)getEndpoint()).getBus();
// We need to apply the bus setting from the CxfRsEndpoint which is not use the default bus
if (bus != null) {
cfb.setBus(bus);
}
if (varValues == null) {
target = cfb.create();
} else {
target = cfb.createWithValues(varValues);
}
// find out the method which we want to invoke
JAXRSServiceFactoryBean sfb = cfb.getServiceFactory();
sfb.getResourceClasses();
// check the null body first
Object[] parameters = null;
if (inMessage.getBody() != null) {
parameters = inMessage.getBody(Object[].class);