I have an application that sends api calls to another application, with this code:
objreq.setCategoryMappingReq(categoryMappingReq);
HttpEntity<Request> entity = new HttpEntity<Request>(objreq, headers);
ResponseEntity<String> response = restTemplate.exchange(url, HttpMethod.POST, entity, String.class);
where headers contains application/json of course.
The problem is, is that the objreq is set correctly, however, when it calls the other api:
@PostMapping
public ResponseEntity<Response> insertRequest(
@RequestBody @Valid Request request) {
requestService.insertRequest(request);
return ResponseEntity.ok(new ResponseSuccess<>());
}
all the fields are null. This is really annoying as the fields are set correctly in the request, but in everything is null in the response.
Would to know why this is, unfortunately I don't have much experience with RestTemplate, so not sure if the issue is here. Many Thanks
Aucun commentaire:
Enregistrer un commentaire