Another option is to create a List of org.apache.cxf.binding.soap.SoapHeader 
and put it into the Camel Headers under: 
org.apache.cxf.headers.Header.HEADER_LIST

The Camel CXF component will add the SOAP Header to the SOAP Envelop.


Joe



On 5/24/16, 10:06 AM, "dmitriyC300" <dmitriyc...@gmail.com> wrote:

>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