Developing & Testing Web Services in Moodle

A Web Service is conceptually easy, but surprisingly hard to develop and especially test. Here's a quick primer for the development side of things. Moodle also offers a very incomplete 'Web service test client' as well as an embedded version of the 'AMF test client'. The AMF test client didn't work for me: it kept spewing errors where other test methods yielded perfectly fine results.

So, there are no suitable testing environments inside Moodle for testing web services.

Testing Moodle Web Services

To start with, configure your Moodle to use web services: go to the /admin/settings.php?section=webservicesoverview url and follow the steps.

Then, you can script your own tests, of course. Use the local wstemplate plugin as an example.

Or use one of these:

  • Postman, Google Chrome plugin
  • SoapUI, Java application (doesn't run under XMonad/Gnome)

Test in Postman

Once installed, Postman is available through the 'Apps' section of Chrome: go to the url


and click on the Postman icon.

To perform a test, type in a url (you can also use the URL Params tab), e.g.:


Common Pitfalls

  • After each change in your local web services plugin, do change the version number and visit the /admin/ url. Otherwise, your tests will be conducted with obsolete data in the database (e.g. web services method names are stored in the database).
  • The PARAM_TEXT is specified as a return type, but the actual text returned contains tags. Use PARAM_RAW instead.

Personal Tools