Questions tagged [spring-resttemplate]
204 questions
0
votes
1 answer
RestTemplate fetch nested json from response
I need to consume a REST endpoint using spring RestTemplate. Below is the sample response from the endpoint and I need to fetch nested employee json and map it to model object. I found various complex solutions like
Deserializing response to a…

user3469197
- 61
- 5
0
votes
1 answer
Not able to add response headers to RestTemplate streaming response
In my spring-boot application, I have a GET end-point. When we call this GET endpoint, the application is sending a GET request to another service with RestTemplate and returns the same response file as the response of the GET request. With the…

Manoj Lakshan
- 107
- 1
- 6
0
votes
0 answers
Springboot service which working on docker container does not respond after 15 minutes
I have 2 springboot services a-service and b-service. They are communicating with eachother. And theese services working on docker different containers. When i send request from a-service to b-service if request time more than 15 minutes a-service…

Atalay AKILLI
- 13
- 1
0
votes
2 answers
How to call GET api with query params having special chars{&,(,),'} using spring rest template
Below was the code used to encode uri having query params using UriComponentsBuilder
String uri = "http://hostname/api/items"
// api expected with params --> http://hostname/api/items?filter=IN('123') and id eq…

Abhinav manthri
- 151
- 1
- 14
0
votes
1 answer
No serializer found for class sun.nio.ch.ChannelInputStream and no properties discovered to create BeanSerializer
I am trying to upload a file as xlsx to a document.
@Autowired
HttpHeaders headers;
headers.setContentType(MediaType.MULTIPART_FORM_DATA);
MultiValueMap body = new LinkedMultiValueMap

Nidheesh
- 4,390
- 29
- 87
- 150
0
votes
0 answers
SpringBoot Downstream API Post Request
I am trying to pass an HTML form through a downstream API using Springboot and Thymeleaf but the response I am getting is:
org.springframework.web.client.HttpClientErrorException$BadRequest: 400 :…

autoboss
- 11
- 3
0
votes
0 answers
RestTemplate exchange - getting empty response body incase of 403 error
I have 2 spring boot applications with Rest APIs and I'm running it locally for testing. I'm using Rest Template to connect from one service to the second service and getting the response data and processing based on the response.
Spring security is…

iCode
- 8,892
- 21
- 57
- 91
0
votes
2 answers
Migrating from Jersey client to RestTemplate, but it catch 401 error as HttpClientErrorException but Jersey client was not throwing this error why?
In my Service there was Jersey client implementation to call a rest API now I was migrating this code to RestTemplate.
In old code when there was a 401 error that comes as a response from the backend and I store the response in an object.
But when I…

Nalin Kumar
- 7
- 4
0
votes
0 answers
org.springframework.web.client.HttpClientErrorException$Unauthorized: 401 Unauthorized: error on consuming api using RestTemplate
Getting below error on consuming api using Rest Template
here is the method i implemented
@GetMapping("/testapi1")
public String testapiq(UriComponentsBuilder builder) {
String uri = "http://xxxxx/api/TestCases/4";
RestTemplate…

Rakesh
- 21
- 2
0
votes
0 answers
HTTP POST is not working with Webclient but working with RestTemplate
I am getting Error while making POST calls with webclient as below
org.springframework.web.reactive.function.client.WebClientRequestException: An existing connection was forcibly closed by the remote host; nested exception is java.io.IOException: An…

NRaj
- 121
- 8
0
votes
0 answers
Spring Retry, RestTemplate, and client.ribbon.MaxAutoRetriesNextServer
I'm using Spring Boot 2.3.3 along with Spring Retry 1.2.5.
We're replacing usages of Ribbon with Spring Cloud Load Balancer. One of the bits of functionality that I can't get to work is setting the max retries of our RestTemplates. In the old code…

CoffeeCupDeveloper
- 31
- 3
0
votes
0 answers
RestTemplate Json annotations not working
I'm trying to deserialize a json with the following structure
{
header: {
type: "esummary",
version: "0.3"
},
result: {
22807455: {
uid: "22807455",
pubdate: "2012 Jul",
…

ypriverol
- 585
- 2
- 8
- 28
0
votes
1 answer
Creating folder on Office 365 using Java Spring boot
I want to create a folder inside an item on office 365 sharepoint using Java.
The request to be hit is:
https://graph.microsoft.com/v1.0/drives/{drive-id}/items/{item-id}/children
And the body of the request is to be:
{
"name": "Folder Name",
…

Sagnik Chatterjee
- 117
- 5
0
votes
1 answer
deserializing tricky XML to POJO using Jackson
Java 8, Spring 5.x
Given
ResponseEntity

code_warrior
- 77
- 10
0
votes
1 answer
Spring 5: use RestTemplate to POST multiple files with POJO; MediaType.MULTIPART_FORM_DATA with LinkedMultiValueMap
Versions:
Java 11
Spring 5.3.9
Jackson 2.13
org.apache.httpcomponents:httpclient: 4.5.13
I believe the issue here is that out-of-the-box, RestTemplate cannot deal with an HttpEntity for which the value is itself a MultiValueMap with (String,…

Kode Charlie
- 1,297
- 16
- 32