camel-users mailing list archives

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

Hi,

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
used---BEGIN----------------------------------------
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) iter.next().getObject();
			System.out.println("Header namespace = " + header.getNamespaceURI());
			headerName = header.getFirstChild().getNodeValue();
			System.out.println("Header name = " + headerName);
		}		
----------------------------code I
used---END----------------------------------------------

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="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:b="http://docs.oasis-open.org/wsn/b-2"
xmlns:rim="urn:oasis:names:tc:ebxml-regrep:xsd:rim:3.0"
xmlns:add="http://www.w3.org/2005/08/addressing">
 <soapenv:Header>
<add:Action>http://docs.oasis-open.org/wsn/bw-2/NotificationProducer/SubscribeRequest</add:Action>
<add:MessageID>382dcdc7-8e84-9fdc-8443-48fd83bca938</add:MessageID>
</soapenv:Header>
   <soapenv:Body>
      <b:Subscribe>
.
.
.
.
.
</b:Subscribe>
   </soapenv:Body>
</soapenv:Envelope>

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 !
Kavita



-- 
View this message in context: http://www.nabble.com/How-to-get-SOAP-Headers-with-dataFormat%3DPOJO-%28camel-1.6%29-tp24530506p24530506.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Mime
View raw message