How to use the Sakai Web Services

How to use the Sakai Web Services

This page documents how you go about using the Sakai web services.
Sakai's web services are (currently) implemented in Apache Axis 1. This allows services to be written that expose any part of the Sakai API via a simple JWS file.
The JWS (Java Web Service) files are located at SAKAI_SRC/webservices/axis/src/webapp/*.jws in the Sakai source, and at http://your.sakai.server/sakai-axis/*.jws when deployed.
It's possible to edit the deployed jws files, as they are automatically recompiled at runtime, however I recommend you edit the jws files in the source and rebuild/deploy the webservices part of the Sakai source, rather than edit the deployed ones.

Enabling the web services

Note that the webservices are disabled by default. To enable them, in sakai.properties:

webservices.allowlogin=true

You also need to specify a comma separated list of IP addresses/hostnames that are allowed to connect. This can be a regex expression so the dots need to be escaped with backslashes:

webservices.allow=localhost,127\\.0\\.0\\.1,192\\.168\\.[0-9.]+,domain\\.somewhere\\.ac\\.uk,123\\.45\\.678\\.90

For development you could use the following to allow unrestricted access however DO NOT USE THIS IN PRODUCTION:

webservices.allow = .*

You can optionally enable access logging:

webservices.log-allowed=true
webservices.log-denied=true

Implementing the web services

See the links below for language specific information, and real working examples of how to implement Sakai's web services in those languages:

CXF Web service examples (Sakai 11+)

Axis Web service examples (Sakai 10 and earlier)

Automated web service scripts

Here's a collection of Perl scripts which can automate tasks like creating multiple user accounts from a CSV file, synchronising roles in sites, adding a single user to multiple sites, etc. You might find something useful: https://source.sakaiproject.org/contrib//swinsburg/webservice-scripts/

Useful stuff

http://ditchnet.org/soapclient/
SOAP Client is a free Cocoa-based developer tool for Mac OS X that allows you access and debug WSDL & SOAP-based Web Services from the comfort of your desktop.

http://www.soapui.org/
SOAP UI is a cross platform Java based SOAP client.

http://search.cpan.org/dist/SOAP-Lite/
SOAP::Lite is an excellent lightweight, easy to use module for Perl that makes calling web services simple. Also allows you to create web service endpoints.