【问题标题】:Camel CXF producer basic authCamel CXF 生产者基本身份验证
【发布时间】:2012-09-30 18:37:26
【问题描述】:

我是 Apache Camel 和 CXF 的新手,我正在尝试创建一个路由来查询需要基本身份验证的远程 WS 并指定 SoapAction 标头。我用 spring-ws 组件实现了它,但我想知道是否可以用 cxf 组件做同样的事情。

我目前的配置是:

RouteBuilder
from("file:src/test/resources/data?noop=true")
    .to("xquery:transform/search.xquery")
    .to("cxf:-----")
    .to("log:TestApp");

我读过一些关于管道的东西,但我不知道如何在我当前的骆驼上下文中配置它。

CamelContext
<camel:camelContext xmlns="http://camel.apache.org/schema/spring">
    <package>my.package</package>
</camel:camelContext>

提前致谢

【问题讨论】:

    标签: authentication cxf apache-camel


    【解决方案1】:

    您可以使用 Camel HTTP 组件完成此操作:

    http://server.com?authMethod=Basic&authUsername=user&authPassword=password

    但是,您可能希望利用 CXF 提供的功能。

    您可以在 camel 中设置一个 CXF bean,然后设置一个 HTTP 管道以提供基本身份验证:

    http://cxf.apache.org/docs/client-http-transport-including-ssl-support.html#ClientHTTPTransport%28includingSSLsupport%29-BasicAuthentication

    <conduit name="https://localhost:.*""
       xmlns:sec="http://cxf.apache.org/configuration/security"
       xmlns="http://cxf.apache.org/transports/http/configuration">
       <authorization>
          <sec:UserName>myuser</sec:UserName>
          <sec:Password>mypasswd</sec:Password>
          <sec:AuthorizationType>Basic</sec:AuthorizationType>
       </authorization>
     </conduit>
    

    HTTP 管道使用“名称”参数链接到 Camel CXF bean。您可以像我上面那样将其设置为 URL,或者查看文档以将其设置为与您的服务匹配的 URI。

    谢谢, 尤格什

    【讨论】:

    • 谢谢 Yogesh 我会尽快尝试
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-03-10
    • 1970-01-01
    • 2015-01-26
    • 1970-01-01
    • 2012-03-18
    • 1970-01-01
    • 2014-01-31
    相关资源
    最近更新 更多