Juvigy Posted May 8, 2018 Posted May 8, 2018 Hi Guys, I am using winhttp to make calls to the ebay api. I dont know why, but sometimes the calls fail with : "The requested action with this object has failed.:" on the $oHTTP.Send line. Any idea why? This is the code i use: $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") $oHTTP.Open("POST","https://api.ebay.com/ws/api.dll") $oHTTP.SetRequestHeader("X-EBAY-API-COMPATIBILITY-LEVEL", "391") ;~ $oHTTP.SetRequestHeader("X-EBAY-API-DEV-NAME", "not used") ;~ $oHTTP.SetRequestHeader("X-EBAY-API-APP-NAME", "not used") ;~ $oHTTP.SetRequestHeader("X-EBAY-API-CERT-NAME", "not used") $oHTTP.SetRequestHeader("X-EBAY-API-CALL-NAME", "GetCategories") $oHTTP.SetRequestHeader("X-EBAY-API-SITEID", "3") $oHTTP.SetRequestHeader("Content-Type", "text/xml") $oHTTP.Send("<?xml version='1.0' encoding='utf-8'?><GetCategoriesRequest xmlns=""urn:ebay:apis:eBLBaseComponents""><RequesterCredentials><eBayAuthToken>" & $auth_token & "</eBayAuthToken></RequesterCredentials><CategorySiteID>" & $CategorySiteID & "</CategorySiteID><DetailLevel>ReturnAll</DetailLevel><LevelLimit>" & $max_level & "</LevelLimit></GetCategoriesRequest>") $HTMLSource = $oHTTP.Responsetext Return $HTMLSourc
Danyfirex Posted May 8, 2018 Posted May 8, 2018 Hello. try with Settimeouts. Saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut
jdelaney Posted May 8, 2018 Posted May 8, 2018 (edited) I've seen the same. to get around this, I do asynchronus requests. i have not yet seen an error from doing that which a com error handler can't catch, allowing the script to proceed. https://msdn.microsoft.com/en-us/library/windows/desktop/aa384064(v=vs.85).aspx Edited May 8, 2018 by jdelaney IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Juvigy Posted May 9, 2018 Author Posted May 9, 2018 Thank you guys. Seems that the asynchronous thing works.
Juvigy Posted May 10, 2018 Author Posted May 10, 2018 (edited) Seems i spoke too soon. It continues to fail. Now it fails with the same error but on the $oHTTP.WaitForResponse ! Here is the error handler output: err.description is: An error occurred in the secure channel support err.windescription: Exception occurred. err.number is: 80020009 err.lastdllerror is: 0 err.scriptline is: 92 err.source is: WinHttp.WinHttpRequest err.helpfile is: err.helpcontext is: 0 We intercepted a COM Error ! err.description is: The data necessary to complete this operation is not yet available. err.windescription: Exception occurred. err.number is: 80020009 err.lastdllerror is: 0 err.scriptline is: 93 err.source is: WinHttp.WinHttpRequest err.helpfile is: err.helpcontext is: 0 Output has 2 errors , first is on $oHTTP.WaitForResponse(100), second one is on $HTMLSource = $oHTTP.Responsetext Edited May 10, 2018 by Juvigy added error msg
jdelaney Posted May 10, 2018 Posted May 10, 2018 (edited) But your script was able to proceed, right? I only really interact with test servers, so expect failures. as long as I don't have to constantly restart my script, I'm happy. example. made a simple gui app that allows me to configure and send soap requests. if no response, I can easily click the send button again. Edited May 10, 2018 by jdelaney IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Juvigy Posted May 11, 2018 Author Posted May 11, 2018 Yes, it doesnt crash because of the error handler. So i should put it in a loop and do it until i receive a response?
jdelaney Posted May 11, 2018 Posted May 11, 2018 That can work. you might need to recreate the winhttp object each time. i suggest putting in max retry, and exit if the response is populated. IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now