title: Excel vba and XMLHTTP with ADFS - not returning xml
body: <p>I have an Excel macro that has been in use for years which posts to a database using an XMLHttp call. The code is digitally signed. </p>
  
  <p>Recently the site which is being posted to has enabled ADFS. Now instead of getting xml back I get the contents of the ADFS authentication form. There is no prompt for credentials in it since authentication already occurred. It I open the url from a web browser it goes through as expected with existing credentials used and the page loaded.</p>
  
  <p>I tried setting the trusted setting for the url and allowed external content but that didn't matter.</p>
  
  <p>Have I missed something?</p>
  
  <p>The html I get back looks like...</p>
  
  <pre><code>&lt;html&gt;&lt;head&gt;&lt;title&gt;Working...&lt;/title&gt;&lt;/head&gt;&lt;body&gt;&lt;form method="POST" name="hiddenform" action="https://isvcci.jttest.com:444/"&gt;&lt;input type="hidden" name="wa" value="wsignin1.0" /&gt;
  ...
  &lt;noscript&gt;&lt;p&gt;Script is disabled. Click Submit to continue.&lt;/p&gt;&lt;input type="submit" value="Submit" /&gt;&lt;/noscript&gt;&lt;/form&gt;&lt;script language="javascript"&gt;window.setTimeout('document.forms[0].submit()', 0);&lt;/script&gt;&lt;/body&gt;&lt;/html&gt;
  </code></pre>
  
  <p>This is the vba:</p>
  
  <pre><code>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 &lt;------
      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
  </code></pre>
  
  <p>Thanks for any assistance!</p>