NetTalk Central

Author Topic: NetWebClient - Handcoded Example  (Read 184 times)

Rakesh

  • Newbie
  • *
  • Posts: 3
    • View Profile
NetWebClient - Handcoded Example
« on: April 09, 2022, 10:26:04 AM »
Hello -

I'm trying to call a procedure and will be passing API Token. The called procedure is hardcoded procedure and will return GET response. Is is possible to use these methods in a local hardcoded procedure. Does anyone have any basic example to share?

Need to call/use this in hardcoded procedure.

!Local Data Classes
ThisWebClient        CLASS(NetWebClient)                   ! Generated by NetTalk Extension (Class Definition)
ErrorTrap              PROCEDURE(string errorStr,string functionName),DERIVED
PageReceived           PROCEDURE(),DERIVED
                     END

Alternately, when using Nettalk Template/Extension in Windows Procedure, which Nettalk embed should I use for POST(EVENT:CloseWindow) when GET or POST request is fully completed.

Thanks,
-Rakesh
« Last Edit: April 09, 2022, 12:24:24 PM by Rakesh »

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 10758
    • View Profile
Re: NetWebClient - Handcoded Example
« Reply #1 on: April 11, 2022, 04:33:17 AM »
Hi Rakesh,

yes, you can use the object in a hand-coded procedure. After all any generated procedure is just source code.

However you will need a Window , and ACCEPT loop, because the comms process is asynchronous, and event driven. So using a Window procedure template is a good place to start as it does that part for you.

>> Alternately, when using Nettalk Template/Extension in Windows Procedure, which Nettalk embed should I use for POST(EVENT:CloseWindow) when GET or POST request is fully completed.

2 places.
a) in the ErrorTrap method (as there was an error connecting, and so no response will arrive). and
b) in the PageReceived method. Since this is called when the response has arrived into the procedure. So you can call it here, after you've completed all your processing.

Cheers
Bruce