You are currently offline, waiting for your internet to reconnect

PRB: Load Method Fails When Loading XML File Over HTTP

This article was previously published under Q281142
SYMPTOMS
When you use the Load method of either the MSXML.DOMDocument or the MSXML2.DOMDocument object to load an XML file over HTTP, the method fails with this error message:
-2146697209 - No data is available for the requested resource.
RESOLUTION
Use the ServerXMLHTTP component (introduced in MSXML 3.0) to load the document.You must use the setProperty method of MSXML2.DOMDocument to set the ServerHTTPRequest property to True. A value of True for the ServerHTTPRequest property indicates that you should use the "thread-safe" ServerXMLHTTP component to load the document. ServerXMLHTTP supports only synchronous loading. Therefore, the async property must be set to False when ServerHTTPRequest is set to True.
MORE INFORMATION
This problem does not occur if the Load method points to a file path. This problem may occur if DOMDocument loads an XML file over HTTP when MSXML is operating in a server-side or client-side multi-core environment.

Steps To Reproduce Behavior

The following VBScript code causes the error message to occur:
<%Option Explicit%><%Response.Buffer = False%><html><head></head><body><%Dim oXML, oXMLError, ReturnValue, xSet oXML = Server.CreateObject("MSXML2.DOMDocument")oXML.async = FalseReturnValue = oXML.Load("http://myserver/myxmlfile.xml")Response.write "Result of load method is =" & ReturnValue & "<br>"If ReturnValue = False Then	Set oXMLError = oXML.ParseError	Response.Write "&#xa0;&#xa0;" & oXMLError.ErrorCode & " - " & oXMLError.Reason & "  URL=" & oXMLError.URL & "<br>"	Set oXMLError = NothingEnd IfResponse.Write oxml.parseError.reasonFor x = 0 to oxml.childNodes.length 	Response.Write "Node " & x & ".  "Next Set oXML = Nothing%></body></html>				
To set the SetProperty method to True, add the following line to the preceding code, immediately following the line: oXML.async = False:
oxml.setProperty "ServerHTTPRequest", true				
For servers that are running on an intranet, the ServerHTTPRequest property requires you to run the WinHTTP proxy configuration utility, Proxycfg.exe. You cannot configure these settings by means of Control Panel.

Currently, the Proxycfg tool is only available by installing the following service packs or software:
  • Windows Server 2003 (all editions)
  • Windows XP Service Pack 1 (SP1)
  • Windows 2000 Service Pack 3 (SP3) or later
  • Sharepoint Portal Server
For more information about how to run the Proxycfg.exe utility, see the Readme.txt file that is included with the download or with the Microsoft XML 3.0 SDK. After you run the Proxycfg.exe tool and update the registry, the previous registry settings cannot be restored.

If anonymous access is allowed in the virtual directory that contains the ASP page that loads the XML file, make sure that the account that is used for anonymous access is a domain account. By default, Microsoft Internet Information Server (IIS) sets this account to a local server account, such as IUSR_MACHINENAME. This account may not have sufficient rights to the XML file that is located on the other server. 
 
If the IIS server does not have Microsoft Internet Explorer 5.01 Service Pack 2 (SP1) or a later version installed, you receive the following error message when you try to access the ASP page:

error 'ASP 0115'
Unexpected error
/MyVirtualDirectory/MyASPPage.asp 
A trappable error occurred in an external object. The script cannot continue running.
REFERENCES
MicrosoftXML 3.0 Software Development Kit
XMLSDK SDK
Properties

Article ID: 281142 - Last Review: 01/06/2011 21:10:00 - Revision: 4.0

  • kbprb KB281142
Feedback