Link to home
Start Free TrialLog in
Avatar of Nicola-H
Nicola-H

asked on

New ASP server, XML pages stopped working

Hi

I've just switched my website to Fasthosts and all of my XML pages have stopped working - there's no error, but the content is not appearing.

This is the ASP code I'm using to pull the info from a live news feed:


 
set objXMLdoc = Server.CreateObject("Microsoft.XMLDOM")
set objXSL = Server.CreateObject("Microsoft.XMLDOM")
objXMLdoc.async = false
objXSL.async = false

select case strSearchType
      case "1"
            strXML = "http://www.fibre2fashion.com/tradefairs/rss/industry-fair.xml"
      case "2"
            strXML = "http://www.fibre2fashion.com/tradefairs/rss/fashion-show.xml"
      case "3"
            strXML = "http://www.fibre2fashion.com/tradefairs/rss/textile-events.xml"
end select

objXMLdoc.load(strXML)
objXSL.load(Server.MapPath("events_feed.xsl"))

strEvent = objXMLdoc.transformNode(objXSL)
strEvent = replace(strEvent, "<tr>", "<tr>"&chr(13))
strEvent = Replace(strEvent, "<A", "<A target = ""_blank""")



Can anyone see what the problem is? Usually when something goes wrong with these pages I get an error message, but the 'strEvent' variable that usually contains the content just has nothing in it.
Avatar of Carl Tawn
Carl Tawn
Flag of United Kingdom of Great Britain and Northern Ireland image

For debugging purposes try changing:

    objXMLdoc.load(strXML)
    objXSL.load(Server.MapPath("events_feed.xsl"))

To:

   If Not objXMLdoc.load(strXML) Then
        Response.Write "XML Error: " & objXMLdoc.parseError.reason & "<br />"
   End If

   If Not objXSL.load(Server.MapPath("events_feed.xsl")) Then
        Response.Write "XSL Error: " & objXSL.parseError.reason & "<br />"
   End If
Avatar of Nicola-H
Nicola-H

ASKER

Good start - thanks :-) I now get this error:

"XML Error: No data is available for the requested resource."

Do I perhaps need to change something in my XSL file? It all still works fine on the old server. This is my XSL file:



<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
      <xsl:template match="copyright|ttl|image|language|lastBuildDate">
      <!-- Empty template to remove all the Google header information from the feed -->      
      </xsl:template>
      <xsl:template match="item">
            <xsl:apply-templates select="title"/>
            <xsl:apply-templates select="description"/>
            <xsl:apply-templates select="link"/>
      </xsl:template>
      <xsl:template match="title">
            <xsl:if test="not(contains(.,'Fibre2fashion')) and not(contains(., 'fibre2fashion') and not(contains(., 'Fur')))">
                  <span style="color:#000066;font-weight: bold;color:#cc3333;">
                  <xsl:value-of select="."/></span>
                  <br />
            </xsl:if>
      </xsl:template>
      <xsl:template match="description">
            <xsl:if test="not(contains(.,'Fibre2fashion')) and not(contains(., 'fibre2fashion'))">
                  <span style="color:#006666">
                  <xsl:value-of select="." disable-output-escaping="yes" /></span><br />
            </xsl:if>
      </xsl:template>
      <xsl:template match="link">
            <xsl:if test="not(contains(.,'buyersguide')) and not(contains(., 'bodywear2006')) and contains(., 'show_code')">
                  <span style="color:#000066;font-weight: bold;color:#cc3333;">
                        <A>
                        <xsl:attribute name="href">
                        <xsl:value-of select="."/>
                        </xsl:attribute>
                        Click here for more details...
                     </A>
                  </span>
                  <br /><br />
            </xsl:if>
      </xsl:template>
</xsl:stylesheet>
If you're getting "XML Error" then that means there is a problem loading the XML file, rather than the XSL.

That means there is a problem retrieving the XML from the URL specified. First thing to check is the value of "strSearchType" to check which, if any, of the URL's it is trying to go to. Once you find out which URL it is try navigating to that URL in your browser to check that the XML is available.
I've done that, and it looks fine. You can click on the links in the original question above and see what it's trying to access. I haven't changed the code at all between the two servers so they are both using the same URLs to get the XML content.
ASKER CERTIFIED SOLUTION
Avatar of Carl Tawn
Carl Tawn
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
It didn't like that jazzy HTTP stuff:

msxml4.dll error 'c00ce23b'
WINHTTP5.DLL or higher must be registered to use the ServerXMLHTTP object.
/news/xml_events.asp, line 56

I can't see why the hosting company would block requests like that - I've set up similar stuff before but using someone else's PHP code, so it should be possible. I have a site using product feeds from Amazon somewhere.

I'd phone them and ask but they want to charge me £1 a minute :-D

Home time... I'll have another look at this in the morning.
It sounds like their libraries are out of date. WinHTTP5.1 has been out for quite some time.
I don't think there's a lot I can do about that. I will drop their support people a line, but does this explain why the original code wasn't working?
Turns out it wasn't my code... the support people sent me an email saying they couldn't replicate the error 2 minutes after they'd fixed it. Both sets of code now work so you were right, the silly blighters were blocking the request. Thanks for your time :-)