Hi Aaron,
On 15 Sep 2015 at 18:38:17, Aaron Hardy at AC
(ashtarcommunications@gmail.com(mailto:ashtarcommunications@gmail.com)) wrote:
XWiki 6.2RC1. I have some velocity code using
getURLContent() to access an
external API that appears to not be working after a server move, despite
working in the past.
Something like this used to work:
*****************************
#set($url = "https://www.example.com/api/example.mhtml?param=123")
#set($response = $xwiki.getURLContent($url))
#if ($response)
#set($tags = $services.xml.parse($response).getElementsByTagName('TAG'))
$tags.length
#end
*****************************
Now, $response appears to be empty (nothing appears when written to the
page). Going directly to the API URL returns properly formatted XML, so I
know the API itself is working. And changing $url to
http://google.com also
returns data.
Any ideas?
What is the syntax of your page? Are you sure it’s XWiki Syntax 2.0+ and you’re wrapping
the velocity content with the {{velocity}} macro for example (you didn’t show it in your
example).
$response is still there
Thanks
-Vincent
aaron