Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-46054

parametercannotbevalueoptional error from core_user_get_users() via xmlrpc

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      Testing:

      For testing this issue we just need to do a XMLRPC web service call to any web service, I choose the forum:get_discussions

      Use this client: https://gist.github.com/jleyva/8d0978ec75011d9bcb94
      The curl.php file is here: https://github.com/moodlehq/sample-ws-clients/blob/master/PHP-REST/curl.php

      You need a token for the Mobile Service:
      Create Token:
      Click on Site administration ► Plugins ► Web services ► Manage tokens
      Click add, select user and service (Mobile Service)

      1 Create a new forum with a couple of discussions:
      2 Edit the client.php for adding your custom token and Moodle URL, also the forum instance id (the first element in the params array)
      4 Open the client script in a browser
      5 Check that you receive all the discussions you added in the FIRST RESPONSE section, and just one discussion in the SECOND RESPONSE (Note, in Moodle 2.6 you will receive all the responses since the get_discussions function doesn't support pagination for that version)

      Show
      Testing: For testing this issue we just need to do a XMLRPC web service call to any web service, I choose the forum:get_discussions Use this client: https://gist.github.com/jleyva/8d0978ec75011d9bcb94 The curl.php file is here: https://github.com/moodlehq/sample-ws-clients/blob/master/PHP-REST/curl.php You need a token for the Mobile Service: Create Token: Click on Site administration ► Plugins ► Web services ► Manage tokens Click add, select user and service (Mobile Service) 1 Create a new forum with a couple of discussions: 2 Edit the client.php for adding your custom token and Moodle URL, also the forum instance id (the first element in the params array) 4 Open the client script in a browser 5 Check that you receive all the discussions you added in the FIRST RESPONSE section, and just one discussion in the SECOND RESPONSE (Note, in Moodle 2.6 you will receive all the responses since the get_discussions function doesn't support pagination for that version)
    • Affected Branches:
      MOODLE_27_STABLE
    • Fixed Branches:
      MOODLE_26_STABLE, MOODLE_27_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-46054-master

      Description

      I have a service integration between an external system to moodle. The service utilizes the Charles Cook xml-rpc library to sync registration data between the registration system and moodle. After the Moodle instance was upgraded to version 2.7(Build: 20140522), moodle web services have started returning the following error when calling the core_user_get_user web service function:

      <?xml version="1.0" encoding="UTF-8"?>
      <methodResponse><fault><value><struct><member><name>faultCode</name><value><int>17038686</int></value></member><member><name>faultString</name><value><string>error/parametercannotbevalueoptional | ERRORCODE: parametercannotbevalueoptional</string></value></member></struct></value></fault></methodResponse>

      Our web service passes the StudentID to the method to determine if the student has already been created in moodle. StudentID services as the related field between the 2 systems. I have tried passing other fields to the moodle services to see if it was just this field that shows the issue, but I have been unable to get any response besides the error listed above.

      Here is the fiddler output of the request:

      <?xml version="1.0"?>
      <methodCall>
        <methodName>core_user_get_users</methodName>
        <params>
          <param>
            <value>
              <array>
                <data>
                  <value>
                    <struct>
                      <member>
                        <name>key</name>
                        <value>
                          <string>id</string>
                        </value>
                      </member>
                      <member>
                        <name>value</name>
                        <value>
                          <string>879</string>
                        </value>
                      </member>
                    </struct>
                  </value>
                </data>
              </array>
            </value>
          </param>
        </params>
      </methodCall>
      

      Is this a known issue or has there been a change in the way this method should be called? I didn't see any documentation updates that describe this error or any possible workaround.

      It should be noted that the external system has no knowledge of the internal moodle id of a student, so the studentID field is the most reliable means of relating profiles between the 2 systems.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                3 Vote for this issue
                Watchers:
                9 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  10/Nov/14