Hello Experts,
I have installed a Moodle 2.0 RC1 environment and am currently testing the Moodle core web services.
Hereby, I am encountering the following difficulty when calling the web services function moodle_course_create_courses to create a course.
The call returns:
array(2) {
["faultcode"]=>
string(8) "Receiver"
["faultstring"]=>
string(63) "Invalid external api parameter: courses (Only arrays accepted.)"
}
My test program looks as follows:
<?php
require_once 'nusoap-0.9.5/lib/nusoap.php';
$url = 'http://moodleserver/moodle20/webservice/soap/server.php?wstoken=kdxgjkfdihgtritrgirgk&wsdl=1';
$soap_client = new nusoap_client($url, true, false, false, false, false, 120, 120);
$course_info = array(
"fullname" => "Test SSO created course" //full name
, "shortname" => "test_sso" //course short name
, "categoryid" => 1 //category id
, "summaryformat" => 0 // Default to "0" the summary text Moodle format
, "format" => "topics" // Default to "weeks" course format: weeks, topics, social, site,..
, "showgrades" => 0 // Default to "1" 1 if grades are shown, otherwise 0
, "newsitems" => 5 // Default to "5" number of recent items appearing on the course page
, "numsections" => 10 // Default to "10" number of weeks/topics
, "maxbytes" => 4294967296 // Default to "4294967296" largest size of file that can be uploaded into the course
, "showreports" => 0 // Default to "0" are activity report shown (yes = 1, no =0)
, "hiddensections" => 0 // Default to "0" How the hidden sections in the course are displayed to students
, "groupmode" => 0 // Default to "0" no group, separate, visible
, "groupmodeforce" => 0 // Default to "0" 1: yes, 0: no
, "defaultgroupingid" => 0 // Default to "0" default grouping id
);
$res = $soap_client->call('moodle_course_create_courses', array(0 => $course_info));
exit;
?>
I am using the latest release of nusoap, which we are using for other applications.
Also, I have been following the web services documentation.
My initial thought was that there is a problem with nusoap, but I couldn't find any reports on problems with nusoap + Moodle WS. Has anyone come across the same/similar problem?
Any ideas or comments are welcome.
Regards,
Anders