cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cstreiff <>
Subject response message soap header reading problem
Date Tue, 25 May 2010 11:50:30 GMT


Adding a header to a soap message using the WebServiceContext is working
fine. However, reading the header using the reverse procedure fails.

CXF 2.2.7, OSX and GNU Linux

Problem Description:
1) I'm adding the Header:
 List<Header> headers = new ArrayList<Header>();        
        Header cidHeader;
        try {
            cidHeader = new Header(CORRELATION_ID_ELEMENT, cid, new
        } catch (JAXBException e) {
            throw new IllegalArgumentException("SOAP Header JAXB binding is
broken and needs to be fixed.", e);
        ctx.put(Header.HEADER_LIST, headers);  // WebServiceContext

2) and when I look at the service consumers logfile all seems to be OK. The
services response message contains the header:

2010-05-25 11:13:46,512 33093 INFO 
[org.apache.cxf.interceptor.LoggingInInterceptor] (btpool0-3:) Inbound
ID: 2evilcom
Response-Code: 200
Encoding: UTF-8
Content-Type: text/xml; charset=utf-8
Headers: {Content-Length=[403], Server=[Jetty(6.1.1rc1)],
content-type=[text/xml; charset=utf-8]}
Payload: <soap:Envelope

3) Now I'm trying to read the header and all I get is the (local) name of
the header element and a null value:

 public CommonSoapHeader(Map<String, Object> requestMessageContext,
Map<String, Object> responseMessageContext) {"responseMessageContext=" + responseMessageContext);
        List<Header> headers =
        if(headers == null) { throw new NullPointerException("Unexpected
error: message context should have returned a header list."); }
        for(Iterator<Header> i = headers.iterator(); i.hasNext();) {
            Header h =;
            Element n = (Element)h.getObject();
  "nv="+ n.getNodeValue());

	getLocalName() yields the expected element name 'correlationId', however
'getNodeValue()' always yields 'null'.

4) It seems that I'm making a mistake along the way. Why am I always getting
a null value for my header element? 
I would greatly appreciate a hint on where I went wrong.

View this message in context:
Sent from the cxf-user mailing list archive at

View raw message