Hi, I want to add a custom SOAP-Header to a pojo message. For that I configured the following route:
<route id="CustomerServiceUpdateCustomerTest"> <camel:from uri="direct:iccsUpdateCustomerRequest"/> <camel:process ref="addCredentials"/> <to uri="cxf:bean:ICCSCustomerService"/> </route> The Header should be inserted by the processor witch looks like that: @Override public void process(Exchange exchange) throws Exception { List<SoapHeader> soapHeaders = CastUtils.cast((List<?)exchange.getOut().getHeader(Header.HEADER_LIST)); // Insert a new header String xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?><outofbandHeader " + "xmlns=\"http://cxf.apache.org/outofband/Header\" hdrAttribute=\"testHdrAttribute\" " + "xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" soap:mustUnderstand=\"1\">" + "<name>simpleAuth username=\"xxx\" password=\"abc\" xmlns=\"http://xsoap.iccs.de/v1\"</name></outofbandHeader>"; SoapHeader newHeader = new SoapHeader(new QName("http://xsoap.iccs.de/v1", "simpleAuth"), DOMUtils.readXml(new StringReader(xml)).getDocumentElement()); // make sure direction is OUT since it is a response message. newHeader.setDirection(Direction.DIRECTION_OUT); //newHeader.setMustUnderstand(false); soapHeaders.add(newHeader); } CastUtils.cast((List<?)exchange.getOut().getHeader(Header.HEADER_LIST)); throws a npe. This should be the correct way to insert an custom Soap-Header. What's wrong? Can someone help me which that? Thanks Gabriel -- View this message in context: http://camel.465427.n5.nabble.com/insert-custom-Soap-Header-problem-tp5726415.html Sent from the Camel - Users mailing list archive at Nabble.com.