• I am creating a new home page for this site, where the focus will be on directing people to the forums. If you would like to provide a testimonial, I would be most grateful. The thread where this is discussed can be found here: Seeking Testimonials Alternatively, just private message me.

CreateObject("MSXML2.ServerXMLHTTP") not working (1 Viewer)

smig

Registered User.
Local time
Today, 18:58
Joined
Nov 25, 2009
Messages
2,137
I'm using CreateObject("MSXML2.ServerXMLHTTP") for long time to automatically download files from my server

recently I can't download getting an error with secured channel
I get the error on .Send

it does not netter if I send the file to get as HTTP or HTTPS

the files are public so no need for UserName or Password

Code:
Public Function fnDownloadHTTP(strTarget As String, strSaveAs As String, Optional strUserName As String, Optional strPassword As String) As Boolean

' On Error GoTo errHere


Dim xmlHTTP As Object
Dim strRespText As String

fnDownloadHTTP = True

'Set xmlHTTP = CreateObject("Microsoft.XMLHTTP")
Set xmlHTTP = CreateObject("MSXML2.ServerXMLHTTP")

With xmlHTTP
    .Open "GET", strTarget, False, strUserName, strPassword
    .setRequestHeader "cache-control", "no-cache,must revalidate"
    .send
End With
 
If fnSaveDownloadFile(strSaveAs, xmlHTTP.responseBody) = False Then
    fnDownloadHTTP = False
End If
 
 
ExitHere:
    Set xmlHTTP = Nothing
    Exit Function
 
errHere:
    fnDownloadHTTP = False
    Resume ExitHere

End Function
 

CJ_London

Super Moderator
Staff member
Local time
Today, 16:58
Joined
Feb 19, 2013
Messages
12,220
not sure I can suggest anything - but what is the error description?
 

smig

Registered User.
Local time
Today, 18:58
Joined
Nov 25, 2009
Messages
2,137
not sure I can suggest anything - but what is the error description?
RunTime error -2147012739 Error support the secured channel (Translated from Hebrew)
 

CJ_London

Super Moderator
Staff member
Local time
Today, 16:58
Joined
Feb 19, 2013
Messages
12,220
take a look at this link - it suggests a slight different object
 

smig

Registered User.
Local time
Today, 18:58
Joined
Nov 25, 2009
Messages
2,137
Do you need the actual file, or just the contents?
Though at the end process I will need to download files, reading the content will be great :)
It's a simple one short line content with a version number
 

cheekybuddha

AWF VIP
Local time
Today, 16:58
Joined
Jul 21, 2014
Messages
556
With the following simple function:
Code:
Function HTTP_Get(webServiceURL As String) As String

  Const XMLHTTP             As String = "MSXML2.ServerXMLHTTP", _
        METHOD_GET          As String = "GET", _
        HTTP_STATUS_SUCCESS As Integer = 200
    
  With CreateObject(XMLHTTP)
    .Open METHOD_GET, webServiceURL, False
    .setRequestHeader "cache-control", "no-cache,must revalidate"
    .Send
    If .Status = HTTP_STATUS_SUCCESS Then
      HTTP_Get = .ResponseText
'      Debug.Print .getAllResponseHeaders
'      Debug.Print .responseBody
    Else
      Debug.Print .Status & ": " & .StatusText
    End If
  End With
  
End Function
This is what I get in the Immediate Window (Ctrl+G):
Code:
?HTTP_Get("http://noam.fuchsapps.com/App/Update/NoamLekochotVersion.txt")
11.188
hth,

d
 

The_Doc_Man

Happy Retired Curmudgeon and Occasional Moderator
Staff member
Local time
Today, 10:58
Joined
Feb 28, 2001
Messages
17,270
When I look up error -2147012739 (which is, in hex 80072F7D) it tells me that there is some error in the encryption algorithm. By any chance did you have an upgrade of any sort - either on YOUR end or on the other end of this connection? It seems to be saying that the server certificate cannot be decoded. The suggestion is that you need to somehow update your Crypto API.

This is an older reference:


Not quite as old but similar concept: Something is out of date


I've looked at several other links and they all more or less give variants of the same issue - that due to something being updated or something going out of date, you cannot establish the session because of a hashing method mismatch. It seems to be somewhat generic in that more than one kind of mismatch can trigger this.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top Bottom