Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-29276 META- Web service improvements for 2.2
  3. MDL-29277

Making the exception message during return values validation more explicit (and also during parameter validation)

    XMLWordPrintable

Details

    • Sub-task
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 2.0, 2.1
    • 2.2
    • Web Services
    • MOODLE_20_STABLE, MOODLE_21_STABLE
    • MOODLE_22_STABLE
    • Hide

      Set debug mode to 'developer'. MDL-29435 must be fixed in order to test with SOAP/XMLRPC

      Error: wrong parameter primary type at 3rd level:
      ----------------------------------------------------------------------
      1- in user/externallib.php::create_users_parameters change "users>customfields>type": PARAM_ALPHANUMEXT for PARAM_INT.
      Call the function with the built-in REST client in the admin. Check that the error message let you know exactly where is the issue, what value is faulty, and what value were expected. Obviously you must have a customfield.

      Error: wrong response primary type at 3rd level (cannot be test with REST, REST server does not validate return value, see MDL-29459):
      -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      2- in user/externallib.php::get_users_by_id_returns change "customfields>type": PARAM_ALPHANUMEXT for PARAM_INT.
      Call the function with the built-in SOAP client in the admin. Check that the error message let you know exactly where is the issue, what value is faulty, and what value were expected. Obviously you must call a user that return a customfield.

      Error: send string, expecting array
      -------------------------------------------------
      3. Use the REST demo client: https://github.com/moodlehq/sample-ws-clients/tree/master/PHP-REST. Change this line

      $params = array('users' => '$users'); //previously $params = array('users' => $users);

      The error message should be clear where is the issue, telling you what value is wrong.

      Show
      Set debug mode to 'developer'. MDL-29435 must be fixed in order to test with SOAP/XMLRPC Error: wrong parameter primary type at 3rd level: ---------------------------------------------------------------------- 1- in user/externallib.php::create_users_parameters change "users>customfields>type": PARAM_ALPHANUMEXT for PARAM_INT. Call the function with the built-in REST client in the admin. Check that the error message let you know exactly where is the issue, what value is faulty, and what value were expected. Obviously you must have a customfield. Error: wrong response primary type at 3rd level (cannot be test with REST, REST server does not validate return value, see MDL-29459 ): ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 2- in user/externallib.php::get_users_by_id_returns change "customfields>type": PARAM_ALPHANUMEXT for PARAM_INT. Call the function with the built-in SOAP client in the admin. Check that the error message let you know exactly where is the issue, what value is faulty, and what value were expected. Obviously you must call a user that return a customfield. Error: send string, expecting array ------------------------------------------------- 3. Use the REST demo client: https://github.com/moodlehq/sample-ws-clients/tree/master/PHP-REST . Change this line $params = array('users' => '$users'); //previously $params = array('users' => $users); The error message should be clear where is the issue, telling you what value is wrong.

    Description

      Making the exception message of "invalid return value" more explicit too - at least knowing which attribut of the return value is concerned.

      Attachments

        Issue Links

          Activity

            People

              jerome Jérôme Mouneyrac
              jerome Jérôme Mouneyrac
              Aparup Banerjee Aparup Banerjee
              Sam Hemelryk Sam Hemelryk
              Aparup Banerjee Aparup Banerjee
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                5/Dec/11