## Moodle for mobile

### wsAvailable function

Re: wsAvailable function

Hi,

it's in here:

Cheers,

Dani

Average of ratings: -
Re: wsAvailable function

thank you Dani, I found it.

I'm trying to integrate the plugin enrol/elediamultikeys mobile moodle, I made some changes already, but now when I made console.log (method.type) in the function getCourse(refresh) I get this error :

POST https://khabech.com/webservice/rest/server.php?moodlewsrestformat=json net::ERR_TIMED_OUT

can someone explain to me the meaning of the error and how to fix it ?

thank you

Average of ratings: -
Re: wsAvailable function

Hi,

it seems a WebService call is taking too long to respond, so it times out (the timeout is 30 seconds). You should check which WS call is being used (using the Network tab of the DevTools) and then investigate why is that call taking so much to respond.

Average of ratings: -
Re: wsAvailable function

Ok, thank you I understood, I think my connection was weak at that moment, now I have a question, in the request function in the file sitesfactory.js, with this part of the code exactly:

return $mmWS.call (method, data, wsPreSets) .then (function (response) { if (preSets.saveToCache) { console.log ("!!!!!! site.infos.functions ======="); console.log (site.infos.functions); saveToCache (site, method, data, response, preSets); } } I would like to add a function in the variable sites.infos.functions how to do that ?? thank you Average of ratings: - Re: wsAvailable function Hi, that's the list of WebServices available in your Moodle site. You should create a new WebService and include it in the Mobile service. In newer sites you can do that including this line in the declaration of the WebService: 'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE), Cheers, Dani Average of ratings: - Re: wsAvailable function thank you very much, that's exactly what I did, in the directory of the plugin, in the folder db, I created the file services that I pass you in attachment I was able to find the web service in Site Administration -> Plugins -> Web Services -> External Services as you can see in the attached image also, but the service does not load in the site.infos.functions. have you any explanation? thank's Average of ratings: - Re: wsAvailable function Hi, are you using the local_mobile plugin? If you do then you need to add that WS to the local_mobile service too. Please go to Site administration > Plugins > Web services > External services and click "Functions" in "Moodle mobile web service". Your WS should be listed in there. Cheers, Dani Average of ratings: - Re: wsAvailable function thank you very much, now I find my web service in site.infos.functions now i would like to understand from where is the variable method of the following function: angular.forEach(enrollmentMethods, function (method) { if (selfEnrolWSAvailable && method.type === 'self') {$Scope.selfEnrolInstances.push (method);

} else if (guestWSAvailable && method.type === 'guest') {

isGuestEnabled = true;

});

which is in the file /www/core/components/courses/controllers/viewresults.js gets its values ​​as method.type ?

thank you

Average of ratings: -