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
.NET ProgrammingMicrosoft AccessVisual Basic Classic

Avatar of undefined
Last Comment
bfuchs

8/22/2022 - Mon
Daniel Pineault

ASKER
bfuchs

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
John Tsioumpris

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
ASKER
bfuchs

Thank you my experts!
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck