我为Microsoft Access 2010数据库/应用程序编写了一个函数,用于从供应商的Web服务中检索一些数据。这是一个非常简单的操作,在我的登录(本地管理员帐户)下工作正常,但对于PC上标准用户的任何用户都不起作用。
Dim http As New XMLHTTP60
Dim strRequestData As String
'Build the request
strRequestData = _
"<xml><somedata></somedata></xml>"
'Send request
http.Open "POST", "https://oursupplier.com/access/access.htm", True
http.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
http.Send "XML=" & strRequestData
'Wait for response
Dim I As Integer
Do Until http.ReadyState = 4 'Completed
'Only wait 500*40 (20 seconds)
I = I + 1
If I > 40 Then
MsgBox "Operation timed out (20 seconds)."
http.abort
Exit Function
End If
Sleep 500
DoEvents
Loop
If http.status = 200 Then
ReturnValue = http.responseText
Else
On Error Resume Next 'Don't error if we can't read a property
MsgBox "Request failed - HTTP status '" & http.status & " " & http.StatusText & "'"
LogMessage "logfile.txt", "*** Request failed ***"
LogMessage "logfile.txt", "HTTP Status: " & http.status
LogMessage "logfile.txt", "HTTP Status Text: " & http.StatusText
LogMessage "logfile.txt", "Request: " & "XML=" & strRequestData
LogMessage "logfile.", "Response: " & http.responseText
On Error GoTo 0
End If
'Clean up
Set http = Nothing
记录的错误是:
14/07/2016 9:04:08 am *** Request failed ***
14/07/2016 9:04:08 am HTTP Status: 12004
14/07/2016 9:04:08 am HTTP Status Text:
14/07/2016 9:04:08 am Request: <xml><somedata></somedata></xml>
14/07/2016 9:04:08 am Response:
12004表示ERROR_INTERNET_INTERNAL_ERROR(发生内部错误。)
为什么用户的权限会影响&#34;内部错误&#34;?我猜它不是在谈论500的HTTP响应代码?
答案 0 :(得分:0)
我将XMLHTTP60更改为服务器 XMLHTTP60。此课程无需本地管理员权限即可运行。
我不知道为什么这可以解决这个问题。
Dim http As New ServerXMLHTTP60