Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Sep 05, 2014 @ 11:27
    Jan Skovgaard
    0

    umbraco.library:GetDocumentByUrl() not working in live environment - Umbraco 4.7.2

    Hi guys

    I'm struggling with something I find really really weird.

    We're using the umbraco.library:GetDocumentByUrl() extension to fetch some XML from a Google site search. And it's working fine on my local setup and on our staging setup.

    The XSLT snippet looks like this

    <xsl:variable name="result" select="umbraco.library:GetDocumentByUrl('http://www.domain.com/?alttemplate=XmlProxy&action=googlesearch&q=traffic')"/>
    

    However it's throwing errors on the live site. When trying to debug I get the following in the tracelog. I have checked and there does not seem to be any whitespace at all even though it says something about it (Have just skimmed it to be honest)

    umbracoMacro InnerException An error occurred during a call to extension function 'GetXmlDocumentByUrl'. See InnerException for a complete description of the error. An error occurred during a call to extension function 'GetXmlDocumentByUrl'. See InnerException for a complete description of the error. at System.Xml.Xsl.Runtime.XmlExtensionFunction.Invoke(Object extObj, Object[] args) at System.Xml.Xsl.Runtime.XmlQueryContext.InvokeXsltLateBoundFunction(String name, String namespaceUri, IList1[] args) at System.Xml.Xsl.CompiledQuery.Query.<xsl:template match="/">(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator {urn:schemas-microsoft-com:xslt-debug}current, Double {urn:schemas-microsoft-com:xslt-debug}position, Double {urn:schemas-microsoft-com:xslt-debug}last, IList1 {urn:schemas-microsoft-com:xslt-debug}namespaces) in D:\Data\Web\Umbraco\4.7\CLIENT\Release\xslt\trafikplan\GoogleSiteSearch.xslt:line 28 at System.Xml.Xsl.CompiledQuery.Query.

    Any clues about what could be the culprit are highly appreciated - I suspect it may be something on the server but have no clue what it could be. Everything else is working fine and several sites are running from the same install.

  • Chriztian Steinmeier 2800 posts 8790 karma points MVP 8x admin c-trib
    Sep 05, 2014 @ 11:39
    Chriztian Steinmeier
    0

    Hi Jan,

    It complains about an EntityName:

    An error occurred while parsing EntityName. Line 3, position 106.

    The hard part is figuring out if it's an error in the document you're fetching or somewhere else.

    (The line you've pasted would actually throw a similar error in XSLT, since the ampersands are not escaped in the string - but I'm guessing that they got lost between copying and pasting here ...)

    What's in the document you're fetching? Any URLs - 'coz they would break if they're not properly escaped, which unfortunately is very common :-)

    /Chriztian

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Sep 05, 2014 @ 12:46
    Jan Skovgaard
    0

    Hi Chriztian

    Well, I forgot to alter the example above. In my code it is written as &

    But as I said. It's working locally and in our staging environment. It's just not working live.

    The funny thing is that we're using an identical approach on another client where it's working in all three environments...

    I stumbled upon this post about the same issue as well http://our.umbraco.org/forum/developers/xslt/11986-GetXmlDocumentByUrl-and-Proxy-issue

    But I'm not sure about setting up a proxy in the web.config though...

    /Jan

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Sep 05, 2014 @ 14:20
    Jan Skovgaard
    0

    Turns out that I need to hardcode the domain so it did not try to fetch from a subdomain but only the main domain. After that it worked...do'h! :)

    /Jan

  • Chriztian Steinmeier 2800 posts 8790 karma points MVP 8x admin c-trib
    Sep 05, 2014 @ 14:28
    Chriztian Steinmeier
    0

    Alright!

    So the response was probably a 404 or 403 then, which made it choke on some characters in that page?

    /Chriztian

Please Sign in or register to post replies

Write your reply to:

Draft