I’m new to Apache Camel and CXF,
I’m trying to create a route for querying a remote WS which requires Basic Authentication and to specify the Soap Action header.
I was able to achieve the same using camel HTTP component but i needed the same with camel CXF in java DSL
Can anyone guide us in fixing the same
If you want to use camel-cxf component to setup the Basic authentication, you need do some configuration on the CxfEndpoint just like this.
CxfEndpoint cxfEndpoint = camelContext.getEndpoint(“cxf:xxx”); // set the authentication information Map<String, Object> properties = new HashMap<String, Object>(); org.apache.cxf.configuration.security.AuthorizationPolicy authPolicy = new AuthorizationPolicy(); authPolicy.setUserName(username); authPolicy.setPassword(password); properties.put(AuthorizationPolicy.class.getName(), authPolicy); cxfEndpoint.setProperties(properties); from(“xxx”).to(cxfEndpoint);