我是Apache Camel和CXF的新手,我正在尝试创建一个路由来查询需要基本身份验证并指定SoapAction头的远程WS . 我用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>
提前致谢
1 回答
您可以使用Camel HTTP组件完成此操作:
http://server.com?authMethod=Basic&authUsername=user&authPassword=password
但是,您可能希望利用CXF提供的功能 .
您可以在camel中设置CXF bean,然后设置HTTP管道以提供Basic Auth:
http://cxf.apache.org/docs/client-http-transport-including-ssl-support.html#ClientHTTPTransport%28includingSSLsupport%29-BasicAuthentication
HTTP Conduit使用'name'参数链接到Camel CXF bean . 您将其设置为我上面所做的URL,或检查文档以将其设置为与您的服务匹配的URI .
谢谢,Yogesh