camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kav m <>
Subject How to get SOAP Headers with dataFormat=POJO (camel 1.6)
Date Fri, 17 Jul 2009 08:26:52 GMT


I am using camel 1.6 and have a cxf web service endpoint which receives a
SOAP request. I need to extract the SOAP Headers out of this request. I
tried to use the following code:

----------------------------code I
Map<String, Object> headers = arg0.getIn().getHeaders(); //1
System.out.println("MAP Headers size= " + headers.size()); //2
List<SoapHeader> soapHeaders = (List<SoapHeader>)
headers.get(Header.HEADER_LIST); //3
System.out.println("Headers size= " + soapHeaders.size()); //4

Element header;
String headerName;
Iterator<SoapHeader> iter = soapHeaders.iterator();
while (iter.hasNext()) {
			header = (Element);
			System.out.println("Header namespace = " + header.getNamespaceURI());
			headerName = header.getFirstChild().getNodeValue();
			System.out.println("Header name = " + headerName);
----------------------------code I

In the above code, Line no. 2 i.e. the Map headers has a size of 8 and
contains some key:value pairs like content-type:text/xml ,
operationName:Subscribe , which look like headers coming from the
annotations used by my service interface.I don't see the actual soapHeaders
present in my soap request.
Also, at Line No. 3, the List soapHeaders is showing as 'null' and thus, I'm
getting a null pointer at Line no. 4

My Soap Request :

<soapenv:Envelope xmlns:soapenv=""

What I am looking for is to extract the headers  'Action' and 'MessageID'
(using dataFormat=POJO)
Can someone pls help me achieve that ? 

Thanks a lot !

View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message