Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

New ASP server, XML pages stopped working

Posted on 2006-07-17
9
Medium Priority
?
368 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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 800 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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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.

Question has a verified solution.

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

I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?

864 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