camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gabriel <>
Subject Re: add custom soap - header
Date Thu, 24 Jan 2013 13:32:49 GMT
Hi Christoph,
yes I programmed a jUnit Test. Currently my route lokks like that:

<camelContext xmlns="">
            <soapjaxb contextPath="de.iccs.xapi.customer.v1"/>

<camel:route  id="CustomerServiceUpdateCustomerTest">
            <camel:from uri="seda:iccsUpdateCustomerRequest"/>
            <setHeader headerName="operationName">
            <process ref="setSimpleAuthHeader"/>
            <to uri="cxf:bean:ICCSCustomerService"/> 
            <process ref="printResponse"/>

The setSimpleAuthHeader processor looks like that:

public class setSimpleAuthHeader implements Processor {

    public void process(Exchange exchange) throws Exception {
        List<SoapHeader> soapHeaders = CastUtils.cast((List<?>)

        // Insert a new header
        String xml = "<?xml version=\"1.0\"
encoding=\"utf-8\"?><outofbandHeader &quot;
hdrAttribute=\&quot;testHdrAttribute\&quot; &quot;
                + "<name>simpleAuth username=\"xxx\" password=\"yyy\"

        SoapHeader newHeader = new SoapHeader(new QName("simpleAuthHeader"),
DOMUtils.readXml(new StringReader(xml)).getDocumentElement());
        // make sure direction is OUT since it is a response message.

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:
> PAYLOAD mode:
> MESSAGE mode:
> 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  
>> &lt;;

>> )

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

View raw message