You need to sign in to do that
Don't have an account?
Richie D
Pagereference call outs not working
Hi Developers,
According the the documentation (and my memory) the following should work:-
PageReference ref = new PageReference('http://www.google.com'); Blob b = ref.GetContent();
Why are we getting the following error upon execution of the getContent() method?
System.VisualforceException: java.net.NoRouteToHostException: No route to host
This error (seems to )occur for all urls other than Salesforce! (http://www.salesforce.com, https://cs7.salesforce.com are ok).
Thanks for any help.
Rich.
Putting an entry (for "http://www.google.com" here and for any external site you want to hit ),in "Remote Site Settings" under "Security Controls" may resolve the issue. Hope this helps.
Have already done this and doesn't help any.
Thanks for your suggestion - other users may find it useful.
Cheers,
Rich.
Hi Salesforce,
We have same issues actually.
In sandbox, that pagereference does not work.
But in Developer instances, that works fine. We have tried 2 developer instances. Both work.
Hi Jia,
If you execute those code lines below in developer console straight way without controller, any instance can do that successfully.
If you put them in a controller and run that controller, all fail except developer instances.
I think that is salesforce server side bug related to java frame expecially for call out, because if you fetch a document or an attachment in SF using that way, it will work.
-------------------------------------------------------------------------------
String thestr = 'http://www.google.com';
PageReference page= new PageReference(thestr);
Blob p = page.getContent();
Through Execute Anonymous directly, you may get errors.
unfortunately, I use VF page. but still same error
java.net.NoRouteToHostException: No route to host
An unexpected error has occurred. Your development organization has been notified.