I designed a webservice to perform a task if request parameters are OK, or return 401 Unauthorized HTTP status code if request parameters are wrong or empty.
Since Spring 4.3, There is a RestClientResponseException which contain actual HTTP response data, such as status code, response body and headers. And you can catch it.