Quantcast
Channel: Web services
Viewing all articles
Browse latest Browse all 2364

Addning Course enrolment method through webservices.

$
0
0
by santosh Suwarnkar.  

Hi,

I have installed "Webservice functions for cohort enrolment" plug in to Add a cohort enrolment instance to a course.

I have implemented code for  "local_ws_enrolcohort_add_instance" function but for some cohorts its working and for some cohorts its showing below errors
Array
(
[faultCode] => 10648825
[faultString] => Object is not available at this context! | DEBUG INFO: Cohort with id 39 is not available at this context. | ERRORCODE: unavailableatcontext
)

Can any one please explain where is my mistake?


My Code -
/// SETUP - NEED TO BE CHANGED
$token = '41d74182154a8b8197d41730373faf16';
$domainname = 'http://redchipmoodle.in/noodlenow/';
$functionname = 'local_ws_enrolcohort_add_instance';

$params = new stdClass();
$params->courseid  = 6;
$params->cohortid = 42;
$params->roleid = 5;
/// XML-RPC CALL
$serverurl = $domainname . '/webservice/xmlrpc/server.php'. '?wstoken=' . $token;
require_once('curl.php');
$curl = new curl;
$curl->setHeader('Content-type: text/xml');
$post = xmlrpc_encode_request($functionname, array($params));
$resp = xmlrpc_decode($curl->post($serverurl, $post));
echo "<pre>";
print_r($resp);


Viewing all articles
Browse latest Browse all 2364

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>