I have written a Rest client using the Spring's RestTemplate with the following code try { response = restTemplate.exchange( url,HttpMethod.POST, entity , JsonNode.class); }catch (HttpStatusCodeException codeException) { String responseBody = codeException.getResponseBodyAsString(); ...................... } catch(Exception ex) { ex.printStackTrace(); ObjectMapper mapper = new ObjectMapper(); JsonNode node = mapper.readTree(" { \"error\" : \"" + ex.getMessage() + "\" }" ); response = new ResponseEntity<>(node, HttpStatus.INTERNAL_SERVER_ERROR ); } In the above code, I am not able to read the response body. This is the issue with the ...
Blog about programming