NetTalk Central

Author Topic: NetWebClient - async call  (Read 5194 times)

Thys

  • Sr. Member
  • ****
  • Posts: 311
    • View Profile
    • Incasu
    • Email
NetWebClient - async call
« on: January 14, 2019, 10:10:22 PM »
Hi,

I need to do a GET to a Google service that requires an asynchronous client call. The AsyncOpenUse property is 0 by default - meaning that it makes a synchronous call by default. When changed to 1 (implying AsyncOpenUse = true) anywhere (Init or before Open), the service keeps on rejecting the call saying it's not asynchronous. Is there another way to set the call to be asynchronous?

Thys

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11251
    • View Profile
Re: NetWebClient - async call
« Reply #1 on: January 15, 2019, 11:29:02 PM »
Hi Thys,

>> I need to do a GET to a Google service that requires an asynchronous client call.

I think you are misunderstanding their docs. There is no way a server can tell if the call is asynchronous or not, and they would never care about that. So I think whatever you are reading is referring to something completely different to what you think it's referring to.

>>  The AsyncOpenUse property is 0 by default - meaning that it makes a synchronous call by default.

Alas, again, no. That's an incorrect interpretation of the property. That property is strictly to do with the connection being opened. Since connections are typically opened very very quickly, and it's easier to trap for errors on synchronous code, it defaults to opening synchronously. (Although you can change this if you like.)

>>When changed to 1 (implying AsyncOpenUse = true) anywhere (Init or before Open), the service keeps on rejecting the call saying it's not asynchronous.

I don't think it's rejecting you for the reasons you think. It might be helpful to post links to the service documentation explaining this requirement, or even posting the reply here that you receive from the service.


Cheers
Bruce

Thys

  • Sr. Member
  • ****
  • Posts: 311
    • View Profile
    • Incasu
    • Email
Re: NetWebClient - async call
« Reply #2 on: January 16, 2019, 12:13:48 AM »
Thanks Bruce.

It's Google's reCAPTCHA v3 that I'm using. You can find the references at https://developers.google.com/recaptcha/docs/v3 and https://developers.google.com/recaptcha/docs/verify. I'm doing the verifying part in Clarion. After some tweeking, the synchronous error is gone, but I now get an error Could not connect to the website although I'm sure that I'm making right calls:

ntHTTP.SetValue ('secret', '****')
ntHTTP.SetValue ('response', '****')
ntHTTP.Post ('https://www.google.com/recaptcha/api/siteverify')


All of this code is within a window of a source procedure, so that I can capture ErrorTrap and PageReceived events for the ntHTTP object.

Thys



Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11251
    • View Profile
Re: NetWebClient - async call
« Reply #3 on: January 17, 2019, 01:10:05 AM »
Hi Thys,

I'm not seeing a reference to Async on either of those pages.
Looks to be a normal API-Client call as far as I can tell..

>> All of this code is within a window of a source procedure,

So to be clear, this is a _window_ procedure or a _source_ procedure (with a hand-coded window?)

The post code itself looks fine.

cheers
Bruce

Thys

  • Sr. Member
  • ****
  • Posts: 311
    • View Profile
    • Incasu
    • Email
Re: NetWebClient - async call
« Reply #4 on: January 17, 2019, 01:17:50 AM »
Hi Bruce.

The async issue was not THE issue, sorry.

It's a source procedure with a window that I manage. I'll try to replicate the problem in a test app.

Thys