You can turn off the throw exception on failure with throwExceptionOnFailure=false
but that will apply to all error codes. Otherwise you can use camel error handler to handle the http exception when its status code 500. Camel in Action chapter 5, section 5.5 covers that On Tue, Oct 29, 2013 at 2:04 PM, PJ Walstroem <[email protected]> wrote: > hello, > we are using http4 with camel 2.12.1, posting soap to an external party. > However, the external party seems to exaggerate(?) the usage of REST and > return a status code 500 when our request is not supported. When using e.g. > postman in chrome, I can see that a response is given with the 500 which in > detail describes the error cause. This response seems to be discarded by the > http4-component, though. > > Any chance of handling that 500 status code without throwing the exception > as shown below? > > response given with 500 (but not seen in Camel stacktrace): > > <?xml version="1.0" ?> > <S:Envelope > xmlns:S="http://www.w3.org/2003/05/soap-envelope"> > <S:Body> > <S:Fault > xmlns:ns4="http://schemas.xmlsoap.org/soap/envelope/"> > <S:Code> > <S:Value>S:Receiver</S:Value> > </S:Code> > <S:Reason> > <S:Text xml:lang="en">Failed to process the > request.</S:Text> > </S:Reason> > <S:Detail>..... > </S:Detail> > </S:Fault> > </S:Body> > </S:Envelope> > > > > stacktrace: > > org.apache.camel.component.http4.HttpOperationFailedException: HTTP > operation failed invoking http://acme.com:80/xmlapi/shop/air/v2 with > statusCode: 500 > at > org.apache.camel.component.http4.HttpProducer.populateHttpOperationFailedException(HttpProducer.java:237) > ~[camel-http4-2.12.1.jar:2.12.1] > at > org.apache.camel.component.http4.HttpProducer.process(HttpProducer.java:165) > ~[camel-http4-2.12.1.jar:2.12.1] > at > org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61) > ~[camel-core-2.12.1.jar:2.12.1] > at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:110) > ~[camel-core-2.12.1.jar:2.12.1] > at > org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:72) > ~[camel-core-2.12.1.jar:2.12.1] > at > org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:398) > ~[camel-core-2.12.1.jar:2.12.1] > at > org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191) > ~[camel-core-2.12.1.jar:2.12.1] > at org.apache.camel.processor.Pipeline.process(Pipeline.java:118) > ~[camel-core-2.12.1.jar:2.12.1] > at org.apache.camel.processor.Pipeline.process(Pipeline.java:80) > ~[camel-core-2.12.1.jar:2.12.1] > at > org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191) > ~[camel-core-2.12.1.jar:2.12.1] > at > org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:105) > ~[camel-core-2.12.1.jar:2.12.1] > at > org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:87) > ~[camel-core-2.12.1.jar:2.12.1] > at > org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:103) > ~[camel-jms-2.12.1.jar:2.12.1] > at > org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:562) > ~[spring-jms-3.2.4.RELEASE.jar:3.2.4.RELEASE] > at > org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:500) > ~[spring-jms-3.2.4.RELEASE.jar:3.2.4.RELEASE] > at > org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:468) > ~[spring-jms-3.2.4.RELEASE.jar:3.2.4.RELEASE] > at > org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:325) > ~[spring-jms-3.2.4.RELEASE.jar:3.2.4.RELEASE] > at > org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:263) > ~[spring-jms-3.2.4.RELEASE.jar:3.2.4.RELEASE] > at > org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1103) > ~[spring-jms-3.2.4.RELEASE.jar:3.2.4.RELEASE] > at > org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1095) > ~[spring-jms-3.2.4.RELEASE.jar:3.2.4.RELEASE] > at > org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:992) > ~[spring-jms-3.2.4.RELEASE.jar:3.2.4.RELEASE] > at > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) > ~[na:1.7.0_25] > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) > ~[na:1.7.0_25] > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/HTTP-how-to-handle-status-code-500-tp5742353.html > Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen ----------------- Red Hat, Inc. Email: [email protected] Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen
