You could do that via cxf out interceptor.  You would need to create an
intercepter that will construct your soap header and register it with your
client(see camel cxf docs).  When your client sends a request, interceptor
will inject the soap header based on defined instructions.

Example:
public class YourSecurityInterceptor extends
AbstractPhaseInterceptor<Message> {
    public YourSecurityInterceptor() {
        super(Phase.PRE_PROTOCOL);
    }
public void handleMessage(SoapMessage mc) {
    List<Header> list = mc.getHeaders(); 
    ServiceAuthHeader auth = new ServiceAuthHeader();
    auth.setUserName("username");
    auth.setPassword("password");
    SoapHeader newHeader = new SoapHeader(new QName("namespace",
"name"),auth, new JAXBDataBinding(ServiceAuthHeader.class));
    newHeader.setDirection(Direction.DIRECTION_IN);
    list.add(newHeader);
}
}

Dmitriy



--
View this message in context: 
http://camel.465427.n5.nabble.com/How-to-set-username-password-in-custom-SOAP-header-from-cxf-endpoint-and-camel-route-to-call-externae-tp5782793p5783040.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to