I'm building a site on a Windows Server with ASP enabled. I need to retrieve an XML document from another server and return a value in that document. The xml file is small - only one node with a text value. I just need to return that text value. I've never worked with ASP before, and Googling around has led me to some code examples, but nothing that works so far. Here's what I've got, which gives me a 500:
<%
Dim URL, objXML
URL = "http://someserver.com/xml"
Set objXML = Server.CreateObject("MSXML2.DOMDocument.4.0")
objXML.setProperty "ServerHTTPRequest", True
objXML.async = False
objXML.Load(URL)
If objXML.parseError.errorCode <> 0 Then
Response.Write(objXML.parseError.reason)
Response.Write(objXML.parseError.errorCode)
End If
Set oRoot = objXML.selectSingleNode("//xml/response")
var = oRoot.text
set objXML = nothing
%>
<%= var %>
===========
Update:
Yes, you're exactly correct about my XML. Just one node with a value. Based on your comments, I edited my asp code to:
<%
Dim URL, objXML, value
URL = "http://someserver.com/xml"
Set objXML = Server.CreateObject("MSXML2.DOMDocument.6.0")
objXML.setProperty "ServerHTTPRequest", True
objXML.async = False
objXML.Load URL
Response.Write objXML.parseError.reason
value = objXML.documentElement.Text
set objXML = nothing
%>
<%= value %>
Which is still returning a 500. How do I go about debugging ASP? Is there some way to turn on detailed error reporting?