Page 1 of 1

httpResponse.getResponseBody() fails

PostPosted: Fri Jul 06, 2018 1:51 pm
by andre1506345542
Hi,
I have a function to retrieve data from another server and process the data. That works fine, except for one table.

If the amount of data is huge then getResponseBody() fails without error and my function stops. Even the try catch does not catch the error.
The executeRequest takes about 30 seconds.
The getStatusCode gives 200. But then it fails in getResponseBody().

On my local pc it works fine.
If I request my data in my browser I get about 25MB on data.

I use NG Client, Servoy 8.3.0

Thanks

Re: httpResponse.getResponseBody() fails

PostPosted: Fri Jul 06, 2018 3:03 pm
by mboegem
Can you try setting the timeout on the request a bit longer?

If that doesn't work, 25MB might be a bit too much. (personally I think it is too much anyway, whether or not this works with increase of timeout)
Solution for that is to build paging into your request.

For example:
If you need to return 25000 rows, split it in chunks of a 1000 rows.
When you need all 25000 rows you need to do multiple requests, sending also a parameter with the requested offset.

Re: httpResponse.getResponseBody() fails

PostPosted: Fri Jul 06, 2018 3:13 pm
by andre1506345542
Thanks mark
The timeout is probably not going to work as the data is already in the response object. It is the getResponseBody thatis failing. I think at that point I have the data already because I get the status code 200.
The data will grow in the future as we are just starting with this, so spliting up the data is probably the best way to go.
Andre