I did a little more testing and found that there seems to be a conflict in the 

When I add this to the XML it works:
<removeHeaders pattern="*”/>

I printed the headers, maybe that gives a clue.

{Accept=application/json, Accept-Encoding=gzip, deflate, Accept-Language=nl-nl, 
breadcrumbId=51099-1476544028839-0-2, CamelHttpCharacterEncoding=UTF-8, 
CamelHttpMethod=POST, CamelHttpPath=, CamelHttpQuery=null, 
CamelHttpServletRequest=Request(POST /custom_webapi/hello/world)@13b615ae, 
CamelHttpServletResponse=HTTP/1.1 200

, CamelHttpUri=/custom_webapi/hello/world, 
CamelServletContextPath=/custom_webapi/hello/world, Connection=keep-alive, 
Content-Length=3, Content-Type=application/json, Host=remco.local:8080, 

That would explain why in some cases it works, the request was already routed 
to another webserver, so the headers were already changed before the exception.


Met vriendelijke groet,

Remco Schoen

Op 14 okt. 2016, om 16:36 heeft Remco Schoen 
<r.sch...@topdesk.com<mailto:r.sch...@topdesk.com>> het volgende geschreven:


I’m trying to use the REST DSL and do validation on the incoming object with 
the Bean Validation Component.

I have configured my Spring XML like this:

 <setHeader headerName="Exchange.HTTP_RESPONSE_CODE">
   <simple>Validation error.\n\Message:\n${exception.message}</simple>

But when I use the Swagger UI to send a message to my endpoint, I get no body 
or HTTP response code. For other exceptions this approach works.

Should this work with this exception?

I’m using version 2.17.3

Kind regards,

Remco Schoen

Reply via email to