user.save not working

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
46AND2's picture

Hi

I'm quite new into Drupal. I figured out how to get nodes, users etc. in my Flex app.

But I'm not able to update a user's profile or add a new user. The permissions are set correctly. I'm using "Keys" and "SessID". I have the following code:

MXML

<mx:RemoteObject showBusyCursor="true" destination="amfphp" source="user" id="user">
   <mx:method name="save" result="onSavedUser(event)" fault="onFault(event)" />
</mx:RemoteObject>



The saveUser function
public function saveUser(obj:Object):void {
  var hashedArray:Array = hashKey("user.save"); // I use this method also for user.get etc, so I think it's not necessary to post it here
user.save(hashedArray[0], hashedArray[1], hashedArray[2], hashedArray[3], sessionID, obj);
}



The saveUser caller
var obj:Object = new Object();
obj.uid = 1;
obj.name = "Haha User";
obj.mail = "haha@huhu.ch";

saveUser(obj);



In Drupal and Flex I have this error message:
Duplicate entry &#039;&#039; for key 2 query: INSERT INTO users (created, access) VALUES (1247317962, 1247317962) in /home/www/web153/html/Drupal/modules/user/user.module on line 327.



I thought if I add a uid to the passed object, Drupal should do an update and not an insert? I also tried to not pass the uid and then Drupal should create a new user, but I also get the same error message.

I appreciate every help on this. Thank you!

46AND2

EDIT: I use Flex SDK 3 and Drupal 6.

Comments

C Sharp Interface Writer

anAgent's picture

Hi Everyone,

I created a console application that connects to a specified site and creates an interface based on the available services methods.

To read more about it and download the example, please visit:http://www.molinesoftware.com/?q=content/moline-software-drupal-interface-writer

To download the lastest package of my framework, please visit: https://sourceforge.net/projects/drupalxmlrpc/

Regards,

Aaron

Services

Group organizers

Group categories

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: