【发布时间】:2014-04-07 23:52:15
【问题描述】:
我有一个使用了多年的 Excel 宏,它使用 XMLHttp 调用发布到数据库。代码经过数字签名。
最近发布到的站点启用了 ADFS。现在,我没有获取 xml,而是获取了 ADFS 身份验证表单的内容。由于已经进行了身份验证,因此没有提示输入凭据。我从 Web 浏览器中打开 url,它使用现有的凭据并加载了页面。
我尝试为 url 设置可信设置并允许外部内容,但这没关系。
我错过了什么吗?
我得到的 html 看起来像......
<html><head><title>Working...</title></head><body><form method="POST" name="hiddenform" action="https://isvcci.jttest.com:444/"><input type="hidden" name="wa" value="wsignin1.0" />
...
<noscript><p>Script is disabled. Click Submit to continue.</p><input type="submit" value="Submit" /></noscript></form><script language="javascript">window.setTimeout('document.forms[0].submit()', 0);</script></body></html>
这是vba:
Sub PostXml(strType As String, strAddress As String, objXml As MSXML2.DOMDocument60)
Dim objHttp As MSXML2.XMLHTTP60, objXmlResponse As MSXML2.DOMDocument60, objNode As MSXML2.IXMLDOMNode
Dim strText As String
Set objHttp = New MSXML2.XMLHTTP60
objHttp.Open "POST", strAddress, False
objHttp.setRequestHeader "Content-Type", "text/xml; charset=utf-8"
objHttp.send objXml
Set objXmlResponse = objHttp.responseXML
rem responseXML is always empty but responseText has the adfs page <------
Set objNode = objXmlResponse.SelectSingleNode("root/errorMessage")
If objNode Is Nothing Then
MsgBox "Error: Unable to retrieve expected response from the server." + vbCrLf + "The opportunity may not have been updated."
Else
... code for success goes here
End If
End Sub
感谢您的帮助!
【问题讨论】:
标签: vba excel adfs xmlhttprequest