New to camel.I have existing spring application which has soap endpoints. The
return type of soap endpoint is jdom Element.
When the processing of endpoint completes I am calling the camel processors
in routes - one for Acknowledgement and other for putting in JMS. 
Once its done returning me response as 202 which is correct but how to
override that to 200.

Tried in last processor i.e. when I put my message in JMS after that it will
end my camel route.Tried these things 1. Used getOut 2. Used getIn. 3.Used
after last processor in camel route.

1.  exchange.getOut.setHeader(Exchange.HTTP_RESPONSE_CODE,200)
    Response r = Response.status(200).entity("Created").build();
    exchange.getOut().setBody(r);

2. exchange.getIn.setHeader(Exchange.HTTP_RESPONSE_CODE,200)
    Response r = Response.status(200).entity("Created").build();
    exchange.getIn().setBody(r);
3. <camel:setHeader headerName =
"CamelHttpResponseCode"><constant>200</constant></camel:setHeader>

When I was debugging my code after completion of camel its checking for this 
 else if (exchange.getPattern().isOutCapable()) {
            Message responseMessage = exchange.getOut(Message.class);
            if (responseMessage != null) {
                Source responseBody = responseMessage.getBody(Source.class);
                WebServiceMessage response = messageContext.getResponse();


so tried to put the few more line of code in processor to fulfil above
request assuming my body will have Source Element.

Message msg = exchange.getIn();
exchange.setOut(msg)
exchange.getOut.setBody(exchange.getIn().getBody())

I need some pointer if someone already faced this issue. Appreciate your
help and time.



--
View this message in context: 
http://camel.465427.n5.nabble.com/Getting-HTTP-status-code-as-202-always-and-want-to-override-with-the-200-tp5763173.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to