Questions tagged [spring-resttemplate]

204 questions
0
votes
2 answers

Logging both ClientHttpRequestInterceptor and HttpServletRequest (or HandlerInterceptor)

I'm developing an API using Spring Boot 3.1.0 to crawl data, I called this localhost:8080/crawl. Inside this, I also use RestTemplate to call an external API called third-party.com/data. I want to track API calls both my URL and third-party…
0
votes
0 answers

Getting RestTemplate (Connection Reset) Despite everything is correct

I'm using Spring Boot RestTemplate to call REST API. On PROD, I'm getting below exception: org.springframework.web.client.ResourceAccessException: I/O error on POST request for "https:///v2/graphql": Connection reset; nested exception is…
0
votes
1 answer

Call to GraphQL Query with RestTemplate is giving either 400 or invalid syntax message

I have been experiencing a weird issue trying to call a GraphQL query using RestTemplate from the SpringBoot framework. I say it is weird because it is only happening with this particular query. This is the code I am using (because that is the…
Marcelo Tataje
  • 3,849
  • 1
  • 26
  • 51
0
votes
0 answers

RestTemplate throwing java.net.SocketTimeoutException:Read timed out - How can I resolve it?

2023-06-01 16:16:35,868 [Thread-6] INFO.... 2023-06-01 16:16:44,989 [Thread-6 ] ERROR.... Error:- "": Read timed out; nested exception is java.net.SocketTimeoutException: Read timed out Its not even waiting 600000 millisecond but…
0
votes
1 answer

Springboot 3 resttemplate unit test how to inject

My environment is Spring Boot 3.0.5: I need to implement Unit Test for a service method login() that use RestTemplate @ExtendWith(SpringExtension.class) @SpringBootTest(classes = PosteDeliveryClientImpl.class) public class…
PifTheWolf
  • 23
  • 5
0
votes
0 answers

Type definition error: [simple type, class java.io.FileDescriptor]; nested exception is com.fasterxml.jackson.databind.exc.InvalidDefinitionException

HttpHeaders fileHeaders = new HttpHeaders(); fileHeaders.setContentType(MediaType.MULTIPART_FORM_DATA); fileHeaders.set(API_ACCESS_KEY, apiAccessKey); fileHeaders.set(ACCESS_TOKEN, accessToken); // Create request body with…
0
votes
0 answers

Springboot RestTemplate taking time to read response from ELB

I am using SpringBoot RestTemplate to call one of the downstream HTTP get method. During the analysis phase we realized that the time difference between application receiving the response v/s ELB logs stating the response was sent is…
0
votes
0 answers

Unexpected Rest Call failures with Http Status 503

We have a Spring Scheduler that runs periodically every 2 hours to connect an internal URL and retrieves some data through Rest Template. ResponseEntity response = restTemplate.exchange(url, HttpMethod.GET, entity, String.class); The above…
Sabari
  • 127
  • 1
  • 13
0
votes
1 answer

nested list with RestTemplate exchange

java.lang.IllegalArgumentException: Cannot deserialize value of type .dto.Person from Array value (token JsonToken.START_ARRAY) at [Source: UNKNOWN; line: -1, column: -1] (through reference chain: java.util.HashMap[]) JSON { "scully": [ { …
jano
  • 1
0
votes
0 answers

Query parameter of type List of String in URL and SpringBoot RestTemplate

@GetMapping("/") public ResponseEntity getYoutubeResponse(){ String url = "https://youtube.googleapis.com/youtube/v3/playlists?part={part}&channelId={chanelId}&maxResults={maxResults}&key={key}"; Map qp_map=new…
0
votes
1 answer

Send Multipart form-data resttemplate?

I am trying to send the multipart-form data using resttemplate, but it is not working and seems data it is not reaching on server. public ResponseEntity postImage(URI postURL, String base64) { HttpHeaders headers = new HttpHeaders(); …
0
votes
0 answers

I am calling a rest service from a microservice in spring-boot.Want to handle REST Template Exception

I am new to microservices and stuck somewhere. Suppose my microservice M1 is getting some response from another microservice M2 using Rest Template. and whenever I hit the URL of M1 in postman it works fine if M2 is also working well as M2 is giving…
0
votes
1 answer

RestTemplate how remove utf8 from request?

hello i' ve the code from request a sistem but RestTemplate add always utf8 in header example POST /v1/documents/validation HTTP/1.1 Accept: application/json Content-Type:…
nikolas
  • 27
  • 1
0
votes
0 answers

tus-java-client + Cloudflare: ProtocolException: unexpected status code (400) while creating upload

I'm attempting to upload a video from a Java (Spring Boot) application to the Cloudflare servers by pulling the video using Spring's RestTemplate and then using the response InputStream to upload the content. To upload the video content…
lealceldeiro
  • 14,342
  • 6
  • 49
  • 80
0
votes
1 answer

Not able to deserialize nested JSON array Spring Resttemplate

I am not able to deserialize nested JSON array from response JSON using Spring Rest template. JSON response which I am consuming is as follows [ { "creationTime": "2023-01-13", "code": "456", "cid": "123", "priority": "CRITICAL", …
Pawan Patil
  • 1,067
  • 5
  • 20
  • 46