3

Using VBA in Microsoft Access, I am sending XML to a server to get a response string. It works fine in Windows 7. Recently, some users have upgraded to Windows 10, and this no longers works (all users on Office 16). The specific error is: -2147012867 - A connection with the server could not be established.

The error occurs on the xsite.send line

Here is the code:

Dim xsite As ServerXMLHTTP60
Set xsite = New ServerXMLHTTP60

On Error Resume Next

xsite.setTimeouts 0, 60000, 30000, 600000

xsite.Open "POST", pServerURL & func, False
aErr = Array(Err.Number, Err.Description)
On Error GoTo 0
If 0 = aErr(0) Then 'No error creating the link
    xsite.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
    'Set request header with Base64-encoded username/password
    xsite.setRequestHeader "Authorization", "Basic " & EncodeBase64(UserName & ":" & Password)
    On Error Resume Next
    xsite.send "xmlData=" & URLEncode(xmldata)
    aErr = Array(Err.Number, Err.Description)
    On Error GoTo 0

    Debug.Print aErr(0)
    Debug.Print aErr(1)
End If

Any ideas?

av155
  • 31
  • 2
  • Problem may be in your `EncodeBase64` function? Or your `URLEncode` function ? Ore you have a different firewall on your Win10 boxes. – Tim Williams Aug 23 '17 at 21:04
  • test on win10 using the actual string that is returned by the encodeBase64 function – jsotola Aug 23 '17 at 21:56
  • Set all timeouts the same, and check if there is a timeout delay before error occurs? Try `MSXML2.XMLHTTP` and `WinHttp.WinHttpRequest.5.1`, also try to change URL and to remove headers - just to see any changes. – omegastripes Aug 24 '17 at 03:45

1 Answers1

0

I had a similar problem. Haven't tested your code but it appears similar to mine, it also works in Windows7 but not on Windows10. I found out that it was the Windows10 firewall who blocked it. Yours probably works if you turn off the firewall. I tried different approaches to make an exception to my firewall but never succeded. So the few times I have to run my code I have to shut the firewall down.

Tomas F.
  • 318
  • 3
  • 14