ols2
asked on
using asp and Microsoft.XMLDOM
Hi,
I have a code snippet, like this:
<%
set xml = Server.CreateObject("Micro soft.XMLDO M")
xml.async = false
xml.load("http://popit.inpoc.com/popit.inpoc.com/xml_pull.vsp?type=P&size=10")
set xsl = Server.CreateObject("Micro soft.XMLDO M")
xsl.async = false
xsl.load("http://www.popit.no/html_new/html/sms/xml/ringtones.xsl")
Response.Write(xml.transfo rmNode(xsl ))
Set objXML = Nothing
%>
It all works briliantly, up to apoint, when it stops working all together.
The asp pages just loads and loads, and nothing happens, until i reboot the server.
I use iis5
I have a code snippet, like this:
<%
set xml = Server.CreateObject("Micro
xml.async = false
xml.load("http://popit.inpoc.com/popit.inpoc.com/xml_pull.vsp?type=P&size=10")
set xsl = Server.CreateObject("Micro
xsl.async = false
xsl.load("http://www.popit.no/html_new/html/sms/xml/ringtones.xsl")
Response.Write(xml.transfo
Set objXML = Nothing
%>
It all works briliantly, up to apoint, when it stops working all together.
The asp pages just loads and loads, and nothing happens, until i reboot the server.
I use iis5
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ya welcome! glad to be helpful.
peace
alambres
peace
alambres
ASKER
Oh sorrow, it is back!!!!
my code now look like this:
<%
set xml = Server.CreateObject("Micro soft.XMLDO M")
xml.async = false
xml.load("http://popit.inpoc.com/popit.inpoc.com/xml_pull.vsp?type=JAVA&size=3")
set xsl = Server.CreateObject("Micro soft.XMLDO M")
xsl.async = false
xsl.load("http://www.popit.no/html_new/html/sms/xml/topgames.xsl")
Response.Write(xml.transfo rmNode(xsl ))
set xml = nothing
set xsl = nothing
%>
After running the code for a number of times, it just loads, and nothing happens. The onlu solution is, again to reboot the box.
I am becoming suicidal! Help !! Anyone????
my code now look like this:
<%
set xml = Server.CreateObject("Micro
xml.async = false
xml.load("http://popit.inpoc.com/popit.inpoc.com/xml_pull.vsp?type=JAVA&size=3")
set xsl = Server.CreateObject("Micro
xsl.async = false
xsl.load("http://www.popit.no/html_new/html/sms/xml/topgames.xsl")
Response.Write(xml.transfo
set xml = nothing
set xsl = nothing
%>
After running the code for a number of times, it just loads, and nothing happens. The onlu solution is, again to reboot the box.
I am becoming suicidal! Help !! Anyone????
I don't see what's wrong in ya code. Maybe the problem is the server configuration
ASKER
Now, i have found that emediately before things go kaplooey, i receive this error:
Microsoft VBScript runtime error '800a01fb'
An exception occurred: 'xml.load'
/html_new/html/sms/xml/sms _2_copy(1) .asp, line 4
Haven't seen this before, probably because someone else on the site got it first.
Ring any bells?
Microsoft VBScript runtime error '800a01fb'
An exception occurred: 'xml.load'
/html_new/html/sms/xml/sms
Haven't seen this before, probably because someone else on the site got it first.
Ring any bells?
ASKER
The new development is:
I can access the file 21 times.
On the 22 time:
Microsoft VBScript runtime error '800a01fb'
An exception occurred: 'xml.load'
/html_new/html/sms/xml/sms _2_copy(1) .asp, line 4
I am baffled......
I can access the file 21 times.
On the 22 time:
Microsoft VBScript runtime error '800a01fb'
An exception occurred: 'xml.load'
/html_new/html/sms/xml/sms
I am baffled......
It's an easy fix. There are bugs with HTTP access on the server with that old version of the parser. Use this instead:
<%
set xml = Server.CreateObject("Msxml 2.DomDocum ent")
xml.async = false
xml.setProperty "ServerHTTPRequest", true
xml.load("http://popit.inpoc.com/popit.inpoc.com/xml_pull.vsp?type=JAVA&size=3")
set xsl = Server.CreateObject("Msxml 2.DomDocum ent")
xsl.async = false
xsl.setProperty "ServerHTTPRequest", true
xsl.load("http://www.popit.no/html_new/html/sms/xml/topgames.xsl")
xml.transformNodeToObject xsl, Response
set xml = nothing
set xsl = nothing
%>
See:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsdk30/htm/xmpro2nd_serverhttprequest.asp
You should not use Microsoft.XMLDOM on the server at all, and expecially when attempting to load over HTTP. MSXML 3 (which is "Msxml2.DomDocument:) won't even try to use HTTP for a load on the server, unless you set the ServerXMLHTTP.
Also, note my use of the transformNodeToObject method. This uses IStream; it's faster than strings/response.write and safer since it preserves the encoding.
Regards,
Mike Sharp
<%
set xml = Server.CreateObject("Msxml
xml.async = false
xml.setProperty "ServerHTTPRequest", true
xml.load("http://popit.inpoc.com/popit.inpoc.com/xml_pull.vsp?type=JAVA&size=3")
set xsl = Server.CreateObject("Msxml
xsl.async = false
xsl.setProperty "ServerHTTPRequest", true
xsl.load("http://www.popit.no/html_new/html/sms/xml/topgames.xsl")
xml.transformNodeToObject xsl, Response
set xml = nothing
set xsl = nothing
%>
See:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsdk30/htm/xmpro2nd_serverhttprequest.asp
You should not use Microsoft.XMLDOM on the server at all, and expecially when attempting to load over HTTP. MSXML 3 (which is "Msxml2.DomDocument:) won't even try to use HTTP for a load on the server, unless you set the ServerXMLHTTP.
Also, note my use of the transformNodeToObject method. This uses IStream; it's faster than strings/response.write and safer since it preserves the encoding.
Regards,
Mike Sharp
By the way, if you have MSXML 4 on the server, use it instead. It's even faster than MSXML 3.
set xml = Server.CreateObject("Msxml 2.DomDocum ent.4.0")
If the XSL file is on the same server that your ASP is on, use the Server.MapPath method to load:
xsl.load(Server.MapPath("/ html_new/h tml/sms/xm l/topgames .xsl"))
or whatever relative virtual path you need to point to the XSLT. If the XSL is on another site, then do it as my example before.
Make sure your XSLT uses the current namespace, too. Microsoft.XMLDOM is very old, non conforming and buggy.
Regards,
Mike Sharp
set xml = Server.CreateObject("Msxml
If the XSL file is on the same server that your ASP is on, use the Server.MapPath method to load:
xsl.load(Server.MapPath("/
or whatever relative virtual path you need to point to the XSLT. If the XSL is on another site, then do it as my example before.
Make sure your XSLT uses the current namespace, too. Microsoft.XMLDOM is very old, non conforming and buggy.
Regards,
Mike Sharp
Thank you all for discussion this matter, it has solved my problem.
I have tried to solve the problem by using MSXML4 with no success.
The problem was actually solved when I used MSXML 3 instead of MSXML 4, that is:
set xml = Server.CreateObject("Msxml 2.DomDocum ent")
instead of
set xml = Server.CreateObject("Msxml 2.DomDocum ent.4.0")
I experienced that loading one URL worked in MSXML4 and another did not. They both worked with MSXML3...weird, eh?
/Christian
I have tried to solve the problem by using MSXML4 with no success.
The problem was actually solved when I used MSXML 3 instead of MSXML 4, that is:
set xml = Server.CreateObject("Msxml
instead of
set xml = Server.CreateObject("Msxml
I experienced that loading one URL worked in MSXML4 and another did not. They both worked with MSXML3...weird, eh?
/Christian
Yes, that's quite weird.
Mike
Mike
ASKER
*blushing* oh well......
Thankyew !