diff --git a/mod/lti/service.php b/mod/lti/service.php index be8e2d6..a98db23 100644 --- a/mod/lti/service.php +++ b/mod/lti/service.php @@ -106,7 +106,7 @@ switch ($messagetype) { $grade = lti_read_grade($ltiinstance, $parsed->userid); $responsexml = lti_get_response_xml( - isset($grade) ? 'success' : 'failure', + 'success', // Empty grade is also 'success' 'Result read', $parsed->messageid, 'readResultResponse' @@ -159,9 +159,13 @@ switch ($messagetype) { global $lti_web_service_handled; $lti_web_service_handled = false; - $event = \mod_lti\event\unknown_service_api_called::create($eventdata); - $event->set_legacy_data($eventdata); - $event->trigger(); + try { + $event = \mod_lti\event\unknown_service_api_called::create($eventdata); + $event->set_legacy_data($eventdata); + $event->trigger(); + } catch (Exception $e) { + $lti_web_service_handled = false; + } if (!$lti_web_service_handled) { $responsexml = lti_get_response_xml( diff --git a/mod/lti/servicelib.php b/mod/lti/servicelib.php index 7413211..2ce3731 100644 --- a/mod/lti/servicelib.php +++ b/mod/lti/servicelib.php @@ -49,6 +49,8 @@ function lti_get_response_xml($codemajor, $description, $messageref, $messagetyp $statusinfo->addChild('imsx_severity', 'status'); $statusinfo->addChild('imsx_description', $description); $statusinfo->addChild('imsx_messageRefIdentifier', $messageref); + $incomingtype = str_replace('Response','Request', $messagetype); + $statusinfo->addChild('imsx_operationRefIdentifier', $incomingtype); $xml->addChild('imsx_POXBody')->addChild($messagetype);