NetTalk Central

Author Topic: Consuming web services from ntwebserver app is so slow  (Read 5408 times)

walter.dasilva

  • Sr. Member
  • ****
  • Posts: 314
  • SOFTVALE
    • MSN Messenger - walter@softvale.com.br
    • View Profile
    • SOFTVALE
Consuming web services from ntwebserver app is so slow
« on: April 04, 2017, 10:25:14 AM »
Hi,

Consuming web services from NT web server app is slower than calling from browser or nt demo.

https://viacep.com.br/ws/12511320/json/unicode/

12511320 is record parĂ¢meter
use 12500000 for error

trying it from browser or nt demo webclient is very fast, about a sec, but if i try from my ntws is taking about 65 sec.

Thanks
Walter
Walter - SOFTVALE

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Consuming web services from ntwebserver app is so slow
« Reply #1 on: April 04, 2017, 11:09:14 PM »
Hi Walter,

My guess is you've made a mistake in your implementation in the web sever.

It sounds like you are not closing the window when the page is received - only on errortrap - and you're getting an error when the connection times out. But that's just a guess.

Unfortunately to be more accurate I'd need to see an example.

cheers
Bruce

walter.dasilva

  • Sr. Member
  • ****
  • Posts: 314
  • SOFTVALE
    • MSN Messenger - walter@softvale.com.br
    • View Profile
    • SOFTVALE
Re: Consuming web services from ntwebserver app is so slow
« Reply #2 on: April 05, 2017, 11:47:22 AM »
Hi Bruce,

I think i'm closing window.

Regards,
Walter - SOFTVALE

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Consuming web services from ntwebserver app is so slow
« Reply #3 on: April 05, 2017, 10:24:49 PM »
Thanks for the example Walter.

Aside - make sure you start the progress control at 1, not 0.

There are 2 ways for a server to indicate the page is complete. The first is to set a content-length in the header, then when that has arrived you know it's done. The second is to close your connection.

The server you are talking to though uses a third approach. It sets the Transfer-Coding to chunked (usually done with data streaming) and then adds an end-of-stream marker at the end. This is very cunning, and completely allowable. I will adjust the Webclient class to allow for this. The update will only be in the 9.25 update though - but I could send you an interim file. Which build are you currently on?

Aside: It works in NetDemo because that shows you the data, in .Process, as it comes in - it doesn't wait for PageReceived...

Cheers
Bruce



walter.dasilva

  • Sr. Member
  • ****
  • Posts: 314
  • SOFTVALE
    • MSN Messenger - walter@softvale.com.br
    • View Profile
    • SOFTVALE
Re: Consuming web services from ntwebserver app is so slow
« Reply #4 on: April 07, 2017, 06:21:04 AM »
Hi Bruce,

I'm on 9.24.
So, how to close connection there? i'm trying .close with no effect and .closeserverconnection with error.

Best Regards,
Walter - SOFTVALE

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Consuming web services from ntwebserver app is so slow
« Reply #5 on: April 09, 2017, 11:25:49 PM »
you need to wait for 9.25 Walter - which should be out early this week.

-- update -- it's out now Walter.

cheers
Bruce
« Last Edit: April 13, 2017, 05:10:50 AM by Bruce »

walter.dasilva

  • Sr. Member
  • ****
  • Posts: 314
  • SOFTVALE
    • MSN Messenger - walter@softvale.com.br
    • View Profile
    • SOFTVALE
Re: Consuming web services from ntwebserver app is so slow
« Reply #6 on: May 02, 2017, 12:08:45 PM »
Upgraded to 9.26 and works pretty fine.

Thanks Bruce.
Walter - SOFTVALE