camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Frankiboy <mail.to.fra...@gmail.com>
Subject How to setHeader reponse code ?
Date Mon, 09 Mar 2015 09:54:39 GMT
 When my endpoint is down, i want to create a soap fault, and set the reponse
code to 504.

 What you cant see,  is that on the endpoint have a:
"?throwExceptionOnFailure=false" 
 

 My Route:

 from("direct:channel2").onException(Exception.class).handled(true).
                process(new
LogError(HubConstants.CHANNEL2.getValue())).end()
                .recipientList()
                .method(Util.class, "getEndpoint");


 When the endpoint is down, i come into my exception.class, where i have
this code:

   	exchange.removeProperty(Exchange.EXCEPTION_CAUGHT);
      
        exchange.getOut().setHeader(Exchange.HTTP_RESPONSE_CODE, 504);
        exchange.getOut().setFault(true);
        SoapFault sf = new SoapFault("Central svarer ikke hos " + central, 
SoapFault.FAULT_CODE_SERVER);
    

The client get the soap fault , but the reponse code is 500, and NOT 504...

Can anyone tell me whats wrong here ?

Frank 




--
View this message in context: http://camel.465427.n5.nabble.com/How-to-setHeader-reponse-code-tp5763820.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message