How to get and set SOAP headers in PAYLOAD mode - 6.3

Talend ESB Mediation Developer Guide

Talend Data Fabric
Talend Data Services Platform
Talend ESB
Talend MDM Platform
Talend Open Studio for ESB
Talend Real-Time Big Data Platform
Design and Development
Talend ESB

We've already shown how to access SOAP message (CxfPayload object) in PAYLOAD mode (See "How to deal with the message for a camel-cxf endpoint in PAYLOAD data format").

In 2.x Once you obtain a CxfPayload object, you can invoke the CxfPayload.getHeaders() method that returns a List of DOM Elements (SOAP headers).

from(getRouterEndpointURI()).process(new Processor() {
   public void process(Exchange exchange) throws Exception {
      CxfPayload<SoapHeader> payload = 
      List<Element> elements = payload.getBody();
      assertNotNull("We should get the elements here", elements);
      assertEquals("Get the wrong elements size", 1, elements.size());
      assertEquals("Get the wrong namespace URI", 
      List<SoapHeader> headers = payload.getHeaders();
      assertNotNull("We should get the headers here", headers);
      assertEquals("Get the wrong headers size", headers.size(), 1);
      assertEquals("Get the wrong namespace URI",