issues with MSXML2.FreeThreadedDOMDocument

S

s_m_b

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>&raquo;&nbsp;" & vbLf)
Response.Write ("<a href=""" & objItem.childNodes(2).text & """
target = ""bbcnews"">" & vbLf)
Response.Write (objItem.childNodes(0).text & "</a><br />&nbsp;
&nbsp;&nbsp;" & 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.
 
B

Bob Barrows [MVP]

s_m_b said:
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/newsonline_uk_edition/front_page/rss091.xml)
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
 
S

s_m_b

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.

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!
 
A

Anthony Jones

s_m_b said:
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>&raquo;&nbsp;" & vbLf)
Response.Write ("<a href=""" & objItem.childNodes(2).text & """
target = ""bbcnews"">" & vbLf)
Response.Write (objItem.childNodes(0).text & "</a><br />&nbsp;
&nbsp;&nbsp;" & 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

s_m_b

-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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,152
Members
46,697
Latest member
AugustNabo

Latest Threads

Top