Questions tagged [spring-resttemplate]

204 questions
0
votes
1 answer

Spring-Boot 2.3.0.RELEASE Unable to autowire RestTemplate for JUnit 5 test

I have configured the necessary Beans in @Configuration class but have not been able to get the RestTemplate injected into my test class for testing. @Configuration public class AppConfig { @Bean public ProtobufHttpMessageConverter…
-1
votes
2 answers

My spring boot is of Microservice architecture. Getting 500 Internal Server between microservice calls using rest template

My spring boot is of Microservice architecture. Getting 500 Internal Server error logged in calling microservice. Service A calls Service B with POST request. And Service B processed the request successfully and got 200 status code in Service B…
-1
votes
1 answer

Cannot invoke"org.springframework.web.client.RestTemplate.getForEntity(String, java.lang.Class, Object[])""this.restTemplate"null

i'm working on an tokenValidationInterceptor , where a request for token validation is send to an other micro-service which communicate with keycloak and send an ok status or unautorazed status , then i add some logic to the prehandle function and…
-1
votes
2 answers

How to handle a list of resources with ResponseEntity

I have an external REST API that returns a list of client objects as json. For example: GET externalapi.io/api/clients [ { "id" : "b15asgdc-6efd-4a2d-re08-2q3r3bae", "clientName" : "test1", ... }, { "id" :…
KJ0797
  • 187
  • 1
  • 2
  • 14
-1
votes
1 answer

spring resttemplate request object not mapping to rest controller

i have below resttempalte which invokes rest controller of another service.. @Override public ResponseEntity callRestAPI(APIReqDataMO apiReqDataMO) { String apiURL = URIGenerator.getAPIURL(apiReqDataMO); HttpHeaders headers = new…
pappu_kutty
  • 2,378
  • 8
  • 49
  • 93
-1
votes
1 answer

Spring RestTemplate to ping google

How can I use spring restTemplate in java for a GET request to google.com or any other website? I tried like below but didn't work. Got error while extracting response for type [class java lang.String] and content type [text/html;charset=utf-8] …
sheenaLal
  • 3
  • 1
  • 7
-1
votes
1 answer

How to Get particular value from restTemplate in springboot?

I have an api with given request body and response , now I have to call restTemplate for it and get particular response from it This is my requestBody -> {"ids":["MS8B50FHS"]} And this is my response -> { "status": 200, "success": true, …
-1
votes
1 answer

How to call rest API in the loop

I want to call the third party API multiple times using the RestTemplate(for each customer id I have to call REST API) currently I have written like below and its working fine but it's taking time because there are many customers I'd and calling API…
-1
votes
1 answer

How to write JUnit test for RestTemplate exchange method

How to write Mockito JUnit test for the following class ? Here is my code : /** * baseUrl */ @Value("${base.url}") private String baseUrl; /** * Client Method to get room by id * * @param id * @return roomModel */ public RoomModel…
RS0023
  • 45
  • 9
1 2 3
13
14