httpResponse.getResponseBody() fails

Questions and answers on designing your Servoy solutions, database modelling and other 'how do I do this' that don't fit in any of the other categories

httpResponse.getResponseBody() fails

Postby andre1506345542 » Fri Jul 06, 2018 1:51 pm

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
andre1506345542
 
Posts: 42
Joined: Mon Sep 25, 2017 3:19 pm

Re: httpResponse.getResponseBody() fails

Postby mboegem » Fri Jul 06, 2018 3:03 pm

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.
Marc Boegem
Solutiative / JBS Group, Partner
• Servoy Certified Developer
• Servoy Valued Professional
• Freelance Developer

Image

Partner of Tower - The most powerful Git client for Mac and Windows
User avatar
mboegem
 
Posts: 1742
Joined: Sun Oct 14, 2007 1:34 pm
Location: Amsterdam

Re: httpResponse.getResponseBody() fails

Postby andre1506345542 » Fri Jul 06, 2018 3:13 pm

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
andre1506345542
 
Posts: 42
Joined: Mon Sep 25, 2017 3:19 pm


Return to Programming with Servoy

Who is online

Users browsing this forum: No registered users and 13 guests

cron