Discussion:
MSXML 3 Replaced By MSXML6 - Help
(too old to reply)
Don Miller
2009-02-13 12:28:17 UTC
Permalink
For many reasons (that were discussed here in 2007 including using
XSLPatterns versus XPath), I have chosen to use MSXML 3.0 instead of 6.0
when I am interacting with SQL Server Reporting Services SOAP (the Prog ID I
use is MSXML2.DOMDocument.3.0 to parse and MSXML2.ServerXMLHTTP.6.0 to send
the request)

Everything was fine up until I upgraded my SQL Server 2005 yesterday, and I
inadvertently chose an option to install MSXML 6.0 during the upgrade. It
seems that my 3.0 code doesn't work anymore and I get the error "Object
required: 'xmldoc.documentElement'" where I use (Classic ASP) set xmldoc =
Server.CreateObject("MSXML2.DOMDocument.3.0") .

I thought that my 3.0 would still be there along with 6.0. So, I downloaded
and installed the Microsoft the XML Parser (MSXML) 3.0 Service Pack 7 (SP7)
and it still doesn't work! The only related programs I have in Add/Remove
Programs are MSXML 6 Service Pack 2 and SQLXML4. I found the MSXML.dll and
registered it and that didn't work either.

So, what's going on and how I can I go back to MSXML 3.0?

Thanks for any help!
Martin Honnen
2009-02-13 13:18:57 UTC
Permalink
Post by Don Miller
For many reasons (that were discussed here in 2007 including using
XSLPatterns versus XPath), I have chosen to use MSXML 3.0 instead of 6.0
when I am interacting with SQL Server Reporting Services SOAP (the Prog ID I
use is MSXML2.DOMDocument.3.0 to parse and MSXML2.ServerXMLHTTP.6.0 to send
the request)
Everything was fine up until I upgraded my SQL Server 2005 yesterday, and I
inadvertently chose an option to install MSXML 6.0 during the upgrade. It
seems that my 3.0 code doesn't work anymore and I get the error "Object
required: 'xmldoc.documentElement'" where I use (Classic ASP) set xmldoc =
Server.CreateObject("MSXML2.DOMDocument.3.0") .
I thought that my 3.0 would still be there along with 6.0.
MSXML 4, 5, 6 all install side by side to MSXML 3. Only MSXML 3 might
replace older version like 2.6. So installation of MSXML 6 can't change
or even remove your MSXML 3 installation.
The error must have different reasons. Can you give a clear description
of the error? Does
set xmldoc = Server.CreateObject("MSXML2.DOMDocument.3.0")
really not work any more?
But why would you get an error
Object required: 'xmldoc.documentElement'
for that line, that does not make sense, it rather sounds as if the XML
you are trying to parse is not well-formed and therefore the xmldoc
object does not have a documentElement.
--
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Don Miller
2009-02-13 13:50:39 UTC
Permalink
Thanks for the quick reply. You've helped me a lot back in 2007 and I'm in
the soup now (and my once meager facility with XML, SOAP, SQL Server RS, has
all left me). Basically what I did was use Classic ASP to communicate via
SOAP with Reporting Services (not an easy thing to do at the time).

Anyway, you're right about the error message. If it couldn't find MSXML 3.0
it should have had the error "Server.CreateObject Failed". I confirmed this
when I replaced the code to use 6.0 and the same error occurred.

I'm wondering why a SQL Server SP3 upgrade would have anything to do with
this, unless they changed their SOAP response format or permissions or
???????

Any thoughts would be welcome. Thanks.

The part of the code I used is below, getNodeText is called first,
theResponse is from a SOAP request (e.g. xmlobject.responseBody). I do have
error checking and reporting but this seems to bypass all of this (ASP
actually catches the error as a Microsoft VBScript runtime error).

