We help IT Professionals succeed at work.

Code getting Timeout expired

160 Views
Last Modified: 2018-10-31
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
Comment
Watch Question

Daniel PineaultPresident / Owner CARDA Consultants Inc.
CERTIFIED EXPERT
Distinguished Expert 2018

Commented:
CERTIFIED EXPERT

Author

Commented:
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
Software & Systems Engineer
CERTIFIED EXPERT
Distinguished Expert 2019
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Daniel PineaultPresident / Owner CARDA Consultants Inc.
CERTIFIED EXPERT
Distinguished Expert 2018
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
CERTIFIED EXPERT

Author

Commented:
Thank you my experts!
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.