Link to home
Start Free TrialLog in
Avatar of bfuchs
bfuchsFlag for United States of America

asked on

Code getting Timeout expired

Hi experts,

I have the following code exporting some records to a web site.
                Set objHTTP = New WinHttp.WinHttpRequest
                
                'url = "https://c0aco743.caspio.com/rest/v2/tables/" & sTable & "/records"
                objHTTP.Open "POST", url, False
                objHTTP.SetRequestHeader "Accept", "application/json"
                objHTTP.SetRequestHeader "Content-Type", "application/json"
                objHTTP.SetRequestHeader "Authorization", "Bearer " + access_token
                    objHTTP.Send JsonConverter.ConvertToJson(patient)

Open in new window

Sometimes things are getting stuck and then code execution stops...
See attached error message, generated when executing last line.
Since there is not a problem with the data being sent, rather just a timing issue.
As next time I run the code for same data it works perfectly fine.
wondering what is the right approach for that?

Thanks
Untitled.png
Untitled1.png
Avatar of Daniel Pineault
Daniel Pineault

Avatar of bfuchs

ASKER

Hi,
I see they suggesting the following
objHTTP.waitforresponse

Open in new window

But where should I apply that, must be after the send command, right?
However since code its getting stuck at the send command (see attached above), not sure how that will help me?
Thanks,
Ben
ASKER CERTIFIED SOLUTION
Avatar of John Tsioumpris
John Tsioumpris
Flag of Greece image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bfuchs

ASKER

Thank you my experts!