Function getNodeObject(theResponse, xslPattern)
'if using 6.0 HAVE to use XPath instead of XSLPatterns
'and would HAVE to include namespaces and prefixes in the xpath
'for nodes associated with namespaces
Dim xmldoc
set xmldoc = Server.CreateObject("MSXML2.DOMDocument.3.0")
xmldoc.load(theResponse)
set getNodeObject =
xmldoc.documentElement.selectSingleNode(xslPattern)
set xmldoc = nothing
End Function

Function getNodeText(theResponse, xslPattern)
Dim node
set node = getNodeObject(theResponse, xslPattern)
if NOT (node is nothing) then
getNodeText = node.text
set node = nothing
else
getNodeText = errorMsg
end if
End Function
Post by Martin Honnen
Post by Don Miller
For many reasons (that were discussed here in 2007 including using
XSLPatterns versus XPath), I have chosen to use MSXML 3.0 instead of 6.0
when I am interacting with SQL Server Reporting Services SOAP (the Prog
ID I use is MSXML2.DOMDocument.3.0 to parse and MSXML2.ServerXMLHTTP.6.0
to send the request)
Everything was fine up until I upgraded my SQL Server 2005 yesterday, and
I inadvertently chose an option to install MSXML 6.0 during the upgrade.
It seems that my 3.0 code doesn't work anymore and I get the error
"Object required: 'xmldoc.documentElement'" where I use (Classic ASP) set
xmldoc = Server.CreateObject("MSXML2.DOMDocument.3.0") .
I thought that my 3.0 would still be there along with 6.0.
MSXML 4, 5, 6 all install side by side to MSXML 3. Only MSXML 3 might
replace older version like 2.6. So installation of MSXML 6 can't change or
even remove your MSXML 3 installation.
The error must have different reasons. Can you give a clear description of
the error? Does
set xmldoc = Server.CreateObject("MSXML2.DOMDocument.3.0")
really not work any more?
But why would you get an error
Object required: 'xmldoc.documentElement'
for that line, that does not make sense, it rather sounds as if the XML
you are trying to parse is not well-formed and therefore the xmldoc object
does not have a documentElement.
--
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Martin Honnen
2009-02-13 14:05:08 UTC
Permalink
Post by Don Miller
Function getNodeObject(theResponse, xslPattern)
'if using 6.0 HAVE to use XPath instead of XSLPatterns
'and would HAVE to include namespaces and prefixes in the xpath
'for nodes associated with namespaces
Dim xmldoc
set xmldoc = Server.CreateObject("MSXML2.DOMDocument.3.0")
Add an
xmldoc.async = False
here
Post by Don Miller
xmldoc.load(theResponse)
then check
xmldoc.parseError.errorCode
xmldoc.parseError.reason
here
--
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Don Miller
2009-02-13 15:25:34 UTC
Permalink
Sorry to waste your time. It's a frickin' RS/IIS permissions problem (and my
xml parsing and error checking was not so great). But I would be interested
in how I could catch this error in the future (after 4 hours focusing on
XML - now probably another 4+ dealing with permissions

When I got a response back from the RS web services it was an html page (You
are not authorized to view this page. HTTP Error 401.2 - Unauthorized:
Access is denied due to server configuration. Internet Information Services
(IIS)), I was always looking for specific XSLPatterns (e.g. //ErrorCode) in
code like nodeObject = xmldoc.documentElement.selectSingleNode(xslPattern)
and expecting to get "nothing" back if the pattern was not found. See code
again below.

When I put in the code you suggested I get back an error "-2146697209:No
data is available for the requested resource." I would only get this back
when I returned "nothing" to trigger error reporting, but when I used the
"selectSingleNode" method I would get the previous "Object required:
'xmldoc.documentElement'" VBScript error. So, it appears that
selectSingleNode throws a vbscript error rather than returning nothing???

Any thoughts? And thanks again.

Function getNodeObject(theResponse, xslPattern)
'if using 6.0 HAVE to use XPath instead of XSLPatterns
'and would HAVE to include namespaces and prefixes in the xpath
'for nodes associated with namespaces
Dim xmldoc
set xmldoc = Server.CreateObject("MSXML2.DOMDocument.3.0")
xmldoc.async = False
xmldoc.load(theResponse)
errorMsg = xmldoc.parseError.errorCode & ":" & xmldoc.parseError.reason
'set getNodeObject = nothing
set getNodeObject =
xmldoc.documentElement.selectSingleNode(xslPattern)
set xmldoc = nothing
End Function

Function getNodeText(theResponse, xslPattern)
Dim node
set node = getNodeObject(theResponse, xslPattern)
if NOT (node is nothing) then
getNodeText = node.text
set node = nothing
else
getNodeText = errorMsg
end if
End Function
Post by Martin Honnen
Post by Don Miller
Function getNodeObject(theResponse, xslPattern)
'if using 6.0 HAVE to use XPath instead of XSLPatterns
'and would HAVE to include namespaces and prefixes in the xpath
'for nodes associated with namespaces
Dim xmldoc
set xmldoc = Server.CreateObject("MSXML2.DOMDocument.3.0")
Add an
xmldoc.async = False
here
Post by Don Miller
xmldoc.load(theResponse)
then check
xmldoc.parseError.errorCode
xmldoc.parseError.reason
here
--
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Martin Honnen
2009-02-13 15:42:22 UTC
Permalink
Post by Don Miller
Function getNodeObject(theResponse, xslPattern)
'if using 6.0 HAVE to use XPath instead of XSLPatterns
'and would HAVE to include namespaces and prefixes in the xpath
'for nodes associated with namespaces
Dim xmldoc
set xmldoc = Server.CreateObject("MSXML2.DOMDocument.3.0")
xmldoc.async = False
xmldoc.load(theResponse)
errorMsg = xmldoc.parseError.errorCode & ":" & xmldoc.parseError.reason
'set getNodeObject = nothing
set getNodeObject =
xmldoc.documentElement.selectSingleNode(xslPattern)
The problem is that there is no documentElement when there is a parse
error so xmldoc.documentElement is nothing and you can't call
selectSingleNode or any method on nothing.
Depending on the expression you are passing to selectSingleNode you
might simply be able to use
set getNodeObject = xmldoc.selectSingleNode(xslPattern)
instead.
--
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Don Miller
2009-02-13 16:04:15 UTC
Permalink
This just gets deeper and deeper ;)

Using "xmldoc.selectSingleNode(xslPattern)" instead of
"xmldoc.selectSingleNode(xslPattern)" does get rid of the VBscript error
(but I don't know how it will work with real data whenever I figure out the
permissions issue).

When I make that change, I now get my error messages as originally planned
and the one I receive is "2146697209:No
data is available for the requested resource." However when I Googled that
error, there was a MS PRB (http://support.microsoft.com/kb/281142) and when
I did as they suggested

set xmldoc = Server.CreateObject("MSXML2.DOMDocument.3.0")
xmldoc.async = False
xmldoc.setProperty "ServerHTTPRequest", true
xmldoc.load(theResponse)

I still got an error, but this time it said "-1072896758:The character '>'
was expected." I guess MS warning pages are not well-formed.
Post by Martin Honnen
Post by Don Miller
Function getNodeObject(theResponse, xslPattern)
'if using 6.0 HAVE to use XPath instead of XSLPatterns
'and would HAVE to include namespaces and prefixes in the xpath
'for nodes associated with namespaces
Dim xmldoc
set xmldoc = Server.CreateObject("MSXML2.DOMDocument.3.0")
xmldoc.async = False
xmldoc.load(theResponse)
errorMsg = xmldoc.parseError.errorCode & ":" & xmldoc.parseError.reason
'set getNodeObject = nothing
set getNodeObject =
xmldoc.documentElement.selectSingleNode(xslPattern)
The problem is that there is no documentElement when there is a parse
error so xmldoc.documentElement is nothing and you can't call
selectSingleNode or any method on nothing.
Depending on the expression you are passing to selectSingleNode you might
simply be able to use
set getNodeObject = xmldoc.selectSingleNode(xslPattern)
instead.
--
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Continue reading on narkive:
Loading...