camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Narsi Nallamilli <>
Subject camel CxfRsProducer not returning appropriate error status codes
Date Wed, 16 Mar 2016 15:10:55 GMT
I have a cxf rest server calling cxf client and the the cxf rs
client(producer) calling another cxf rest server. If the second server
service return response status as 401 the client is converting it to 500 and
sending it to the first server service.

Please help me, the way I can pass back the status code received from second
server service back to first server service through the cxf client.

I could check the code and see the conversion of error in producer,

protected CxfOperationException populateCxfRsProducerException(Exchange
exchange, Response response, int responseCode) {
        CxfOperationException exception;
        String uri = exchange.getFromEndpoint().getEndpointUri();
        String statusText = statusTextFromResponseCode(responseCode);
        Map<String, String> headers = parseResponseHeaders(response,
        //Get the response detail string
        String copy =
        if (responseCode >= 300 && responseCode < 400) {
            String redirectLocation;
            if (response.getMetadata().getFirst("Location") != null) {
                redirectLocation =
                exception = new CxfOperationException(uri, responseCode,
statusText, redirectLocation, headers, copy);
            } else {
                //no redirect location
                exception = new CxfOperationException(uri, responseCode,
statusText, null, headers, copy);
        } else {
            //internal server error(error code 500)
            exception = new CxfOperationException(uri, responseCode,
statusText, null, headers, copy);

        return exception;

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

View raw message