3

我一直在用 cxf 和骆驼制作宁静的网络服务,我遇到了一个奇怪的问题,我不知道这是正常的骆驼行为还是什么。

我有多个类公开为 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 not found 错误。这是正常的还是我的配置中缺少某些东西?

4

1 回答 1

0
嗨西科尔斯基,
Camel 支持多个 cxf:rsServer。您的方法的问题是两者都映射到地址“/”。这意味着调用其中一个服务器。

解决方案:您需要为每个 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>
于 2013-09-26T12:11:07.820 回答