pavell86
01-09-2023, 11:14 PM
Hello I use this macro, but returned message Encryption error. Can I help me? Thank you
Public Sub httplogin()
Dim result As String
Dim xmlDoc As Object, post As Object
Dim sEnv As String
Set xmlDoc = CreateObject("MSXML2.DOMDocument")
Dim HTTPRequest As WinHttp.WinHttpRequest
Set HTTPRequest = New WinHttp.WinHttpRequest
sEnv = sEnv & "<soap:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"">"
sEnv = "<?xml version=""1.0"" encoding=""utf-8""?>"
sEnv = sEnv & "<soap:Envelope xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"">"
sEnv = sEnv & "<soap:Body>"
sEnv = sEnv & "<logUser xmlns=""http://www.webservice.com/Sws/"">"
sEnv = sEnv & "<LOGIN>user</LOGIN>"
sEnv = sEnv & "<PASSWORD>pass</PASSWORD>"
sEnv = sEnv & "</logUser>"
sEnv = sEnv & "</soap:Body>"
sEnv = sEnv & "</soap:Envelope>"
With HTTPRequest
.Open "POST", "http://server.com/webservice.asmx?WSDL&op=logUser", False
.SetRequestHeader "Content-Type", "text/xml; charset=utf-8"
.SetRequestHeader "Upgrade-Insecure-Requests", "1"
.SetRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"
.send sEnv
Debug.Print .responseText
End With
End Sub
Public Sub httplogin()
Dim result As String
Dim xmlDoc As Object, post As Object
Dim sEnv As String
Set xmlDoc = CreateObject("MSXML2.DOMDocument")
Dim HTTPRequest As WinHttp.WinHttpRequest
Set HTTPRequest = New WinHttp.WinHttpRequest
sEnv = sEnv & "<soap:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"">"
sEnv = "<?xml version=""1.0"" encoding=""utf-8""?>"
sEnv = sEnv & "<soap:Envelope xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"">"
sEnv = sEnv & "<soap:Body>"
sEnv = sEnv & "<logUser xmlns=""http://www.webservice.com/Sws/"">"
sEnv = sEnv & "<LOGIN>user</LOGIN>"
sEnv = sEnv & "<PASSWORD>pass</PASSWORD>"
sEnv = sEnv & "</logUser>"
sEnv = sEnv & "</soap:Body>"
sEnv = sEnv & "</soap:Envelope>"
With HTTPRequest
.Open "POST", "http://server.com/webservice.asmx?WSDL&op=logUser", False
.SetRequestHeader "Content-Type", "text/xml; charset=utf-8"
.SetRequestHeader "Upgrade-Insecure-Requests", "1"
.SetRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"
.send sEnv
Debug.Print .responseText
End With
End Sub