2012-05-04 17 views
2

我一直在用cxf和骆驼来制作平静的web服务,我遇到了一个奇怪的问题,我不知道这是一个普通的骆驼行为还是什么。Apache Camel和CXF:Mutlitple cxf:rsServer标签..这可能吗?

我有多个类作为restful服务公开并映射到不同的路径。首先,我只有cxf在我的配置中,我可以将所有类同时公开为服务。现在,我也使用骆驼我有标签这样的:

<camelcxf:rsServer id="rsServer1" address="/" 
      serviceClass="com.something.PoiSearchImpl"> 
     </camelcxf:rsServer> 
<camelcxf:rsServer id="rsServer2" address="/" 
      serviceClass="com.something.FooBarImpl"> 
     </camelcxf:rsServer> 

在此之后,我有两条路线,从我的CXF端点(如上所述)开始,并做一些处理。问题是只有一个服务正在工作,其他的只是没有被调用。它给了我404没有发现错误。这是正常的,或者我错过了我的配置中的东西?

回答

0
Hi Sikorski, 
Camel supports multiple cxf:rsServer. The problem with your approach is that both are mapped to an address '/'. This means that one of the servers is invoked. 

解决方案:你需要有唯一地址像下面每个rsServer,

<camelcxf:rsServer id="rsServer1" address="/Bar" serviceClass="com.something.PoiSearchImpl"> 
</camelcxf:rsServer> 
<camelcxf:rsServer id="rsServer2" address="/Foo" serviceClass="com.something.FooBarImpl"> 
</camelcxf:rsServer> 
+0

以及它有点晚了告诉我,我最终理解了它。现在我正在以不同的方式来完成它,并且它已经在“制作”了。关于你的方针“你的方法问题”,我宁愿说问题是我的方法完全:D – Sikorski