问题描述
在SOAPUI中获取值存在错误消息,但是在spring restTemplate客户端代码中,我收到HttpClientErrorException:400 Bad Request。
RestTemplate restTemplate = new RestTemplate();
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
headers.set("Authorization",authHeader);
headers.set("Accept",MediaType.APPLICATION_JSON_VALUE);
httpentity<String> entity = new httpentity<>(requestJson,headers);
System.out.println("" + entity);
ResponseEntity<String> response=restTemplate.exchange(API_URL,HttpMethod.POST,entity,String.class);
但是,如果我在上面的代码中尝试了正确的请求,那么我会成功,如果再次尝试相同的请求,我实际上需要获取“ Value Already Exist”,但出现400错误
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)