Search code examples
sql-servert-sqlhttpwinhttp

MSSQL Win HTTP 5.1 ignore certificate


I'm trying to to create an https request from a stored procedure in MSSQL to a https website using WinHttpRequest 5.1. I have managed to create the request to a normal http website using OLE automation procedures (sp_OACreate, sp_OAMethod, etc..) but i need to set the WinHTTP object to ignore any certificate errors.

WinHttp 5.1 itself supports this option but i do not know how to set it from MSSQL unfortunately

Here is what i should do in MSSQL:

http.Option[WinHttpRequestOption_SslErrorIgnoreFlags] = SslErrorFlag_Ignore_All; 

Solution

  • Just set the Option property with sp_OASetProperty. You need the integer values for WinHttpRequestOption_SslErrorIgnoreFlags and SslErrorFlag_Ignore_All.