Index: services/node_service/node_service.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/services/services/node_service/Attic/node_service.module,v
retrieving revision 1.5.2.3
diff -u -p -r1.5.2.3 node_service.module
--- services/node_service/node_service.module	18 Jun 2008 21:45:41 -0000	1.5.2.3
+++ services/node_service/node_service.module	17 Aug 2008 03:41:44 -0000
@@ -87,19 +87,52 @@ function node_service_load_access($nid) 
 }
 
 function node_service_save($edit) {
+  //load the required includes for drupal_execute as documented in the api:
+  //http://api.drupal.org/api/function/drupal_execute/6
+  module_load_include('inc', 'node', 'node.pages');
+
   if ($edit['nid']) {
     $node = node_load($edit['nid']);
     if ($node->nid) {
-      $ret = drupal_execute($node->type .'_node_form', $edit, $edit);
+
+      //setup form_state.
+      $form_state = array(); 
+      $form_state['values'] = $edit;
+      $form_state['values']['op'] = t('Save');
+
+      //later on in the chain node_form seems to expect a copy of the old
+      //node object.. as documented by wdmartin http://drupal.org/node/293663
+      $form_state['node'] = (array) $node;
+
+      $ret = drupal_execute($node->type .'_node_form', $form_state, (object)$node);
+
+      //if the node is immediately reloaded after update, it will load the OLD cached
+      //version. This is a long standing issue, with a potential patch coming in D7
+      //http://drupal.org/node/111127#comment-768053, until that happens the line below
+      //manually clears the cache after update. Line borrowed from a patch to the
+      //notificaitons module by david_g, http://drupal.org/node/278530#comment-916332
+      node_load(0, NULL, TRUE);
     }
   }
   else {
-    $ret= drupal_execute($edit['type'] .'_node_form', $edit, $edit);
+
+    //setup form_state.. 
+    $form_state = array();
+    $form_state['values'] = (array) $edit;
+    $form_state['values']['op'] = t('Save');
+
+    $ret = drupal_execute($edit['type'] .'_node_form', $form_state, (object)$edit);
   }
+
   if ($errors = form_get_errors()) {
     return services_error(implode("\n", $errors));
   }
-  watchdog('content', t('@type: updated %title.', array('@type' => t($node->type), '%title' => $node->title)), WATCHDOG_NOTICE, l(t('view'), 'node/'. $node->nid));
+  
+  // assume this is a remnant from using node_save instead of drupal_execute
+  // was messing up log due to missing NULL for variables argument:
+  // http://api.drupal.org/api/function/watchdog/6, fixed and commented out
+  // as drupal_execute already logs the update.
+  // watchdog('content', t('@type: updated %title.', array('@type' => $node->type, '%title' => $node->title)), NULL, WATCHDOG_NOTICE, l(t('view'), 'node/'. $node->nid));
   return $ret;
 }
 
