I am accessing a webService, need to pass the XML and insert into a database. To build the code I browse the file, downloaded it, wrote the code to store the info. Great all working very well with the file locally!
So I change the code to load a URL and I have issues. When I ask the parseError Object (errorCode, reason and line) what is wrong I get this:
XML Passer Object - Error Code = System error: -2147012889.
XML Passer Object - Error Reason = -2147012889
XML Passer Object - Error Line = 0
There is almost no info at all on this '-2147012889' error code. After looking at the code and getting it pier reviewed. Nothing looks like it an issue. The weird thing is when I place this XML file on one of our servers and run the passer code via one of our URL's it runs fine. Is this a realistic test? Simply placing the XML file on our server Vs hitting the webService URL that has been provided to me (it is a weather provider here is Australia).
Here is a very cut down and sanitised version of the XML:
<?xml version="1.0" encoding="iso-8859-1" ?>
<data>
<metadata>
<sector>weather</sector>
<title>WeatherProvider</title>
<last_commit>2014-08-11 09:15:22 +1000 (Mon, 11 Aug 2014)</last_commit>
<validity>
<date>2014-08-12</date>
<day_name>Tuesday</day_name>
</validity>
</metadata>
<weather>
<countries>
<country code="AU" name="Australia" region="Oceania">
<location type="APLOC" code="6700" name="Addington" state="VIC" postcode="3352">
<conditions>
<related_location type="SITE" code="89002" name="Ballarat Ap" state="VIC">
</related_location>
<obs_time_local tz="EST">2014-08-12T18:00:00</obs_time_local>
<temp_c units="°C">6.2</temp_c>
<dp_c units="°C">5.9</dp_c>
</conditions>
</location>
</country>
</countries>
</weather>
</data>
and here is a very cut down version of the VBScript:
<%
Dim objXML, URL
URL = "http://ift.tt/1sO4xoD"
Set objxml = Server.CreateObject("MSXML2.DOMDocument")
'Set objxml = Server.CreateObject("Microsoft.XMLDOM")
'Set objXML = Server.CreateObject("MSXML2.DOMDocument.6.0")
objXML.setProperty "ServerHTTPRequest", True
objXML.async = False
objXML.Load URL
Response.Write "XML Passer Object - Error Code = " & objXML.parseError.reason & "<BR>"
Response.Write "XML Passer Object - Error Reason = " & objXML.parseError.errorCode & "<BR>"
Response.Write "XML Passer Object - Error Line = " & objXML.parseError.line & "<BR><br>"
Response.Write "ASP Error Object Err.Des = " & Err.Description & "<br><br>"
dim last_commit
set last_commit = objxml.getElementsByTagName("data/metadata/last_commit")
response.write "The expected last_commit value = " & last_commit.item(0).Text & "<br>"
%>
Here is the the output when i browse to the file either locally or when I place it as an XML file on one of our servers and browse to it via the above code:
XML Passer Object - Error Code =
XML Passer Object - Error Reason = 0
XML Passer Object - Error Line = 0
ASP Error Object Err.Des =
The expected last_commit value = 2014-08-11 09:15:22 +1000 (Mon, 11 Aug 2014)
and here is the problematic output when browsing to the 3rd party's webService URL (note line 21 is the very last line of code which writes 'last_commit.item(0).Text'):
XML Passer Object - Error Code = System error: -2147012889.
XML Passer Object - Error Reason = -2147012889
XML Passer Object - Error Line = 0
ASP Error Object Err.Des =
Microsoft VBScript runtime error '800a01a8'
Object required: '[object]'
/bl/mattTest/XMLToASPRemoteBodyFullCode.asp, line 21
Am very stuck on this one. Never seen anything like it. Thanks in advance for your help
No comments:
Post a Comment