cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Freeman Fang <freeman.f...@gmail.com>
Subject Re: Problem getting soapHeader in outInterceptor
Date Wed, 19 Jun 2013 03:57:42 GMT
Hi,

What's the phase for the outInterceptor which you try to retrieve soap header?

Also, please double check the request message have the soap header which match the QName you
specified here.

Please take a look at the outInterceptor I put here which can get headers from request message

public class GetSoapHeaderInterceptor extends AbstractSoapInterceptor {
    
    public GetSoapHeaderInterceptor() {
        super(Phase.WRITE);
        addBefore(SoapOutInterceptor.class.getName());
    }

    @Override
    public void handleMessage(SoapMessage message) throws Fault {
        if (message.getExchange() != null) {
            if (message.getExchange().getInMessage() instanceof SoapMessage) {
                SoapMessage requestMessage = (SoapMessage)
                    message.getExchange().getInMessage();
                List<Header> headers = requestMessage.getHeaders();
                System.out.println("header size is " + headers.size());
            }
        }


    }

}

-------------
Freeman(Yue) Fang

Red Hat, Inc. 
FuseSource is now part of Red Hat
Web: http://fusesource.com | http://www.redhat.com/
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com
http://blog.sina.com.cn/u/1473905042
weibo: @Freeman小屋



On 2013-6-18, at 下午7:48, David Karlsen wrote:

> Hi.
> 
> I have an serverside outinterceptor, where I need access to a soap header
> in the correlating incoming request.
> 
> My code:
> 
> QName someQnameOfTheSoapHeader = new QName( ns, localname);
> SoapMessage requestMessage = (SoapMessage)
> soapMessage.getExchange().getInMessage();
> Header header = requestMessage.getHeader( someQnameOfTheSoapHeader );
> 
> but header is null!
> 
> Any pointers?
> 
> --
> David J. M. Karlsen - http://www.linkedin.com/in/davidkarlsen


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