Hi Christoph, yes I programmed a jUnit Test. Currently my route lokks like that:
<camelContext xmlns="http://camel.apache.org/schema/spring"> <dataFormats> <soapjaxb contextPath="de.iccs.xapi.customer.v1"/> </dataFormats> <camel:route id="CustomerServiceUpdateCustomerTest"> <camel:from uri="seda:iccsUpdateCustomerRequest"/> <setHeader headerName="operationName"> <constant>updateCustomer</constant> </setHeader> <process ref="setSimpleAuthHeader"/> <to uri="cxf:bean:ICCSCustomerService"/> <process ref="printResponse"/> </camel:route> </camelContext> The setSimpleAuthHeader processor looks like that: public class setSimpleAuthHeader implements Processor { @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=\"yyy\" xmlns=\"http://xsoap.iccs.de/v1\"</name></outofbandHeader>"; SoapHeader newHeader = new SoapHeader(new QName("simpleAuthHeader"), 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); } } I changed excange.getIn() to excange.getOut() but I still have a npe. Do you have an idea what's wrong? Thanks Gabriel Christoph Emmersberger wrote > Hi Gabriel, > > first of all a general question, have you tried to debug a unit test to > solve your issue? > > As far as I can see by now you are looking into the exchange.getOut() > message. Have you tried looking into your exchange.getIn() message? This > might resolve your NPE issue. > > One more thing to check is the way you're sending messages. Are you > workung with POJO, PAYLOAD or MESSAGE mode. All three types have different > way's to handle SoapHeaders, see also: > POJO mode: > http://camel.apache.org/cxf.html#CXF-HowtogetandsetSOAPheadersinPOJOmode > PAYLOAD mode: > http://camel.apache.org/cxf.html#CXF-HowtogetandsetSOAPheadersinPAYLOADmode > MESSAGE mode: > http://camel.apache.org/cxf.html#CXF-SOAPheadersarenotavailableinMESSAGEmode > Basically the idea of accessing the headers seems to be right. > > Cheers, > > - Christoph > > > On Jan 24, 2013, at 1:03 PM, Gabriel wrote: > >> ace like SoapHeaderProcessor? >> I tried to do it with an normal processor (see my question at >> http://stackoverflow.com/questions/14497253/setting-custom-soap-header-to-pojo-message-in-camel-cxf >> <http://stackoverflow.com/questions/14497253/setting-custom-soap-header-to-pojo-message-in-camel-cxf> >> >> ) -- View this message in context: http://camel.465427.n5.nabble.com/add-custom-soap-header-tp5726077p5726161.html Sent from the Camel - Users mailing list archive at Nabble.com.
