Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi,
I tried to save a node using SWX but it's not working.
The result shows that the node was saved, but when I check in Drupal it shows that the node is empty (no title, no body, nothing).
Here's the code I wrote.
import org.swxformat.SWX;
var swx:SWX = new SWX();
swx.gateway = "http://localhost/drupal_test/services/swx";
swx.encoding = "GET";
swx.debug = true;
var callParameters:Object = {
serviceClass:"Drupal",
method:"callService",
args:['node.load', [2]],
result:[this, resultHandler],
};
var callParametersSave:Object = {
serviceClass:"Drupal",
method:"callService",
args:['node.save', [_root.node]],
result:[this, saveResultHandler],
fault:[this, saveFaultHandler]
};
swx.call(callParameters);
function resultHandler(event:Object) {
// assign loaded node
_root.node = event.result;
// set args for new save request
callParametersSave.args = ['node.save', [_root.node]];
swx.call(callParametersSave);
}
function saveResultHandler(event:Object) {
trace("===============saved================");
}
function saveFaultHandler(event:Object) {
trace("--------------ERROR--------------");
}
Any help is appreciated.
Comments
Comment #1
timosea CreditAttribution: timosea commentedDid you find a solution to this node save issue?
I have a very similar problem and can not work it out either, i thought it was a permissions problem, so created the following script (as2) to test this theory.
My demo user can edit node 111 from drupal, so thought if create a session and log that user in load node 111 then modify the title and save it, it should work, but guess I'm still doing something wrong; the non-existent session fault msg at the end is kind of concerning too!
Help would be most welcome;)
Comment #2
bassam CreditAttribution: bassam commentedHi,
Sorry man, no luck.
I ended up creating a new service that takes multiple parameters and then I save the node using node_save().
Please report back if you figured something out.
Best of luck.
Comment #3
timosea CreditAttribution: timosea commentedSorry about the delay, in posting back, I'm on drupal stuff on regularly irregular bases.
In the end after trying most of the other services modules I end up using the built in xmlrpc service combined with mattism as2 classes which work seamlessly with flashlite3 until wanted save cck fields; in the end I hacked the mattism classes to allow pre-formatted xml strings through for cck fields.