Why msxml6 library fails to load XML file with ServerHTTPRequest?

Revuimar 6 Reputation points
2022-11-10T11:29:05.447+00:00

I have a problem with loading XML file with the use of WinHTTP. There seem to have been a change in windows 11 that makes it impossible to send requests with WinHTTP. I checked network traffic and indeed there is no request produced when running the WinHTTP request.
Here's VBA code explaining the issue:

Sub testxml()   
Dim xmlOBject As Object   
Dim xmlOBject2 As Object   
Dim test As Boolean   
Set xmlOBject = CreateObject("MSXML2.DOMDocument.6.0")   
xmlOBject.async = False   
test = xmlOBject.Load("http://crd.gov.pl/wzor/2022/02/10/11341/schemat.xsd")   
Debug.Print "Wininet: " & test   
Set xmlOBject2 = CreateObject("MSXML2.DOMDocument.6.0")   
xmlOBject2.async = False   
xmlOBject2.SetProperty "ServerHTTPRequest", True   
test = xmlOBject2.Load("http://crd.gov.pl/wzor/2022/02/10/11341/schemat.xsd")   
Debug.Print "Winhttp: " & test   
End Sub    

output Windows 11:
Wininet: True
Winhttp: False

output Windows 10:
Wininet: True
Winhttp: True

Have there been some changes in Win 11 that disable this for security reasons?
I tried fidgeting with the "Internet Options" but to no avail. What is the issue?

Windows Server
Windows Server
A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.
12,566 questions
Windows 11
Windows 11
A Microsoft operating system designed for productivity, creativity, and ease of use.
8,871 questions
0 comments No comments
{count} vote

1 answer

Sort by: Most helpful
  1. MotoX80 32,641 Reputation points
    2022-11-11T15:20:17.667+00:00

    I tested your code as a VB script on Win11 and it worked. (Returned true, true.)

    Try it as a .vbs file.

    Dim xmlOBject 'As Object   
    Dim xmlOBject2 'As Object   
    Dim test 'As Boolean   
    Set xmlOBject = CreateObject("MSXML2.DOMDocument.6.0")   
    xmlOBject.async = False   
    test = xmlOBject.Load("http://crd.gov.pl/wzor/2022/02/10/11341/schemat.xsd")   
    wscript.echo "Wininet: " & test   
    Set xmlOBject2 = CreateObject("MSXML2.DOMDocument.6.0")   
    xmlOBject2.async = False   
    xmlOBject2.SetProperty "ServerHTTPRequest", True   
    test = xmlOBject2.Load("http://crd.gov.pl/wzor/2022/02/10/11341/schemat.xsd")   
    wscript.echo "Winhttp: " & test