[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

New ASP server, XML pages stopped working

Posted on 2006-07-17
9
Medium Priority
?
367 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

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 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/…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

650 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