Hi Antony,

You already find the way to set the conduit with your custom policy :)
If you are using the latest Camel 2.9.0-SNAPSHOT , you can do the job by setting the property of the cxfEndpoint like this without digging the HttpCondit out

Map <String, Object> myProperties = new HashMap<String, Object>
myProperties.add("org.apache.cxf.configuration.security.AuthorizationPolicy", myAuthorizationPolicy);
cxfEndpoint.setProperties(myProperties);

On Mon Nov 28 07:47:17 2011, awillia wrote:
Thank you for the reply. I am using the camel cxf end point, so this:

import org.apache.camel.component.cxf.CxfEndpoint;

I have seen some configuration setting for a conduit, but I am trying to do
this programatically (the routes are dynamically created based on database
configuration). So I have started looking at something like this:

CxfEndpoint cxfEndpoint = new CxfEndpoint(app.getMessageServiceUrl(),
camelContext);
cxfEndpoint.setServiceClass(PartnerSMSService.class.getCanonicalName());

CxfProducer producer = (CxfProducer)cxfEndpoint.createProducer();
HTTPConduit conduit = (HTTPConduit)producer.getClient().getConduit();

AuthorizationPolicy policy = new AuthorizationPolicy();
policy.setAuthorizationType(HttpAuthHeader.AUTH_TYPE_BASIC);
policy.setUserName(app.getExternalUserName());
policy.setPassword(app.getExternalPassword());
conduit.setAuthorization(policy);

RouteDefinition def = from(RECEIVING_QUEUE_PREFIX + app.getName()); // Pull
from each application's queue
        .process(new WebServiceProcessor())
        .to(cxfEndpoint); // Send to application's configured endpoint

However I am not so sure that this will work, I think the producer that I am
creating here is not the one that will actually be used?? I am not sure.

Do you have any suggestions for how I might define the conduit
programatically?

thanks
Antony

--
View this message in context: 
http://camel.465427.n5.nabble.com/HTTP-Basic-authenticaiton-on-CxfEndpoint-tp5021812p5027441.html
Sent from the Camel - Users mailing list archive at Nabble.com.




--
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
        http://jnn.javaeye.com (Chinese)
Twitter: willemjiang Weibo: willemjiang

Reply via email to