camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gabriel <gabriel.wetz...@online.de>
Subject insert custom Soap Header problem
Date Mon, 28 Jan 2013 13:03:16 GMT
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
&quot; 
        + &quot;xmlns=\&quot;http://cxf.apache.org/outofband/Header\&quot;
hdrAttribute=\&quot;testHdrAttribute\&quot; &quot; 
        +
&quot;xmlns:soap=\&quot;http://schemas.xmlsoap.org/soap/envelope/\&quot;
soap:mustUnderstand=\&quot;1\&quot;>" 
        + "<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.

Mime
View raw message