0

FUSE (Ver. 4.3.0) ESB/OSGi コンテナーにキャメル (Ver. 2.4.0) ルートを設定しようとしています。WebService 呼び出しを「プロキシ」アドレスから実際のサービスにルーティングするには、単純な cxf-proxy である必要があります。

私はいくつかのドキュメントを読みました:

次のスプリング構成を設定します。

<?xml version="1.0" encoding="UTF-8"?>
<beans
    xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:camel="http://camel.apache.org/schema/spring"
    xmlns:osgi="http://www.springframework.org/schema/osgi"
    xmlns:cxf="http://camel.apache.org/schema/cxf"
    xsi:schemaLocation="
        http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
        http://www.springframework.org/schema/osgi
        http://www.springframework.org/schema/osgi/spring-osgi.xsd
        http://camel.apache.org/schema/osgi
        http://camel.apache.org/schema/osgi/camel-osgi.xsd
        http://camel.apache.org/schema/spring
        http://camel.apache.org/schema/spring/camel-spring.xsd
        http://camel.apache.org/schema/cxf
        http://camel.apache.org/schema/cxf/camel-cxf.xsd">

    <import
        resource="classpath:META-INF/cxf/cxf.xml" />
    <import
        resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
    <import
        resource="classpath:META-INF/cxf/cxf-extension-http.xml" />
    <import
        resource="classpath:META-INF/cxf/osgi/cxf-extension-osgi.xml" />

    <!-- the proxy service -->
    <cxf:cxfEndpoint
        id="myServiceProxy"
        address="http://localhost:9003/cxf/myService"
        serviceClass="foo.bar.iface.MyServiceInterface" />

    <!-- my real existing cxf soap service -->
    <cxf:cxfEndpoint
        id="myService"
        address="http://foo.bar/services/myService"
        wsdlURL="http://foo.bar/services/myService?wsdl"
        serviceClass="foo.bar.iface.MyServiceInterface"
        serviceName="s:MyService"
        endpointName="s:MyServiceEndpoint"
        xmlns:s="http://foo.bar/iface/" />

    <!-- route -->
    <camel:camelContext>
        <camel:route>
            <camel:from
                uri="cxf:bean:myServiceProxy" />
            <camel:to
                uri="cxf:bean:myService" />
        </camel:route>
    </camel:camelContext>

</beans>

FUSE でバンドルを開始しようとすると、この例外が発生します

karaf@root> Exception in thread "SpringOsgiExtenderThread-22" org.apache.camel.RuntimeCamelException: java.lang.IllegalStateException: Endpoint address should be a relative URI wrt to the servlet address (use '/xxx' for example)
        at org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1126)
        at org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:103)
        at org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:231)
        at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:97)

何が悪いのかわかりません。エンドポイント アドレスが間違っているのではないかと疑っており、サーブレット アドレスがわかりません (cxf:cxfEndoint サーブレット アドレス属性がありません)。

この問題を解決するために私を正しい方向に導くための助けをいただければ幸いです。

ありがとうクラウス

4

1 に答える 1

1

私は最終的に何が問題なのかを知りました。

その代わり

<!-- the proxy service -->
<cxf:cxfEndpoint
    id="myServiceProxy"
    address="http://localhost:9003/cxf/myService"
    serviceClass="foo.bar.iface.MyServiceInterface" />

そうでなければならない

<!-- the proxy service -->
<cxf:cxfEndpoint
    id="myServiceProxy"
    address="/myService"
    serviceClass="foo.bar.iface.MyServiceInterface" />

最初のアプローチは、FUSE の外部でキャメル プロジェクトを実行するとうまく機能したため (この場合、サービスを提供するために http サーバーが開始されます)、FUSE 内の相対アドレスである必要があります。

FUSE 内では、(localhost:8181) で実行される組み込み HTTP サーバーが使用され、サービスの URL が に拡張されhttp://localhost:8181/cxf/myServiceます。

于 2011-04-07T11:01:11.827 に答える