Jump to content

[SOLVED]80020009 COM error with WinHttp.WinHttpRequest Send Method


Recommended Posts

Hi friends,

A script of mine stopped working suddenly. I am posting here the part of code that causes the issue.

$sPD = ""
$oMyError = ObjEvent("AutoIt.Error","MyErrFunc")    ; Initialize a COM error handler
Local $oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
$oHTTP.Open("POST", "https://cryptlex.com/services/api/pkey/generate", False)
$oHTTP.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded")
$oHTTP.Send($sPD)
Local $oReceived = $oHTTP.ResponseText
Msgbox(0,"", $oReceived)
Local $oStatusCode = $oHTTP.Status
Msgbox(0,"", $oReceived)
;error handler
Func MyErrFunc()
  Msgbox(0,"AutoItCOM Test","We intercepted a COM Error !"    & @CRLF  & @CRLF & _
             "err.description is: " & @TAB & $oMyError.description  & @CRLF & _
             "err.windescription:"   & @TAB & $oMyError.windescription & @CRLF & _
             "err.number is: "       & @TAB & hex($oMyError.number,8)  & @CRLF & _
             "err.lastdllerror is: "   & @TAB & $oMyError.lastdllerror   & @CRLF & _
             "err.scriptline is: "   & @TAB & $oMyError.scriptline   & @CRLF & _
             "err.source is: "       & @TAB & $oMyError.source       & @CRLF & _
             "err.helpfile is: "       & @TAB & $oMyError.helpfile     & @CRLF & _
             "err.helpcontext is: " & @TAB & $oMyError.helpcontext _
            )
Endfunc

When I execute from the editor is shown an error on the  statement : $oHTTP.Send($sPD), Request with object failed.

The script got stopped on a Windows -7 machine. I have tested the part of code on a Windows 10 machine and is working good.

Here is the details of the error: 

We intercepted a COM Error !

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:     6

err.source is:     WinHttp.WinHttpRequest

err.helpfile is:

err.helpcontext is:     0

 

Please help. I have searched through out the forum but no help :-(

Edited by PoojaKrishna
Link to comment
Share on other sites

The most likely issue is that the web site now requires secure connections to use newer TLS protocols.  Windows 7, if not specifically updated, did not contain the definitions and services to use TLS 1.1 or 1.2.  Windows 10 did come with these definitions and services.

You can use this link to give you a starting point to understanding the possible issue and how to resolve it.

Update to enable TLS 1.1 and TLS 1.2 as a default secure protocols in WinHTTP in Windows

Edited by TheXman
Link to comment
Share on other sites

On 5/27/2018 at 6:54 PM, TheXman said:

The most likely issue is that the web site now requires secure connections to use newer TLS protocols.  Windows 7, if not specifically updated, did not contain the definitions and services to use TLS 1.1 or 1.2.  Windows 10 did come with these definitions and services.

You can use this link to give you a starting point to understanding the possible issue and how to resolve it.

Update to enable TLS 1.1 and TLS 1.2 as a default secure protocols in WinHTTP in Windows

Thank you so much. Issue solved.

Link to comment
Share on other sites

  • 3 years later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...