0

I am using Apache Camel and trying to read Odata using Camel-Olingo2 component but i got "serviceUri" error everytime. I've tried documentation implementation but couldn't find any success. Please do let me know the way of connectivity with odata using camel-olingo2 component.

Code:

<bean id="parambean" class="org.springframework.beans.factory.config.MapFactoryBean">
  <property name="sourceMap">
   <map  key-type="java.lang.String" value-type="java.lang.String">
     <entry key="serviceUri" value="http://services.odata.org/OData/OData.svc"/>
   </map>
  </property> 
 </bean> 

 <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
    <route>
         <from uri="olingo2://read/Persons?queryParams=#parambean" />
         <to uri="file:D:\Camel\Output" />  
    </route> 
</camelContext>

Exception:

Exception in thread "main" org.apache.camel.FailedToCreateRouteException: Failed to create route route1 at: >>> To[olingo2://read/services.odata.org/OData/OData.svc/Persons‌​] <<< in route: Route(route1)[[From[direct:...]] -> [To[olingo2://read/http:... because of Failed to resolve endpoint: olingo2://read/services.odata.org/OData/OData.svc/Persons due to: serviceUri at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefini‌​tion.java:1072)

Kenster
  • 23,465
  • 21
  • 80
  • 106

1 Answers1

0

You need to add a serviceUri to the end of your olingo component endpoint like below:

<from uri="olingo2://read/Persons?serviceUri=http://services.odata.org/OData/OData.svc" />
     <to uri="file:D:\Ca...

Is there a reason you wanted to create a map and use the reference of that for the component's properties rather than just adding it to the end of the endpoint?

fiw
  • 716
  • 5
  • 8