Apache Camel-Oling2读取端点不起作用

时间:2016-08-23 19:44:05

标签: apache-camel odata olingo

我正在使用Apache Camel并尝试使用Camel-Olingo2组件读取Odata但每次都出现“serviceUri”错误。我已经尝试过文档实现但是找不到任何成功。请告诉我使用camel-olingo2组件与odata连接的方式。

代码:

<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>

例外:

  

线程“main”中的异常   org.apache.camel.FailedToCreateRouteException:无法创建路由   route1 at:&gt;&gt;&gt;   至[olingo2://read/services.odata.org/OData/OData.svc/Persons]&lt;&lt;&lt;在   路线:路线(路线1)[[来自[直接:...]] - &gt; [要[olingo2://读取/ HTTP:...   因为无法解析端点:   olingo2://read/services.odata.org/OData/OData.svc/Persons由于:   serviceUri at   org.apache.camel.model.RouteDefinition.addRoutes(RouteDefini tion.java:1072)

1 个答案:

答案 0 :(得分:0)

您需要将serviceUri添加到olingo组件端点的末尾,如下所示:

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

您是否有理由想要创建地图并将其引用用于组件的属性,而不是仅将其添加到端点的末尾?