Where do I put custom web services and web service functions?

Where do I put custom web services and web service functions?

by Christian Pfisterer -
Number of replies: 3
Real simple question...So far I've added a service to /lib/db/services.php and the function + parameter functions in /enrol/externallib.php.

Works great.

But of course when I update from CVS I get a big mess (using eclipse). I've read in /local/README.txt I should place all my custom stuff in there

/local/xxx/db/external.php - web services and external functions descriptions

So I need to create /local/enrol/db/external.php ???

And in there I comebine the stuff from services.php and externallib.php ???

Am I right or wrong?
Average of ratings: -
In reply to Christian Pfisterer

Re: Where do I put custom web services and web service functions?

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
AFAIK, you can put them in several plugins (e.g. mod, block etc.). Personally, I put them in local. Last time I looked it didn't mention web services in the local documentation but it does work.

The last place you want to put them is in lib/db/services for all the reasons you mentioned.
In reply to Howard Miller

Re: Where do I put custom web services and web service functions?

by Christian Pfisterer -
So here is what I did. I copied the custom services from /lib/db/services.php to /local/enrol/db/services.php and deleted them afterwards from /lib/db/services.php.
Did the same with /enrol/externallib.php

So now I have the following folder strcuture

/local/enrol/externallib.php
/local/enrol/db/services.php

I changed /version.php to run the upgrade script. But my webservices are now not showing up any more (they were in the database before).

What do you I have to do to make moodle discover the webservices in /local/ ????

In reply to Christian Pfisterer

Re: Where do I put custom web services and web service functions?

by Christian Pfisterer -
OK got it myself. You need a version.php in the local/xxx folder!