Details

    • Type: Sub-task Sub-task
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.0
    • Component/s: Web Services
    • Labels:
      None
    • Difficulty:
      Moderate
    • Affected Branches:
      MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE
    • Rank:
      35767

      Description

      Update Jamie's AMF Flex client to make it works for the new web service implementation in CVS (webservice/amf/testclient/)

      1. AMF_cast_object_fix.patch
        2 kB
        Jérôme Mouneyrac
      2. AMF patch for printed default value assigment.patch
        1 kB
        Jérôme Mouneyrac
      3. amfservicebrowser4.txt
        32 kB
        Jamie Pratt
      4. AMFTester.swf
        310 kB
        Jamie Pratt
      5. defaultparams.txt
        3 kB
        Jamie Pratt
      1. testclientscreenshot.JPG
        75 kB

        Issue Links

          Activity

          Hide
          Jérôme Mouneyrac added a comment -

          Hi Jamie, I assigned this to you because you did the previous Flex client. But if you don't have any time feel no pressure to assign it back to moodle.com. Thank you.

          Show
          Jérôme Mouneyrac added a comment - Hi Jamie, I assigned this to you because you did the previous Flex client. But if you don't have any time feel no pressure to assign it back to moodle.com. Thank you.
          Hide
          Jamie Pratt added a comment -

          Have created a new amf service browser client. You can use a user's token or a username and password to log in to the client. A patch that applies to the latest version of Moodle HEAD is attached.

          I have modified the zend server so that it supplies details of all the available methods for the logged in user. It interprets the data in the class dynamically generated by Moodle and passes all the data to Flash through an extra remote service method. The client displays form entry fields for each argument and arguments for the method can be entered using JSON syntax ie. use {} to enclose an object and [] to enclose an array.

          All of this is a modification of the Moodle client created by Penny's colleague Jordi which is mentioned here : http://moodle.org/mod/forum/discuss.php?d=117791 and is licensed with the WTF-PL which is fully compatible with the GPL.

          I would propose that we include this in HEAD as an amf test client.

          Show
          Jamie Pratt added a comment - Have created a new amf service browser client. You can use a user's token or a username and password to log in to the client. A patch that applies to the latest version of Moodle HEAD is attached. I have modified the zend server so that it supplies details of all the available methods for the logged in user. It interprets the data in the class dynamically generated by Moodle and passes all the data to Flash through an extra remote service method. The client displays form entry fields for each argument and arguments for the method can be entered using JSON syntax ie. use {} to enclose an object and [] to enclose an array. All of this is a modification of the Moodle client created by Penny's colleague Jordi which is mentioned here : http://moodle.org/mod/forum/discuss.php?d=117791 and is licensed with the WTF-PL which is fully compatible with the GPL. I would propose that we include this in HEAD as an amf test client.
          Hide
          Jamie Pratt added a comment -

          Adding Petr as a watcher to this issue as he might want to review the additions I made to the Zend server sub class which I think he created.

          Show
          Jamie Pratt added a comment - Adding Petr as a watcher to this issue as he might want to review the additions I made to the Zend server sub class which I think he created.
          Hide
          Jamie Pratt added a comment -

          Attaching an updated version of the service browser as a patch to HEAD

          Show
          Jamie Pratt added a comment - Attaching an updated version of the service browser as a patch to HEAD
          Hide
          Jérôme Mouneyrac added a comment -

          I'm testing it Thanks Jamie.

          Show
          Jérôme Mouneyrac added a comment - I'm testing it Thanks Jamie.
          Hide
          Jamie Pratt added a comment -

          I attach a new version of the patch for the amf service browser / test client.

          The AMFTester.swf needs to be put in webservice/amf/testclient/ Seems that binary files don't work well in eclipse patches.

          Show
          Jamie Pratt added a comment - I attach a new version of the patch for the amf service browser / test client. The AMFTester.swf needs to be put in webservice/amf/testclient/ Seems that binary files don't work well in eclipse patches.
          Hide
          Jamie Pratt added a comment -

          Updated amf/testclient/index.php to keep up with changes in js functions in HEAD. Attached new patch.

          Show
          Jamie Pratt added a comment - Updated amf/testclient/index.php to keep up with changes in js functions in HEAD. Attached new patch.
          Hide
          Jamie Pratt added a comment -

          Attaching a new version of the patch "amfservicebrowser4.txt" to fix amf web services and to implement a web service browser in Flex.

          Also attaching a new version of the swf that needs to be dropped into /webservice/amf/testclient/

          Show
          Jamie Pratt added a comment - Attaching a new version of the patch "amfservicebrowser4.txt" to fix amf web services and to implement a web service browser in Flex. Also attaching a new version of the swf that needs to be dropped into /webservice/amf/testclient/
          Hide
          Jérôme Mouneyrac added a comment - - edited

          From our last conversation thing to retest for next time:

          [10/02/10 3:38:20 PM] Jérôme Mouneyrac: when I try delete group, it works but the server return an exception:
          [10/02/10 3:38:22 PM] Jérôme Mouneyrac: [10-Feb-2010 15:37:50] PHP Catchable fatal error: Argument 1 passed to webservice_amf_server::validate_and_cast_values() must be an instance of external_description, null given, called in /Users/jerome/Documents/Projects/Moodle_HEAD_sandbox/moodle/webservice/lib.php(373) : eval()'d code on line 44 and defined in /Users/jerome/Documents/Projects/Moodle_HEAD_sandbox/moodle/webservice/amf/locallib.php on line 81
          [10/02/10 3:38:32 PM] Jérôme Mouneyrac: when I try get all works fine
          [10/02/10 3:39:02 PM] Jérôme Mouneyrac: when I try create group, all works fine on the server but the Flex client say that it found an exception

          All code has been moved into amf_code, except a hook in webservice/lib.php that allow protocol plugins to overwrite the function generating the class.
          Very cool to see complex call and complex return value working with AMF
          +10 for committing the patch in HEAD now, Jamie will keep going to fix/improve.

          Show
          Jérôme Mouneyrac added a comment - - edited From our last conversation thing to retest for next time: [10/02/10 3:38:20 PM] Jérôme Mouneyrac: when I try delete group, it works but the server return an exception: [10/02/10 3:38:22 PM] Jérôme Mouneyrac: [10-Feb-2010 15:37:50] PHP Catchable fatal error: Argument 1 passed to webservice_amf_server::validate_and_cast_values() must be an instance of external_description, null given, called in /Users/jerome/Documents/Projects/Moodle_HEAD_sandbox/moodle/webservice/lib.php(373) : eval()'d code on line 44 and defined in /Users/jerome/Documents/Projects/Moodle_HEAD_sandbox/moodle/webservice/amf/locallib.php on line 81 [10/02/10 3:38:32 PM] Jérôme Mouneyrac: when I try get all works fine [10/02/10 3:39:02 PM] Jérôme Mouneyrac: when I try create group, all works fine on the server but the Flex client say that it found an exception All code has been moved into amf_code, except a hook in webservice/lib.php that allow protocol plugins to overwrite the function generating the class. Very cool to see complex call and complex return value working with AMF +10 for committing the patch in HEAD now, Jamie will keep going to fix/improve.
          Hide
          Jamie Pratt added a comment -

          Added some comments.

          Show
          Jamie Pratt added a comment - Added some comments.
          Hide
          Jamie Pratt added a comment -

          Committed my test client to CVS along with fixes to cast parameters from Flash and return value from php to appropriate types.

          Also committed a fix for the bugs reported by Jerome above.

          Show
          Jamie Pratt added a comment - Committed my test client to CVS along with fixes to cast parameters from Flash and return value from php to appropriate types. Also committed a fix for the bugs reported by Jerome above.
          Hide
          Jérôme Mouneyrac added a comment -

          Thanks Jamie

          Show
          Jérôme Mouneyrac added a comment - Thanks Jamie
          Hide
          Jérôme Mouneyrac added a comment - - edited

          Hi Jamie,
          I updated Zend Framework to 1.10.6
          Can you tell me if you have any problems with AMF?
          The other things that changed recently in the web services are:

          Thanks you

          Show
          Jérôme Mouneyrac added a comment - - edited Hi Jamie, I updated Zend Framework to 1.10.6 Can you tell me if you have any problems with AMF? The other things that changed recently in the web services are: MDL-23083 MDL-23114 Thanks you
          Hide
          Jamie Pratt added a comment -

          AMF web services and AMF client seem to have been unaffected.

          Show
          Jamie Pratt added a comment - AMF web services and AMF client seem to have been unaffected.
          Hide
          Jérôme Mouneyrac added a comment -

          Hi Jamie,
          I attached a patch for the fix I did in MDL-23083
          Can you apply it and commit it if all still work fine?
          Thanks you

          Show
          Jérôme Mouneyrac added a comment - Hi Jamie, I attached a patch for the fix I did in MDL-23083 Can you apply it and commit it if all still work fine? Thanks you
          Hide
          Jamie Pratt added a comment -

          Tested your patch Jerome and committed it. All seems to work fine!

          Show
          Jamie Pratt added a comment - Tested your patch Jerome and committed it. All seems to work fine!
          Hide
          Jamie Pratt added a comment -

          Oops. Accidentally committed an extension to the Zend code I wrote that improves exception reporting in the amf client along with your patch Jerome. But anyway this is something I intended to commit at some stage.

          Show
          Jamie Pratt added a comment - Oops. Accidentally committed an extension to the Zend code I wrote that improves exception reporting in the amf client along with your patch Jerome. But anyway this is something I intended to commit at some stage.
          Hide
          Jérôme Mouneyrac added a comment -

          No problem. It improves exception messages and it looks good.
          We probably need something like that for SOAP anyway.
          Thank for testing and committing.

          Show
          Jérôme Mouneyrac added a comment - No problem. It improves exception messages and it looks good. We probably need something like that for SOAP anyway. Thank for testing and committing.
          Hide
          Jérôme Mouneyrac added a comment - - edited

          Hi Jamie,
          discovered a new bug:

          example of ws function generated code when parameters have default value (here ='' ):

          public function hubdirectory_get_hubs($search='', $language='') {
          $search=''=webservice_zend_server::cast_objects_to_array($search='');
          

          it should be:

          public function hubdirectory_get_hubs($search='', $language='') {
          $search=webservice_zend_server::cast_objects_to_array($search='');
          

          Attach a patch for it.

          Show
          Jérôme Mouneyrac added a comment - - edited Hi Jamie, discovered a new bug: example of ws function generated code when parameters have default value (here ='' ): public function hubdirectory_get_hubs($search='', $language='') { $search=''=webservice_zend_server::cast_objects_to_array($search=''); it should be: public function hubdirectory_get_hubs($search='', $language='') { $search=webservice_zend_server::cast_objects_to_array($search=''); Attach a patch for it.
          Hide
          Jamie Pratt added a comment -

          Hi Jerome,

          I have a patch for this working on my system, will attach it. I think it is an improvement on your patch as there is no potential problem if the default includes an equals symbol (very rare I admit), also my patch takes care of the problem in the parent class rather than passing the problem down into the child class and having to deal with it in various web service plug ins.

          It seems I opened an issue about default params MDL-22426 but did not attach more info or the patch at the time, oops.

          Show
          Jamie Pratt added a comment - Hi Jerome, I have a patch for this working on my system, will attach it. I think it is an improvement on your patch as there is no potential problem if the default includes an equals symbol (very rare I admit), also my patch takes care of the problem in the parent class rather than passing the problem down into the child class and having to deal with it in various web service plug ins. It seems I opened an issue about default params MDL-22426 but did not attach more info or the patch at the time, oops.
          Hide
          Jérôme Mouneyrac added a comment -

          it is definitively better than my fix.
          +1 to remove my last commit part:

           //clean the parameter name from any potential default value assignment
                          // i.e. if the param is: $search = ''
                          // we only want: $search
                          $paramtocast = split('=', $paramtocast);
                          $paramtocast = $paramtocast[0];
          

          and +1 to commit your patch.

          Show
          Jérôme Mouneyrac added a comment - it is definitively better than my fix. +1 to remove my last commit part: //clean the parameter name from any potential default value assignment // i.e. if the param is: $search = '' // we only want: $search $paramtocast = split('=', $paramtocast); $paramtocast = $paramtocast[0]; and +1 to commit your patch.
          Hide
          Jérôme Mouneyrac added a comment -

          removing my commit, you can commit your patch, thank you.

          Show
          Jérôme Mouneyrac added a comment - removing my commit, you can commit your patch, thank you.
          Hide
          Jamie Pratt added a comment -

          OK. Fixed now.

          Show
          Jamie Pratt added a comment - OK. Fixed now.
          Hide
          Jérôme Mouneyrac added a comment -

          thanks

          Show
          Jérôme Mouneyrac added a comment - thanks
          Hide
          Jamie Pratt added a comment -

          I committed changes to the client to support :

          • user control of variable number of parameters.
          • better error reporting
          • ui improvements
          Show
          Jamie Pratt added a comment - I committed changes to the client to support : user control of variable number of parameters. better error reporting ui improvements
          Hide
          Jérôme Mouneyrac added a comment -

          I added a link to the AMF test client into the web service test client page.

          Show
          Jérôme Mouneyrac added a comment - I added a link to the AMF test client into the web service test client page.

            People

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

              Dates

              • Created:
                Updated:
                Resolved: