All Questions
Tagged with rest-client spring
45 questions
1
vote
0
answers
23
views
How can i read the body even a IOException or ResourceAccessException occcur in Spring RestClient?
I am using RestClient (not Template!) to send a request to another server. Because of a missing header i get a 400 Error but can not read the body. When i make the request with postman i get a body &...
0
votes
1
answer
87
views
Spring RestCleint.RequestBodyUriSpec body mocking returns null
Mocking RestClient.RequestBodyUriSpec body. Mocking returns null when used in RestClient web service.
Test case as below -
package org.mytest.tests;
import org.junit.jupiter.api.Test;
import org....
0
votes
1
answer
363
views
Spring 6.1 RestClient JUnit Mock Test
I have a Spring 6.1 RestClient:
@Service
@RequiredArgsConstructor
public class ProductServiceClient {
@Value("${spring.client.product.url}")
private final String baseUrl;
private ...
1
vote
1
answer
1k
views
How to log Spring Boot 3 httpRestClient error response.body as readable string?
Prior to asking this, I am already tried using:
log.error("fail {} ", ex.getResponseBodyAsString());
I am already attaching .defaultStatusHandler() on the restClient. which is not really ...
0
votes
1
answer
717
views
Using RestClient, i don't know how implement proxy, need to declare the port and host
I want to implement proxy in host and port,
i tryed increment in to url but give errors
i used
spring.cloud.bootstrap.proxy.host=proxy1.lan.bnm.md
spring.cloud.bootstrap.proxy.port=8080
but its not ...
0
votes
1
answer
632
views
How to decompress gzip response body using Spring RestClient?
The oficial docs don't mention how to configure RestClient to decompress a gzip response. By default it doesn't seem to decompress it like WebClient does.
1
vote
0
answers
284
views
How to upload all files of a directory using java spring
i have files in a directory and i want to upload all these files in client side into folder in server side. here is my controller:
private static ArrayList<String> listFilesforFolder(final File ...
0
votes
0
answers
411
views
Spring Test with @RestClientTest and @FeignAutoConfiguration not working
I have the following configuration:
@SpringBootApplication
@EnableFeignClients
public class Application {
@FeignClient(name = "theclient")
public interface TheClient {
...
theclient:
...
1
vote
0
answers
317
views
com.atlassian.jira.rest.client.api.RestClientException: org.codehaus.jettison.json.JSONException: JSONObject["self"] not found
I'm getting following error -
com.atlassian.jira.rest.client.api.RestClientException: org.codehaus.jettison.json.JSONException: JSONObject["self"] not found.
[ERROR] 2020-12-03 17:31:58.387 ...
4
votes
1
answer
5k
views
How to use Spring WebClient to make synchronous call?
Spring Framework in RestTemplate documentation has note:
NOTE: As of 5.0 this class is in maintenance mode, with only minor
requests for changes and bugs to be accepted going forward. Please,
...
0
votes
0
answers
278
views
BadPaddingException when decrypting JSON data with encrypted values
I have a third party API where I have to send data in JSON in encrypted form. The data in JSON looks like this:
{
"encryptedKey": "rltP+oNBMx26wSpmvKZ91iL=",
"...
1
vote
1
answer
3k
views
How to extract Query Parameters from request in Spring RestController method?
URL: /api/v1/user ? type=abc & company=xyz
In an API call, we can extract the query param by using @QueryParam annotation. But, we have to define the query parameter key for mapping.
@QueryParam(&...
3
votes
2
answers
4k
views
Uploading excel file using rest client to a rest service leads to 400 Bad request
I have a rest service which is used to upload excel file It works fine from the UI, but I am trying to upload problematically using RestClient its giving 400 Bad request
@RequestMapping(value="/{pb}/...
4
votes
0
answers
1k
views
reactor.netty.http.client.PrematureCloseException: Connection prematurely closed DURING response
I have spring reactive a micro-service which call another micro-service to get list of products, but it keep failing with the error
reactor.netty.http.client.PrematureCloseException: Connection ...
0
votes
1
answer
854
views
Multiple Mono and common subscriber
I am a newbie to reactive programming in Java. I plan to use spring-webclient instead of restclient as the latter is being decommissioned. I have a situation when I make several http post requests to ...
0
votes
1
answer
5k
views
Unirest Java Client : kong.unirest.UnirestException: org.apache.http.client.ClientProtocolException
I am using Unirest Java client which I am using like below to connect to external API:
public static String loginAsAdmin(String authenticationURL , String userName , String password){
Map<...
0
votes
2
answers
4k
views
Error in org.springframework.web.client.RestClientException: No HttpMessageConverter for java.util.HashMap
I'm getting the following error in org.springframework.web.client.RestClientException: No HttpMessageConverter for java.util.HashMapwhen using rest template. Does anyone have any idea whats wrong?
...
0
votes
2
answers
2k
views
Trying to mock restClient external API but it is invoking the actual API in java
I am trying to mock restClient external API but it is invoking the actual API instead of mocking it.
Kindly help as I am not sure where I am going wrong.
I tried mocking the call and a few more other ...
28
votes
1
answer
12k
views
Getting "400 This page expects a form submission" when making a rest call to trigger a Jenkins Job
I need to trigger a Jenkins Job from my Java code.The Jenkins API expects a application/x-www-form-urlencoded Content-Type and I am able to trigger the job (using Basic AUTH) from Postman Rest Client....
0
votes
0
answers
788
views
RESTAPI to read image and convert into BLOB
I have a rest api service which will return image as response.
Below my code
@RequestMapping(value = "/sid/{id}", method = RequestMethod.GET,
produces = MediaType.IMAGE_JPEG_VALUE)
public ...
0
votes
1
answer
255
views
Spring autowired Variable is not available for usage
Am new to spring and spring boot. I was actually trying to a restclient in springboot. When i write the client and get the response, i wanted to read the response body which is String and wanted to ...
0
votes
0
answers
43
views
unable to mock ResponseEntity for rest client
I am trying to mock rest client for junit test. here is my rest client line of code
ResponseEntity<MyClass[]> responseEntity = restTemplate.postForEntity(myurl, input, MyClass[].class);
On my ...
1
vote
0
answers
934
views
How to make asyncRestemplate to make fire and forget call?
I am trying to make rest call , in which I don't want response.
AsyncRestTemplate asycTemp = new AsyncRestTemplate();
ListenableFuture<ResponseEntity<String>> future = ...
0
votes
1
answer
3k
views
SpringBoot Elastisearch RestHighLevelClient Java Search-API
I'm following this Tutorial and everything works fine.
Except I wan to add some extra search functionalities.
I have the following document is my Elasticsearch 6.1 index:
{
"author": "georges",
...
1
vote
1
answer
6k
views
Get value from response body in RestClient
I am using Rest client of Firefox. I want to get value from response that is showing on Response body(Raw) in Rest-Client. I want to get this value in SpringBoot. Is it possible? If yes then How?
I ...
0
votes
1
answer
120
views
REST Client: java backend consumer vs java script consumer
I want to generate webApp in java and just use some REST service. I think there are two approach for this:
1- Client side consumer: With an simple app that contain some java script file which call ...
4
votes
2
answers
11k
views
Return Value from async rest template spring
I am creating a async rest call using spring
@GetMapping(path = "/testingAsync")
public String value() throws ExecutionException, InterruptedException, TimeoutException {
AsyncRestTemplate ...
0
votes
1
answer
271
views
int-http:outbound-gateway HttpMessageNotReadableException
We have used int-http:outbound-gateway
<int-http:outbound-gateway request-channel="userDataRequest"
id="outboundUserDetailsGateway" url-expression="url"
...
12
votes
2
answers
47k
views
How to cache REST API response in java
I am building an app in java.I hit api more than 15000 times in loop and get the response ( response is static only )
Example
**
username in for loop
GET api.someapi/username
processing
...
0
votes
1
answer
1k
views
On hitting Rest service getting Error - Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header
I am trying to hit the rest service through Angular $http service, I am getting error like
XMLHttpRequest cannot load
http://localhost:3000/SpringSecurity/utn/accounts/all. Response to
preflight ...
1
vote
1
answer
4k
views
How to send HTTP OPTIONS request with body using Spring rest template?
I am trying to call a RESTfull web service resource, this resource is provided by a third party, the resource is exposed with OPTIONS http verb.
To integrate with the service, I should send a request ...
1
vote
5
answers
1k
views
Java server side annotated REST client library
I'm building a middleware service that consumes external REST services (from the server side). I'm currently using Spring boot with RestTemplate to make the remote calls.
Map<String, String>...
0
votes
0
answers
351
views
401 Unauthorized Web service Error
I have java spring framework web application running on JBoss clustered environment. In application user can generate few reports and will be able to view in UI itself. On click of generate report ...
2
votes
2
answers
7k
views
How to invoke Spring STOMP web socket method from rest client
My Java Code which intercepts all the calls with the URL /hello (Back) :
@Controller
public class GreetingController {
@MessageMapping("/hello")
@SendTo("/topic/greetings")
public ...
3
votes
1
answer
3k
views
getting BAD REQUEST in spring rest multipart image upload api
Here is a very dramatic situation for me, I don't what mistake supplying payload to rest client, because of which I am getting "400: BAD REQUEST" exception. Below is the code please help me solve it,
...
12
votes
2
answers
42k
views
Spring Rest Client Exception Handling
I am using spring RestTemplate to consume rest services(exposed in spring rest). I am able to consume success scenarios. But for negative scenarios, service returns error messages and error codes. I ...
0
votes
1
answer
767
views
How to recieve request.getParameter("eventdetails") in spring using rest client or postman?
I have following code :
@RequestMapping(value = "/createEventWS", method = RequestMethod.POST)
public @ResponseBody
Map<String, Object> createEventWS(HttpServletRequest request) {
request....
4
votes
3
answers
4k
views
Spring controller not accepting application/json
When I am passing application/json parameters from Chrome Rest Client,I am getting 400 bad request error.
When I add required=false for @RequestParam, the request is accepted by Controller but the ...
2
votes
1
answer
1k
views
Make Rest Client using Spring Rest Template
Here is my spring controller code..
@RequestMapping(value= "/save_item",
method = RequestMethod.POST,produces="application/json")
public @ResponseBody ModelMap saveItem(ModelMap model,
@RequestParam(...
5
votes
1
answer
16k
views
Handle Connection and Read Timeouts for RestClient calls in android
I have a RestService interface with many rest calls which I am using throughout my application.
I am setting timeouts for handling connection and read-timeouts
ClientHttpRequestFactory httpFactory =...
0
votes
1
answer
177
views
Using Grails for Web Service Client Project
I'm currently researching on Grails, if it would be a good choice to go with a Web Service client project. It is said Grails is highly beneficial for developing Admin Portals and Prototypes. However ...
8
votes
3
answers
25k
views
The request sent by the client was syntactically incorrect ().+Spring , RESTClient
I am working with Spring MVC using JSON objects. while I am tring to send JSON Object from RESTClient, I am getting
HTTP Status 400 - The request sent by the client was syntactically incorrect ().
...
0
votes
0
answers
743
views
What happens after limit of connections is reached in a Jetty HttpClient used in an Android app?
I have a client that constantly talks to a server via http using android-annotations's RestClient.
Every time the app is open for a long time and lots of requests have been made, new http requests ...
1
vote
1
answer
2k
views
Rest Client implementation for spring 3 application
I have a requirement to write java APIs for one of my spring 3 web application.I should be able to do all actions that I perform using my web UI, through these APIs as well.I have controller methods ...
2
votes
2
answers
479
views
How to consume terabytes of data using a Java RESTful client
Please could anyone point me in the right direction on how to design/build a web service client that will consume terabytes of data and perform some computation on the retrieved data?
I inherited a ...