Hi Aaron,

Feel free to create a jira issue at http://jira.xwiki.org if you think it’s 
important that getURLContent() supports HTTPS. This can be done since under the 
hood we’re using Http Client and it supports HTTPS.  

Thanks  
-Vincent

On 16 Sep 2015 at 01:01:41, Aaron Hardy at AC 
(ashtarcommunicati...@gmail.com(mailto:ashtarcommunicati...@gmail.com)) wrote:

> Yep, that's it. Changed it to HTTP and it worked fine. I must have changed 
> the URL in otherwise working code at some point and forgotten about it. 
> Oddly, using https://google.com still works for me, but not using https with 
> my actual API URL. Either way, good to know that HTTPS isn't supported.  
>  
> Thanks much for the help,  
>  
> aaron  
>  
> On Tue, Sep 15, 2015 at 6:02 PM, 
> vinc...@massol.net(mailto:vinc...@massol.net) wrote:
> > Hi Aaron,
> >  
> > On 15 Sep 2015 at 19:12:06, Aaron Hardy at AC 
> > (ashtarcommunicati...@gmail.com(mailto:ashtarcommunicati...@gmail.com)(mailto:ashtarcommunicati...@gmail.com))
> >  wrote:
> >  
> > > I've updated that playground page with the actual URL of the API I'm 
> > > using - you'll see that the page comes back blank, but if you follow the 
> > > link in the browser, you get a page full of XML. So there must be 
> > > something about the data that the API is returning that XWiki doesn't 
> > > like?  
> >  
> > This is because you’ve used HTTPS. If you use HTTP it works fine.
> >  
> > ATM getURLContent() doesn’t support HTTPS.
> >  
> > Thanks
> > -Vincent
> >  
> > > Agreed on using final releases - a full upgrade to 7.x is actually 
> > > planned soon. If I remember correctly, we got stuck on RC1 during the 
> > > last production upgrade cycle because there was some feature in 6.2 that 
> > > we really needed but the final release was still a few weeks out by our 
> > > deadline so we rolled the dice. Fortunately we haven't run into many 
> > > issues - which is probably why we're running behind on the upgrade :)
> > >
> > >
> > > On Tue, Sep 15, 2015 at 12:56 PM, 
> > > vinc...@massol.net(mailto:vinc...@massol.net)(mailto:vinc...@massol.net) 
> > > wrote:
> > > > Seems to be working fine on 
> > > > http://playground.xwiki.org/xwiki/bin/view/Main/Aaron
> > (http://playground.xwiki.org/xwiki/bin/view/Main/Aaron) > >
> > > >
> > > >
> > > > Maybe there was a problem specifically on 6.2RC1 (BTW better use some 
> > > > final releases…:)). I’d recommend 6.4.5 for the 6.x cycle.
> > > >
> > > > Thanks
> > > > -Vincent
> > > >
> > > >
> > > > On 15 Sep 2015 at 18:53:16, Aaron Hardy at AC 
> > > > (ashtarcommunicati...@gmail.com(mailto:ashtarcommunicati...@gmail.com)(mailto:ashtarcommunicati...@gmail.com))
> > > >  wrote:
> > > >
> > > > > Page syntax is XWiki 2.1 and the velocity is wrapped. Sorry, I didn't 
> > > > > include the full code for simplicity's sake. Here's a minimal example 
> > > > > cut and pasted from the editor (only thing changed is the actual URL):
> > > > >
> > > > > *******************************
> > > > > {{velocity}}
> > > > >
> > > > > #set($getURL = "https://www.example.com/api/example.mhtml?param=123";)
> > > > > $getURL
> > > > >
> > > > > #set($content = $xwiki.getURLContent($getURL))
> > > > > $content
> > > > >
> > > > > {{/velocity}}
> > > > >
> > > > > If I set $getURL to "https://google.com";, it prints $content to the 
> > > > > page. With my API URL, I get nothing but the link in $getURL. But if 
> > > > > I follow that link, I get the expected XML page from the API, so I 
> > > > > know the URL is working correctly.
> > > > >
> > > > > I figured it was because $content is XML from the API, and HTML from 
> > > > > google, but using $services.xml.parse on the response doesn't work 
> > > > > either.
> > > > >
> > > > > The strange part is that this is code that I haven't touched in quite 
> > > > > some time, and used to be working. The full code parses the XML 
> > > > > response and saves various elements to an HTML table on the page - 
> > > > > but it doesn't appear to be getting that far.
> > > > >
> > > > >
> > > > >
> > > > > On Tue, Sep 15, 2015 at 12:41 PM, 
> > > > > vinc...@massol.net(mailto:vinc...@massol.net)(mailto:vinc...@massol.net)
> > > > >  wrote:
> > > > > > Hi Aaron,
> > > > > >
> > > > > > On 15 Sep 2015 at 18:38:17, Aaron Hardy at AC 
> > > > > > (ashtarcommunicati...@gmail.com(mailto:ashtarcommunicati...@gmail.com)(mailto:ashtarcommunicati...@gmail.com)(mailto:ashtarcommunicati...@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
> > > > > >
> > > > >
> > >
> >  
>  
_______________________________________________
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users

Reply via email to