2

ApacheCXFをApacheCamelと統合しようとしています。キャメルの構成:

<cxf:cxfEndpoint id="authTest"
        address="/cxfAuth"
        serviceClass="com.test.AuthService" >
        <cxf:properties>
            <entry key="dataFormat" value="POJO" />
            <entry key="setDefaultBus" value="true" />
        </cxf:properties>
    </cxf:cxfEndpoint>

     <camel:camelContext trace="true">
        <camel:route>
            <camel:from uri="cxf:bean:authTest" />
            <camel:to uri="bean:routeExitResponseProcessor"/>
        </camel:route>
    </camel:camelContext>

Webサービスで特定の操作を呼び出すために、これを使用しています。

<camel:route>
            <camel:from uri="direct:startAuthTest"/>
            <camel:setHeader headerName="getEmployee"> 
                <camel:constant>gid</camel:constant> 
            </camel:setHeader> 
            <camel:to uri="cxf:bean:authTest" />
            <camel:log message=">>> data is : ${body}"/>
            <camel:to uri="bean:routeExitResponseProcessor"/>
        </camel:route>

しかし、上記の構成を含めた後WARN ServletController:149 - Can't find the the request for http://localhost:8080/CXFService/services/cxfAuth's Observer、サーバーコンソールにアクセスしましたが、ブラウザーにWebサービスが見つかりません。

助けてください。

4

2 に答える 2

2

以下を呼び出すと、呼び出されるCXF操作名を取得できます...詳細については、 http://camel.apache.org/cxf.htmlを参照してください。

String operation = (String)in.getHeader(CxfConstants.OPERATION_NAME);

また、使用例については、この単体テストを参照してください...

http://svn.apache.org/repos/asf/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerTest.java

于 2012-04-24T17:43:49.157 に答える
0

CXFエンドポイントで

    <cxf:cxfEndpoint id="yourServiceCall"
    address="http://localhost:8181/yourservice/services/yourserviceport"
    wsdlURL="wsdl/yourwsdl.wsdl" xmlns:ns="http://service.your.com"
    endpointName="ns:YourServicePort" serviceName="ns:yourService"
    serviceClass="com.service.YourServicePortType">

とキャメルエンドポイントで

   camelContext id="camelId" xmlns="http://camel.apache.org/schema/spring">
   <camel:dataFormats>
        <camel:jaxb contextPath="com.your.service" id="jaxb" />
    </camel:dataFormats>

    <route id="route1">
        <from uri="cxf:bean:yourServiceCall?dataFormat=PAYLOAD" />
        <camel:unmarshal ref="jaxb" />
        <log message="log: Called from cxf endpoint" />
        <!-- Your Logic -->
        <camel:process ref="ExitResponseProcessor"/>
        <camel:marshal ref="jaxb" />
    </camel:route>

Himanshu Yadavコメントに基づく:更新

 <camel:choice>
 <camel:when>
 <camel:simple>${body} is com.your.service.YourRequest</camel:simple>
 <!-- Your Logic or call any bean method with <camel:bean ref="YourBean " method="YourMethod" /      /> -->
 </camel:when>
 <camel:when> </camel:when>
 <camel:otherwise> </camel:otherwise>
 </camel:choice
于 2014-12-05T13:56:48.500 に答える