WebClient makes it possible to perform reactive non-blocking HTTP requests in Spring applications. Use this tag for any questions involving its usage.
Questions tagged [spring-webclient]
992 questions
0
votes
1 answer
Spring boot webclient calling api which returns XML response having 2GB best way to call
I am calling a api which returns xm response , but that response has around 2GB data , could you please help how should we call that in efficient way , now its failing to databuffer limit exceeds
below is the XML dto class
@XmlRootElement(name…

Pandit Biradar
- 1,777
- 3
- 20
- 35
0
votes
1 answer
How to process Webclient response to HttpServletResponse?
We are moving our code from RestTemplate to WebClient to achieve non-blocking call and we are almost done it. But, after moving our code to WebClient we facing issue as when client makes call to our API, we are responding with blank response.…

cool_ravi
- 165
- 1
- 9
0
votes
0 answers
How to download large file using WebClient Spring?
I am working with Spring WebClient and need to download list of files from API.
class Document {
private String content;
private String fileName;
}
Following is the structure of single document and I need to fetch list of documents.
So now…

keepmoving
- 1,813
- 8
- 34
- 74
0
votes
1 answer
How to allow param with curly braces in Url when using WebClient?
I am getting IllegalArgumentException
"Not enough variable values available to expand 'email'" when calling an endpoint with curly braces in the url. I don't want to encode it since the endpoint is throwing 500 after the url is ecoded.
@Override
…

Nan
- 141
- 1
- 2
- 8
0
votes
0 answers
WebClient returns Null in Spring Webflux Project Reactor
Still relatively new to WebFlux. Liking it, but it can be hard to debug and every once in a while you get a result you weren't expecting. But hey, that's half the fun.
A problem I have run into relatively recently is Figuring out what to do if you…

SoftwareSavant
- 9,467
- 27
- 121
- 195
0
votes
2 answers
Handle Spring WebFlux WebClient timeout in Kotlin
I am doing a get http call with Spring WebFlux WebClient (Boot 2.4.3) in Kotlin (1.4.30). When request times out it fails with exception but instead I'd like to return a default value. I see references to onError, onStatus etc. used after retrieve()…

Sergei G
- 1,550
- 3
- 24
- 44
0
votes
1 answer
Webclient Error Handling - Spring Webflux
I want to throw my custom exceptions with the following conditions:
If I am getting proper error response in json format, I want to deserialize it and throw my exception named CommonException inside onStatus()
If I am receiving an HTML content as…

Harsh Kanakhara
- 909
- 4
- 13
- 38
0
votes
1 answer
Maven WebClient dependency errors (in Docker container)
I'm getting an error when I try to connect to a REST service using WebClient in Java Spring inside a Docker container. I was wondering if anyone can tell me what the problem is?
Runtime Error: java.lang.NoClassDefFoundError:…

Peter Dongan
- 1,762
- 12
- 17
0
votes
1 answer
How to send java.security.Principal with a webclient request
There is a rest api secured using keycloak(OAUTH) as below:
@PreAuthorize("hasRole('user')")
@GetMapping(value = "/employees", produces = { MediaType.APPLICATION_JSON_VALUE })
public ResponseEntity
- > findAll(java.security.Principal…

Rohit Singh
- 145
- 1
- 2
- 7
0
votes
1 answer
how to build java Pojo for Json in springboot
I have following Json and want to map this json as java pojo using spring webclient mono response.
in this json keys data-1 and en are not constants and keep changing. for example it could be data-2 and fr or data-3 and it.
{
"data": {
…

keepmoving
- 1,813
- 8
- 34
- 74
0
votes
1 answer
Downloading file using Spring Webclient and AsynchronousFileChannel, file is empty
I want to download a few photos by URL using Webflux and AsynchronousFileChannel, and all files are created but empty.
Here is my code:
public void downloadFilesFromUrl() throws IOException {
List notDownloadedFiles = //get photos with…

izzager
- 11
- 5
0
votes
2 answers
How to stress test Reactive Web APIs?
We have migrated/refactored one of our micro-service from request per thread model (sync) to Reactive (async). Development is complete and started stress testing the reactive service. We are looking for the help on how to perform the activity for…

Anoop Deshpande
- 514
- 1
- 6
- 23
0
votes
1 answer
Bad Request when sending a WebClient request from a microservice to another microservice
So I have 5 microservices running on different ports. I have a service called the movie-catalogue-service
and I try to retrieve ratings from Movies by id which are passed via request parameters.
I have a discovery server running aswell, which works…

Yasin Eraslan
- 171
- 2
- 13
0
votes
1 answer
Getting some httpHeader in spring webclient call
In my spring boot 2.4.1 application, I'm using WebClient for invoking some external rest services.
In reqular scenario it's pretty straightforward and works fine as I expected:
InquiryChequeResponse response=webClient.post()
…

Mostafa
- 3,002
- 10
- 52
- 79
0
votes
1 answer
How to use Flux to write Json Pojo to a CSV
The following function will retrieve a List of String. During the merge process, rather then print the output I would like to write the output to a CSV file.
List> list1 = page.get().map(device -> webClient.post()
…

angus
- 3,210
- 10
- 41
- 71