Editing a node's taxonomy terms using node.save (via XMLRPC) in the Services module
I'm using Drupal 6.12 and Services 6.x-2.x-dev
I spent quite a while figuring out how to edit which taxonomy terms are attached to a node via node.save in Services. This is probably pretty easy for a veteran Drupal programmer who's used to poking around in a module's code but since it took me so long I figure I'll write it up here to save someone some work.
Taxonomy vocabularies can either be of the type "tags", or not. This is configured when you set up the vocabulary (at admin->content management->taxonomy).
"Tag"-type vocabularies
If the vocabulary in question is of the tag sort, then the taxonomy property of the node object you send to node.save might look like this (this code is in PHP):
$nodeObj->taxonomy = array(
'tags' => array(
2=>'military,navy,army',
5=>'news,headline'
)
);The taxonomy property is an array consisting of just one element: the "tags" array . Elements in the "tags" array should have a key of the desired vocabulary ID (vid) and a value of the comma-separated string of desired terms. Terms that don't already exist in the vocabulary will be automatically created.
Non-tag vocabularies
Non-tag vocabularies are quite a bit different and work like so:
$nodeObj->taxonomy = array(2=>array(15,19));Feed the taxonomy property an array. The keys should be the vocabulary ids (vid) while the values should be arrays of taxonomy term ids. In this example I'm associating taxonomy terms tid=15 and tid=19 with the node via vocabulary vid=2.

Turns out you just need to
Turns out you just need to emulate the structure of the data that's posted by the node edit form. Hopefully this is helpful to anyone trying to use Services for complex field types.