0

I am confused with the behaviour of cxf rest web service with camel route file. I have noticed the control never go inside the implementing class of the rest service interface.

Following are the steps how i am writing the web service using cxf jaxrs and camel

  1. i have create a interface.

    @Path("/licence")
    public interface LicenceThresholdService {
        @POST
        @Consumes({MediaType.APPLICATION_JSON})
        @Path("/userThresholdBreached")
        Boolean isUsersThresholdBreached(User user);
    }
    
  2. Implementation class

    public class LicenceThresholdServiceImpl implements LicenceThresholdService {
        @Override
        public Boolean isUsersThresholdBreached(final OEMUser user) {
            System.out.println("inside threshold breched method");
            return Boolean.FALSE;
        }
     }
    
  3. Create the cxf jaxrs server

    <beans ...
        xmlns:cxf="http://camel.apache.org/schema/cxf"
        ...
        xsi:schemaLocation="
         http://camel.apache.org/schema/cxf 
         http://camel.apache.org/schema/cxf/camel-cxf.xsd
        ...">
        <cxf:rsServer id="userProfileService"
            address="http://{{service.host}}:{{service.port}}/userProfile"
            serviceClass="com.jato.esb.service.licence.LicenceThresholdServiceImpl"
            loggingFeatureEnabled="true">
            <cxf:providers>
                <bean class="org.codehaus.jackson.jaxrs.JacksonJsonProvider"/>
            </cxf:providers>
        </cxf:rsServer>
    </beans>
    
  4. injected the cxf rsServer bean in camel route endpoint

    <from uri="cxfrs://bean://userProfileService" />
    

Now my problem is whenever i call this service, control never went inside isUsersThresholdBreached method of LicenceThresholdServiceImpl class. Because of this i am not able to fully leverage the cxf rest services.

I have tried the cxf rest service with Mule esb and Spring application file, i have noticed that control always went inside the implementation class also, but this is not the case with camel route. I am using the redhat fuse esb.

Please help me out for this issue, this is a serious concern for us to go with camel.

Peter Keller
  • 7,526
  • 2
  • 26
  • 29
vashishth
  • 2,751
  • 4
  • 38
  • 68

1 Answers1

0

The serviceClass you used just from mapping the REST request to a java method invocation, the invocation information will be passed into camel route. In this way we can provides more generic solution, can you don't need to use ProducerTemplate the send the message to camel route.

Willem Jiang
  • 3,291
  • 1
  • 14
  • 14