【发布时间】:2016-07-14 08:54:59
【问题描述】:
我为我们的 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(发生内部错误。)
为什么用户的权限会影响“内部错误”?我猜它不是在谈论 500 的 HTTP 响应代码?
【问题讨论】: