| 1 |
// $Id: $
|
| 2 |
|
| 3 |
DESCRIPTION
|
| 4 |
-----------
|
| 5 |
This module provides SWX support to the Services module.
|
| 6 |
|
| 7 |
|
| 8 |
INSTALLATION
|
| 9 |
------------
|
| 10 |
|
| 11 |
1. Extract the module along with the services module into your Drupal modules
|
| 12 |
directory.
|
| 13 |
|
| 14 |
2. Download SWX PHP 1.01 from http://swxformat.org/download/ and extract it
|
| 15 |
into the 'server' folder, so that the path to swx.php is
|
| 16 |
modules/swx/server/php/swx.php
|
| 17 |
|
| 18 |
3. Make sure the Drupal.php service that shipped with this module is
|
| 19 |
still available at modules/swx/server/php/services/Drupal.php
|
| 20 |
|
| 21 |
4. Enable service.module and swx.module at the module admin page
|
| 22 |
(admin/build/modules)
|
| 23 |
|
| 24 |
5. Configure user permissions for service.module
|
| 25 |
|
| 26 |
|
| 27 |
USAGE
|
| 28 |
-----
|
| 29 |
|
| 30 |
- A simple ActionScript 2.0 call would look something along these lines:
|
| 31 |
|
| 32 |
this.createEmptyMovieClip("loader", this.getNextHighestDepth());
|
| 33 |
loader.serviceClass = "Drupal";
|
| 34 |
loader.method = "callService";
|
| 35 |
loader.args = "['serviceName', ['argument1', 'argument2', 'argument3']";
|
| 36 |
loader.debug = true;
|
| 37 |
|
| 38 |
loader.loadMovie("http://www.yourdrupalserver.com/services/swx", "GET");
|
| 39 |
|
| 40 |
function onEnterFrame()
|
| 41 |
{
|
| 42 |
trace(loader.result);
|
| 43 |
}
|
| 44 |
|
| 45 |
|
| 46 |
- In case you wanted to fetch node title and author uid using the node service,
|
| 47 |
the loader.args string could look like this:
|
| 48 |
|
| 49 |
loader.args = "['node.load',[1,['title','uid']]]";
|
| 50 |
|
| 51 |
This is a serialized array, where the first argument is the service name
|
| 52 |
and the second argument is an array containing parameters to the service.
|
| 53 |
In the above example, the first parameter is the node nid and the second
|
| 54 |
parameter is an array of fields to be returned.
|
| 55 |
|
| 56 |
to see the results you could do like this:
|
| 57 |
trace("title: " + loader.result.title + ", author: " + loader.result);
|
| 58 |
|
| 59 |
|
| 60 |
- For a nice tutorial on how to implement an actionscript client, including better
|
| 61 |
event and error handling, check out:
|
| 62 |
http://www.aralbalkan.com/1006
|
| 63 |
|
| 64 |
|
| 65 |
- Consult the Services handbook for general info on Drupal services:
|
| 66 |
http://drupal.org/handbook/modules/services
|