Solved

New ASP server, XML pages stopped working

Posted on 2006-07-17
9
356 Views
Last Modified: 2008-02-01
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.
0
Comment
Question by:Nicola-H
  • 5
  • 3
9 Comments
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 17122230
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
0
 
LVL 1

Author Comment

by:Nicola-H
ID: 17122284
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>
0
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 17122542
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.
0
 
LVL 1

Author Comment

by:Nicola-H
ID: 17122616
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.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 52

Accepted Solution

by:
Carl Tawn earned 200 total points
ID: 17122753
>> You can click on the links in the original question above and see what it's trying to access
Now why didn't I think of that ;)

In that case it sounds like either your host is blocking the outgoing request, or the other server is blocking the incoming request.

Just to test, try changing you loading code to:

    set objXMLdoc = Server.CreateObject("MSXML2.ServerXMLHTTP.4.0")
    set objXSL = Server.CreateObject("Microsoft.XMLDOM")
    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.Open "POST", strXML, False
    objXMLdoc.Send

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

Author Comment

by:Nicola-H
ID: 17122816
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.
0
 
LVL 14

Expert Comment

by:CyrexCore2k
ID: 17125925
It sounds like their libraries are out of date. WinHTTP5.1 has been out for quite some time.
0
 
LVL 1

Author Comment

by:Nicola-H
ID: 17128413
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?
0
 
LVL 1

Author Comment

by:Nicola-H
ID: 17137510
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 :-)
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
This video discusses moving either the default database or any database to a new volume.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now