Solved

New ASP server, XML pages stopped working

Posted on 2006-07-17
9
361 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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
JSON error 4 71
PDF Embed pdfobject.js local path problem regular ASP 2 174
Executing a script on a timer online 5 20
JQuery Autocomplete Tag AJAX (Need nice script) 11 34
I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

839 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