by Guybrush Threepwood.
I resolved this problem correcting permissions.
Our Moodle is hosted with IIS and Anonymous access is disabled.
I saw in IIS logs that the page used to download files (/webservice/pluginfile.php) is accessed anonymously.
Enabling Anonymous access on /webservice directory fixed it.