Friday, December 25, 2015

IllegalArgumentException when invoking a webservice from a Camel Route

If a service exposes more than one operation then the operation name and namespace should be set in the header before invoking the call from the Route.
The IllegalArgumentException or BindingOperationInfo Exception is thrown when the framework is not able to find the matching operation to invoke.To fix this ,verify the operation name and namespace from the service class defined in the CXF EndPoint Bean.If the operation name or namespace is different,the binding would fail and IllegalArgumentException would be thrown.To fix this error,ensure that  the operation name and namespace match with the details given the SEI class.
  
<route>
     <from uri="timer:foo?period=5000" />
     <setHeader headerName="operationName">
            <constant>generateText</constant>
    </setHeader>
    <setHeader headerName="operationNamespace">
       <constant>http://com.test/generateservice</constant>
   </setHeader>             
  <to uri="cxf:bean:generateService" />
 <log message="The message contains ${body}" />
</route>