Unable to send Pojo via RestTemplate PUT request.
I have a rest service which I need to call from other application. The service is :
@RequestMapping(value = RESET_USER_PASSWORD_URL, method = RequestMethod.PUT, produces = APP_JSON)
public SuccessResponse resetUserPassword(@RequestBody ResetPasswordDTO resetPasswordDTO) throws GenericException {
    logger.info("--->reset Password");
    return new SuccessResponse(userservice.resetUserPassword(resetPasswordDTO));
}
I am calling above service using RestTemplate, for this I need to send a POJO along with the PUT request. The code using RestTemplate is:
public ResponseEntity<SuccessResponse> resetUserPassword(ResetPasswordDTO resetPasswordDTO)
        throws ServiceGenericException {
    ResponseEntity<SuccessResponse> ssoUserResponse = null;
    HttpHeaders headers = new HttpHeaders();
    headers.setContentType(MediaType.APPLICATION_JSON);
    HttpEntity<ResetPasswordDTO> requestEntity = new HttpEntity<ResetPasswordDTO>(resetPasswordDTO,headers);
    ssoUserResponse = restTemplate.exchange("http://localhost:5858/api/unsecured/resetpassword", HttpMethod.PUT, requestEntity,
            SuccessResponse.class);
    return ssoUserResponse;
}
I am not able to make a call. I am getting below exception: org.springframework.web.client.HttpClientErrorException: 400 null.
The POJO I want to send:
public class ResetPasswordDTO implements Serializable {
private static final long serialVersionUID = -2372400429023166735L;
private String password;
private String activationCode;
}
 
     
    