cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brady Adams <>
Subject Need Help Please... - Adding ID in the Header
Date Wed, 09 Oct 2013 09:46:56 GMT
Hi Team,

I am newbie to the Apache CXF. My requirement is to pass the Soap header
and need to add a custom HTTP Header. Please help me.

As per my understanding first the Clients Out Interceptors sends the Out
Message and it is received by the Server In Interceptors and the same is
transported to the Service Out Interceptors and again to Client In

i.e. Client ----> Out  to  Server ----> IN        and Server ----> Out to
Client ----> In

Please correct me if I am wrong.

So I have written a Client Out interceptor which extends
AbstractPhaseInterceptor<Message> with interceptor Phase.SETUP and the code
is as below, the MessageContext I am passing as a parameter in the Client
Implementation.  As *ClientProxy.getClient(port).getOutInterceptors().add(new

*public class ClientOutInterceptor extends
AbstractPhaseInterceptor<Message> {

    private static Logger LOG =

    private MessageContext msgContext;

    public ClientOutInterceptor(MessageContext msgContext) {
        this.msgContext = msgContext;

    public void handleMessage(Message message) throws Fault {

        List<Header> outHeaders = new ArrayList<Header>();
        List<SoapHeader> inHeaders = (ArrayList<SoapHeader>)
        for (Header header : inHeaders) {
            outHeaders.add(new Header(header.getName(), header.getObject(),
        message.put(IConstants.SOAP_HEADER, outHeaders);

And my Service In Interceptor is extending
AbstractPhaseInterceptor<Message> and the Interceptor Phase.RECEIVE and the
code is as below,

*public class ServiceInInterceptor extends
AbstractPhaseInterceptor<Message> {

    private static Logger LOG =

    public ServiceInInterceptor() {

    public void handleMessage(Message message) throws Fault {" ServiceInInterceptor "+message.get(IConstants.SOAP_HEADER));


and I have configured this in the service side xml

            <ref bean="msgInInterceptor" />

But here I am not getting the messages in the Service In Interceptor and
the same has to be transported to Service Out and to the Client In
Interceptors, please can anyone help me how to do this. It will be of great
help. We are in a very critical position to implement this.

Please help me on this regard.

Thanks in Advance,


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message