Spring RestTemplate gives “500” error but same URL, credentails works in RestClient and Curl

后端 未结 7 1777
眼角桃花
眼角桃花 2020-12-30 03:06

An Url, Credentials works in RestClient UI as well as with Curl where as i\'m getting \"500\" error when access the same via Spring RestTemplate.

I am using the foll

7条回答
  •  伪装坚强ぢ
    2020-12-30 03:18

    Though its too late to answer, below solution will help someone if above solutions did not work. For me, the error was with Request object and its header. Your request object should generate JSON as required by api. It should not have any extra field or additional getter method. In my case, I had additional getter method which was adding unnecessary field to request

    postForEntity = restTemplate.postForEntity(uri,entity,String.class);
    

提交回复
热议问题