|
Home > Archive > IIS ASP > March 2006 > issues with MSXML2.FreeThreadedDOMDocument
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
issues with MSXML2.FreeThreadedDOMDocument
|
|
| s_m_b 2006-03-25, 11:58 am |
| Using w2k advanced server (test system is standard server)
"Set objXML = Server.CreateObject("MSXML2.FreeThreadedDOMDocument")
objXML.async = False
objXML.setProperty "ServerHTTPRequest", True
objXML.Load
("http://news.bbc.co.uk/rss/newsonline_uk_edition/front_page/rss091.xml")
If objXML.parseError.errorCode <> 0 Then
'Response.Write "<pre>" & vbCrLf
Response.Write ("<strong>Error:</strong> " &
objXML.parseError.reason )
Select Case objXML.parseError.errorCode
Case 0
strResult = "Valid: " & strFileName & vbCr
Case Else
strResult = vbCrLf & "ERROR! Failed to validate " &
vbCrLf & objXML.parseError.reason & vbCr & "Error code: " &
objXML.parseError.errorCode & ", Line: " & objXML.parseError.line & ",
Character: " & objXML.parseError.linepos & ", Source: " & Chr(34) &
objXML.parseError.srcText & Chr(34) & " - " & Now & vbCrLf
End Select
Response.Write ("<strong>Line:</strong> " & objXML.parseError.line
& vbCrLf)
Response.Write ("<strong>Text:</strong> " & strResult)
Server.HTMLEncode(objXML.parseError.srcText) & vbCrLf
'Response.Write "</pre>" & vbCrLf
End If
Set objItemList = objXML.getElementsByTagName("item")
Set objXML = Nothing
intcount = 0
For Each objItem In objItemList
intcount = intcount+1
' childNodes: 0=title, 2=link, 1=description
Response.Write ("<p>» " & vbLf)
Response.Write ("<a href=""" & objItem.childNodes(2).text & """
target = ""bbcnews"">" & vbLf)
Response.Write (objItem.childNodes(0).text & "</a><br />
" & vbLf)
response.write ("<span style=""font-style:italic"">" &
objItem.childNodes(1).text & "</span>" & vbLf)
Response.Write ("</p>" & vbCrLf)
if intcount > 1 then exit for
Next"
Is there any way to get the raw feed from the XML, no matter what the
error comes back as. I'm currently getting 'invalid response' with an
error code of :-2147012744, which I can't find, but understand to be a
nonespecific HTTP error.
| |
| Bob Barrows [MVP] 2006-03-25, 11:59 am |
| s_m_b wrote:
> Using w2k advanced server (test system is standard server)
>
> "Set objXML = Server.CreateObject("MSXML2.FreeThreadedDOMDocument")
1. Why the initial quote (before Set)?
2. Unlikely to have anything to do with your problem, but why are you using
the bulky Free-threaded object? Are you planning to store it in Application
or Session? If not, switch to the normal DomDocument object
Set objXML = Server.CreateObject("MSXML2.DOMDocument")
> objXML.async = False
> objXML.setProperty "ServerHTTPRequest", True
> objXML.Load
> (http://news.bbc.co.uk/rss/newsonlin...page/rss091.xml)
<snip>
>
> Is there any way to get the raw feed from the XML, no matter what the
> error comes back as. I'm currently getting 'invalid response' with an
> error code of :-2147012744, which I can't find, but understand to be a
> nonespecific HTTP error.
I don't understand. Is this error contained in the parseError object?
I think you should be using ServerXMLHTTP for this task, but I'm not sure
having never attempted it.
Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
| |
| s_m_b 2006-03-25, 11:59 am |
| "Bob Barrows [MVP]" <reb01501@NOyahoo.SPAMcom> wrote in
news:#CZQPjoTGHA.4080@TK2MSFTNGP10.phx.gbl:
> s_m_b wrote:
> 1. Why the initial quote (before Set)?
Oh, ignore that - it was to highlight the code snippet, and I should have
added a line after (!)
> 2. Unlikely to have anything to do with your problem, but why are you
> using the bulky Free-threaded object? Are you planning to store it in
> Application or Session? If not, switch to the normal DomDocument
> object Set objXML = Server.CreateObject("MSXML2.DOMDocument")
>
Simply because I've searched high and low for an easy way to get RSS XML
feeds parsed into my pages, and that's the only one I found that actually
worked.
> <snip>
>
> I don't understand. Is this error contained in the parseError object?
> I think you should be using ServerXMLHTTP for this task, but I'm not
> sure having never attempted it.
>
Yes, this is straight from parseError.
""""""""""
Error: opening (board=1) The server returned an invalid or unrecognized
response
Line No.: 0
Character: 0
File Position: 0
Source Text:
Error Code:-2147012744
"""""""""""""
Is the result from the code on one server, and a perfect output of the
actual feed on the other. The solve I used for the now-working one was to
switch to the MSXML2.DOMDocument.4.0 object
I thought I was using ServerXMLHTTP.... I'd better do some more reading
and sort that bit!
> Bob Barrows
| |
| Anthony Jones 2006-03-25, 11:59 am |
|
"s_m_b" <smb20002ns@hotmail.com> wrote in message
news:Xns978F830A04145smb2000nshotrmailco
m@207.46.248.16...
> Using w2k advanced server (test system is standard server)
>
> "Set objXML = Server.CreateObject("MSXML2.FreeThreadedDOMDocument")
> objXML.async = False
> objXML.setProperty "ServerHTTPRequest", True
> objXML.Load
> ("http://news.bbc.co.uk/rss/newsonline_uk_edition/front_page/rss091.xml")
> If objXML.parseError.errorCode <> 0 Then
> 'Response.Write "<pre>" & vbCrLf
> Response.Write ("<strong>Error:</strong> " &
> objXML.parseError.reason )
> Select Case objXML.parseError.errorCode
> Case 0
> strResult = "Valid: " & strFileName & vbCr
> Case Else
> strResult = vbCrLf & "ERROR! Failed to validate " &
> vbCrLf & objXML.parseError.reason & vbCr & "Error code: " &
> objXML.parseError.errorCode & ", Line: " & objXML.parseError.line & ",
> Character: " & objXML.parseError.linepos & ", Source: " & Chr(34) &
> objXML.parseError.srcText & Chr(34) & " - " & Now & vbCrLf
> End Select
> Response.Write ("<strong>Line:</strong> " & objXML.parseError.line
> & vbCrLf)
> Response.Write ("<strong>Text:</strong> " & strResult)
> Server.HTMLEncode(objXML.parseError.srcText) & vbCrLf
> 'Response.Write "</pre>" & vbCrLf
> End If
>
> Set objItemList = objXML.getElementsByTagName("item")
> Set objXML = Nothing
> intcount = 0
> For Each objItem In objItemList
> intcount = intcount+1
> ' childNodes: 0=title, 2=link, 1=description
> Response.Write ("<p>» " & vbLf)
> Response.Write ("<a href=""" & objItem.childNodes(2).text & """
> target = ""bbcnews"">" & vbLf)
> Response.Write (objItem.childNodes(0).text & "</a><br />
> " & vbLf)
> response.write ("<span style=""font-style:italic"">" &
> objItem.childNodes(1).text & "</span>" & vbLf)
> Response.Write ("</p>" & vbCrLf)
> if intcount > 1 then exit for
> Next"
>
> Is there any way to get the raw feed from the XML, no matter what the
> error comes back as. I'm currently getting 'invalid response' with an
> error code of :-2147012744, which I can't find, but understand to be a
> nonespecific HTTP error.
-2147012744 This is better viewed as hex:- 80072F78
The top bit tells you it's an error code (helpful huh?)
The 7 tells you the error is a Windows API error.
2F78 is the windows API error number
converting back to Decimal is:- 12152
This turns out to be:-
ERROR_WINHTTP_INVALID_SERVER_RESPONSE
12152
The server response could not be parsed.
IOW, there was a successful connection but the headers (if any) returned by
the server failed to parse correctly.
Is there a proxy server that web browsers normally use where you are?
| |
| s_m_b 2006-03-25, 11:59 am |
| "Anthony Jones" <Ant@yadayadayada.com> wrote in
news:#Jd6cJpTGHA.5552@TK2MSFTNGP14.phx.gbl:
>
> "s_m_b" <smb20002ns@hotmail.com> wrote in message
> news:Xns978F830A04145smb2000nshotrmailco
m@207.46.248.16...
>
> -2147012744 This is better viewed as hex:- 80072F78
>
> The top bit tells you it's an error code (helpful huh?)
> The 7 tells you the error is a Windows API error.
>
> 2F78 is the windows API error number
> converting back to Decimal is:- 12152
>
> This turns out to be:-
>
> ERROR_WINHTTP_INVALID_SERVER_RESPONSE
> 12152
> The server response could not be parsed.
>
> IOW, there was a successful connection but the headers (if any)
> returned by the server failed to parse correctly.
>
> Is there a proxy server that web browsers normally use where you are?
>
>
>
>
Ah. That's interesting.
We have a proxy, but I've used proxycfg to tell the server to bypass it for
internal hosts/addresses - the feed that's giving me grief is actually on
the same server.
The test server I mentioned works fine.
The example feed above (BBC) works perfectly.
This is kind of intriguing, since I tried to use my RSS reader (feeddemon)
to test out the local feed, and it can't connect either. However, I can
view the XML via my browser.
|
|
|
|
|