camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Willem Jiang <willem.ji...@gmail.com>
Subject Re: camel-cxf Soap-Fault not returned as 500 http error code
Date Wed, 11 Feb 2009 15:27:10 GMT
Hi Marc,

I did a quick fix for the CAMEL-1330 on camel 1.x branch and it will be
be a part of the coming up camel 1.6.
Since we refactored the camel-cxf module in camel trunk, so the trunk
code is ok for the CAMEL-1330.

Willem

Willem Jiang wrote:
> Hi Marc,
> 
> I just fill a JIRA[1] for it, and will look into it tomorrow.
> 
> [1]https://issues.apache.org/activemq/browse/CAMEL-1330
> 
> Willem
> 
> On Tue, Feb 10, 2009 at 6:36 PM, Marc Giger <gigerstyle@gmx.ch> wrote:
> 
>     Hi,
> 
>     I have (again) the problem that a soap-fault is not returned as 500
>     code.
> 
>     This worked fine with camel-cxf 1.3 but not with camel-cxf 1.5. The
>     reason
>     seems to be that the cxf response-context is not (correctly?)
>     propagated back.
> 
>     In 1.3 we had the following code to propagate the responseContext
>     back to the caller:
> 
>     CxfProducer line 252:
> 
>     248: Object result = cxfClient.dispatch(params, context, ex);
>     249: ex.setOutMessage(response);
>     250: invokingContext.setResponseContent(response, result);
>     251: // copy the response context to the response
>     252: response.putAll(responseContext);
>     253: cxfBinding.storeCxfResponse(exchange, response);
> 
>     This has changed in 1.5 to
> 
>     Object result = cxfClient.dispatch(params, context, ex);
>     ex.setOutMessage(response);
>     invokingContext.setResponseContent(response, result);
>     // copy the response context to the response
>     CxfBinding.storeCXfResponseContext(response, responseContext);
>     CxfBinding.storeCxfResponse(endpoint.getHeaderFilterStrategy(),
>     exchange, response);
> 
>     Which stores the responseContext itself as a new property in the
>     message.
> 
>     Later in the chain, AbstractHttpDestination searches a RESPONSE_CODE
>     in the message:
> 
>     Integer i = (Integer)outMessage.get(Message.RESPONSE_CODE);
>                if (i != null) {
>                    int status = i.intValue();
>                    if (HttpURLConnection.HTTP_INTERNAL_ERROR == i) {
>                        Map<Object, Object> pHeaders =
>                          
>      CastUtils.cast((Map)outMessage.get(Message.PROTOCOL_HEADERS));
>                        if (null != pHeaders &&
>     pHeaders.containsKey(PROTOCOL_HEADERS_CONTENT_TYPE)) {
>                            pHeaders.remove(PROTOCOL_HEADERS_CONTENT_TYPE);
>                        }
>                    }
>                    response.setStatus(status);
>                } else {
>                    response.setStatus(HttpURLConnection.HTTP_OK);
>                }
> 
>     which it doesn't find because the RESPONSE_CODE is stored in the
>     ResponseContext which is again a HashMap.
>     In this case the access to the RESPONSE_CODE would be:
> 
>     ((HashMap)outMessage.get("ResonseContext")).get(Message.RESPONSE_CODE)
> 
>     which can't be the correct solution of course.
> 
>     So, what do I have to do to get my 500 back?:-)
> 
>     Thanks & Greets
> 
>     Marc
> 
> 
> 
> 


Mime
View raw message