Reputation: 621
I'm new to Apache Camel and CXF, and I'm trying to create a route for querying a remote WS which requires Basic Authentication and to specify the SoapAction header. I achieved it with the spring-ws component but I was wondering if I could do the same with the cxf component.
My current configuration is:
RouteBuilder
from("file:src/test/resources/data?noop=true")
.to("xquery:transform/search.xquery")
.to("cxf:-----")
.to("log:TestApp");
I've read something about conduits but I don't know how to configure it in my current camel context.
CamelContext
<camel:camelContext xmlns="http://camel.apache.org/schema/spring">
<package>my.package</package>
</camel:camelContext>
Thanks in advance
Upvotes: 1
Views: 4201
Reputation: 1603
You can accomplish this with the Camel HTTP component:
http://server.com?authMethod=Basic&authUsername=user&authPassword=password
However, you probably want to take advantage of the functionality that CXF offers.
You can set up a CXF bean in camel and then set up a HTTP conduit to provide the Basic Auth:
<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>
The HTTP Conduit links to the Camel CXF bean using the 'name' parameter. You set it to a URL like I did above or check the documentation for setting it to a URI matching your service.
Thanks, Yogesh
Upvotes: 2