Hi,
I am trying to consume the service core_course_search_courses, which was working well for version 3.0 but not working as per my expecting for version 3.2.
$function_name = 'core_course_search_courses';
$course['criterianame'] = 'search';
$course['criteriavalue'] = 'AEE4_P2_2015';
$token = 'xxxxxxxxxxxxxxxxxxxx';
$domainname = 'http://xxxxxxxxxxxxx';
$serverurl = $domainname . '/webservice/soap/server.php'. '?wsdl=1&wstoken=' . $token;
$xml = simplexml_load_file($serverurl);
$faulcode = $xml->xpath('/SOAP-ENV:Envelope/SOAP-ENV:Body/SOAP-ENV:Fault/faultcode');
if (!empty($faulcode[0]))
{
$faultcode = (array) $faulcode[0];
print_r($faultcode[0]);
$faultstring = $xml->xpath('/SOAP-ENV:Envelope/SOAP-ENV:Body/SOAP-ENV:Fault/faultstring');
if (!empty($faultstring[0]))
{
$faultstring = (array) $faultstring[0];
print_r('<BR/>');
print_r($faultstring[0]);
}
die();
}
$client = new SoapClient($serverurl);
try
{
$resp = $client->__soapCall($functionname, $params);
}
catch (Exception $e)
{
print_r($e);
}
if (isset($resp))
{
return $resp;
}
When the above code is executed, it gives the following output
SoapFault Object ( [message:protected] => Invalid parameter value detected | ERRORCODE: invalidparameter [string:Exception:private] => [code:protected] => 0 [file:protected] => /var/www/html/moodle/myservices/test/SoapCall_1.php [line:protected] => 35 [trace:Exception:private] => Array ( [0] => Array ( [file] => /var/www/html/moodle/myservices/test/SoapCall_1.php [line] => 35 [function] => __soapCall [class] => SoapClient [type] => -> [args] => Array ( [0] => core_course_search_courses [1] => Array ( [criterianame] => search [criteriavalue] => AEE4_P2_2015 ) ) ) [1] => Array ( [file] => /var/www/html/moodle/myservices/test/lib/CreateCourse.php [line] => 19 [function] => SoapCall1 [args] => Array ( [0] => core_course_search_courses [1] => Array ( [criterianame] => search [criteriavalue] => AEE4_P2_2015_Samabula ) ) ) [2] => Array ( [file] => /var/www/html/moodle/myservices/test/Server.php [line] => 28 [function] => checkCourse [args] => Array ( [0] => AEE4_P2_2015 ) ) ) [previous:Exception:private] => [faultstring] => Invalid parameter value detected | ERRORCODE: invalidparameter [faultcode] => Receiver [faultactor] => invalidparameter [detail] => requiredcapabilities => Invalid parameter value detected: Only arrays accepted. The bad value is: '' )
Can you assist me in identifying what am I doing wrong here
Thanks
Sanjay