How can I handle exceptions in an http outbound gateway? When i receive status code 500 or 400..., an exception is shown. So What should I do to handle http error using spr
I had occurred the same problem.I threw my own customized Exception and error message but always got "500 Internal server error".It's because there will be no reply message and "reply" is timeout when throw Exception.So I handle the exception by subscribing error-channel and then reply by myself.
Message> failedMessage = exception.getFailedMessage();
Object replyChannel = new MessageHeaderAccessor(failedMessage).getReplyChannel();
if (replyChannel != null) {
((MessageChannel) replyChannel).send(MessageFactory.createDataExchangeFailMessage(exception));
}