post 请求的响应为空

response from post request is empty

我从 post 人那里收到以下 WS i 请求,其中包含以下参数:

我从 postman console

得到以下信息

我正在尝试使用以下代码请求 WS:

logger.info("generating new token from "+URL);
expritation = new Date();
        
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
MultiValueMap<String, String> map= new LinkedMultiValueMap<>();
map.add("userUid", userUid);
map.add("appUid", appUid);
map.add("ttl", ttl);
restTemplate.getInterceptors().add(new BasicAuthorizationInterceptor(WsLogin, WsPassword));
ResponseEntity<String> response = restTemplate.postForEntity(URL, map , String.class);
return response.getBody();

我可以在 postman 中看到响应正文,但是 response.getBody() 在 java 代码中是空的。

谁能给我解释一下为什么会这样。

您的意思是您在 Postman 中看到了响应主体,但在您的程序中却看不到?您是否尝试在从方法返回之前调试或打印响应值?