Index: soap_server.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/soap_server/soap_server.module,v
retrieving revision 1.1
diff -u -r1.1 soap_server.module
--- soap_server.module	25 Jan 2008 22:26:43 -0000	1.1
+++ soap_server.module	29 Jan 2008 22:00:59 -0000
@@ -9,6 +9,73 @@
 //
 
 /**
+ * Implementation of hook_menu()
+ */ 
+function soap_server_help($section) {
+  switch ($section) {
+    case 'admin/build/services/settings/soap':
+      return '<p>'. t('The following are the configuration options for the SOAP Server. Currently supported SOAP engines are NuSOAP and PHP5 builtin soap connector.') .'</p>';    
+  }
+}
+
+/**
+ * Implementation of hook_menu()
+ */ 
+function soap_server_menu($may_cache) {
+    $items[] = array(
+      'path' => 'admin/build/services/settings/soap', 
+      'title' => t('SOAP Server'),
+      'access' => user_access('administer services'),
+      'callback' => 'drupal_get_form',
+      'callback arguments' => 'soap_server_admin_settings',
+      'description' => t('Configure the SOAP server.'),
+      'type' => MENU_LOCAL_TASK,
+    );
+    return $items;
+}
+
+/**
+ * Administration settings for the SOAP server.
+ */
+function soap_server_admin_settings() {
+  $form = array();
+  $phpsoap = extension_loaded('soap');
+  $status = t('Not');
+
+//take care of loaded soap extension if php version supports it.
+//Get php version and soap module status.
+  if ($phpsoap) {
+   $form['phpsoap_notice'] = array(
+     '#type' => 'markup',
+     '#value' => t("PHP builtin SOAP support is enabled. Enabling other soap engine will make the system fail. To avoid this, the following options appear disabled."),
+    );
+  }
+
+  if ((!$phpsoap) && (include_once(realpath(soap_server_nusoap_path())))) {
+    $nusoap = new nusoap_base();
+    $status = $nusoap->version;
+  }
+
+  $form['soap_server_nusoap_path'] = array(
+    '#type' => 'textfield',
+    '#title' => t('NuSOAP Path'),
+    '#description' => t('The location where <a href="@nusoap">NuSOAP</a> is installed.  This should be a relative path to <em>nusoap.php</em>. @status found.', array('@NuSOAP' => 'http://sourceforge.net/projects/nusoap/', '@status' => $status)),
+    '#default_value' => soap_server_nusoap_path(),
+    '#disabled' => $phpsoap,
+    '#required' => TRUE
+  );
+
+  return system_settings_form($form);
+}
+
+/**
+ * Retrieve the path where NuSOAP is installed
+ */
+function soap_server_nusoap_path() {
+  return variable_get('soap_server_nusoap_path', drupal_get_path('module', 'soap_server') .'/nusoap/lib/nusoap.php');
+}
+
+/**
  * Implementation of hook_server_info()
  */
 function soap_server_server_info() {
@@ -23,17 +90,20 @@
  */
 function soap_server_server() {
   // Load soap library
-  if (@include_once(drupal_get_path('module', 'soap_server') .'/nusoap/lib/nusoap.php')) {
+  if (@include_once(realpath(soap_server_nusoap_path()))) {
     // Launch the server
     return soap_server();
   }
   else {
     // Gracefully tell the user NuSOAP isn't installed
-    drupal_set_message(t('The <em>SOAP Server</em> requires proper installation of <a href="@nusoap" target="_blank">NuSOAP</a>.', array('@nusoap' => 'http://sourceforge.net/projects/nusoap/')), 'error');
+    drupal_set_message(t('The <em>SOAP Server</em> requires proper installation of <a href="@nusoap" target="_blank">NuSOAP</a>. Please see the <a href="@soapserver">SOAP Server settings</a> for more information.', array('@nusoap' => 'http://sourceforge.net/projects/nusoap/', '@soapserver' => url('admin/build/services/settings/soap'))), 'error');
     drupal_goto();
   }
 }
 
+/**
+ * Creates the SOAP server and manages its call
+ */ 
 function soap_server() {
   // Get the global var with post data..
   global $HTTP_RAW_POST_DATA;
@@ -192,422 +262,3 @@
   $ret = (array) $ret;
   return $ret;
 }
-
-
-
-
-/*
-
-// Define the ping_soap method as a PHP function
-function ping_soap($ping) {
-        return 'PONG, ' . $ping;
-}
-
-
-
-Array
-(
-    [#method] => node.load
-    [#callback] => node_service_load
-    [#args] => Array
-        (
-            [0] => Array
-                (
-                    [#name] => api_key
-                    [#type] => string
-                    [#description] => A valid API key.
-                    [#optional] => 
-                )
-
-            [1] => Array
-                (
-                    [#name] => sessid
-                    [#type] => string
-                    [#description] => A valid sessid.
-                    [#optional] => 
-                )
-
-            [2] => Array
-                (
-                    [#name] => nid
-                    [#type] => int
-                    [#description] => A node id.
-                    [#optional] => 
-                )
-
-            [3] => Array
-                (
-                    [#name] => fields
-                    [#type] => array
-                    [#optional] => 1
-                    [#description] => A list of fields to return.
-                )
-
-        )
-
-    [#return] => struct
-    [#help] => Returns a node.
-    [#auth] => 1
-)
-
-Array
-(
-    [#method] => node.save
-    [#callback] => node_service_save
-    [#args] => Array
-        (
-            [0] => Array
-                (
-                    [#name] => api_key
-                    [#type] => string
-                    [#description] => A valid API key.
-                    [#optional] => 
-                )
-
-            [1] => Array
-                (
-                    [#name] => sessid
-                    [#type] => string
-                    [#description] => A valid sessid.
-                    [#optional] => 
-                )
-
-            [2] => Array
-                (
-                    [#name] => node
-                    [#type] => struct
-                    [#description] => A node object. Upon creation, node object must include "type". Upon update, node object must include "nid" and "changed".
-                    [#optional] => 
-                )
-
-        )
-
-    [#return] => struct
-    [#help] => Save a node object into the database.
-    [#auth] => 1
-)
-
-Array
-(
-    [#method] => node.delete
-    [#callback] => node_delete
-    [#args] => Array
-        (
-            [0] => Array
-                (
-                    [#name] => api_key
-                    [#type] => string
-                    [#description] => A valid API key.
-                    [#optional] => 
-                )
-
-            [1] => Array
-                (
-                    [#name] => sessid
-                    [#type] => string
-                    [#description] => A valid sessid.
-                    [#optional] => 
-                )
-
-            [2] => Array
-                (
-                    [#name] => nid
-                    [#type] => int
-                    [#description] => A node id.
-                    [#optional] => 
-                )
-
-        )
-
-    [#help] => Delete a node.
-    [#auth] => 1
-)
-
-Array
-(
-    [#method] => system.connect
-    [#callback] => system_service_connect
-    [#auth] => 
-    [#return] => struct
-    [#help] => Returns an object containing a sessid and user.
-    [#args] => Array
-        (
-            [0] => Array
-                (
-                    [#name] => api_key
-                    [#type] => string
-                    [#description] => A valid API key.
-                    [#optional] => 
-                )
-
-        )
-
-)
-
-Array
-(
-    [#method] => system.mail
-    [#callback] => system_service_mail
-    [#args] => Array
-        (
-            [0] => Array
-                (
-                    [#name] => api_key
-                    [#type] => string
-                    [#description] => A valid API key.
-                    [#optional] => 
-                )
-
-            [1] => Array
-                (
-                    [#name] => sessid
-                    [#type] => string
-                    [#description] => A valid sessid.
-                    [#optional] => 
-                )
-
-            [2] => Array
-                (
-                    [#name] => mailkey
-                    [#type] => string
-                    [#description] => A key to identify the mail sent, for altering.
-                    [#optional] => 
-                )
-
-            [3] => Array
-                (
-                    [#name] => to
-                    [#type] => string
-                    [#description] => The mail address or addresses where the message will be send to.
-                    [#optional] => 
-                )
-
-            [4] => Array
-                (
-                    [#name] => subject
-                    [#type] => string
-                    [#description] => Subject of the e-mail to be sent. This must not contain any newline characters, or the mail may not be sent properly.
-                    [#optional] => 
-                )
-
-            [5] => Array
-                (
-                    [#name] => body
-                    [#type] => string
-                    [#description] => Message to be sent. Drupal will format the correct line endings for you.
-                    [#optional] => 
-                )
-
-            [6] => Array
-                (
-                    [#name] => from
-                    [#type] => string
-                    [#optional] => 1
-                    [#description] => Sets From, Reply-To, Return-Path and Error-To to this value, if given.
-                )
-
-            [7] => Array
-                (
-                    [#name] => headers
-                    [#type] => array
-                    [#optional] => 1
-                    [#description] => Associative array containing the headers to add. This is typically used to add extra headers (From, Cc, and Bcc).
-                )
-
-        )
-
-    [#return] => struct
-    [#help] => Send an e-mail message, using Drupal variables and default settings.
-    [#auth] => 1
-)
-
-Array
-(
-    [#method] => taxonomy.getTree
-    [#callback] => taxonomy_service_get_tree
-    [#args] => Array
-        (
-            [0] => Array
-                (
-                    [#name] => api_key
-                    [#type] => string
-                    [#description] => A valid API key.
-                    [#optional] => 
-                )
-
-            [1] => Array
-                (
-                    [#name] => sessid
-                    [#type] => string
-                    [#description] => A valid sessid.
-                    [#optional] => 
-                )
-
-            [2] => Array
-                (
-                    [#name] => vid
-                    [#type] => int
-                    [#description] => A vocabulary id.
-                    [#optional] => 
-                )
-
-        )
-
-    [#return] => struct
-    [#help] => Create a hierarchical representation of a vocabulary.
-    [#auth] => 1
-)
-
-Array
-(
-    [#method] => taxonomy.selectNodes
-    [#callback] => taxonomy_service_select_nodes
-    [#args] => Array
-        (
-            [0] => Array
-                (
-                    [#name] => api_key
-                    [#type] => string
-                    [#description] => A valid API key.
-                    [#optional] => 
-                )
-
-            [1] => Array
-                (
-                    [#name] => sessid
-                    [#type] => string
-                    [#description] => A valid sessid.
-                    [#optional] => 
-                )
-
-            [2] => Array
-                (
-                    [#name] => tids
-                    [#type] => array
-                    [#description] => An array of term IDs to match.
-                    [#optional] => 
-                )
-
-            [3] => Array
-                (
-                    [#name] => fields
-                    [#type] => array
-                    [#optional] => 1
-                    [#description] => A list of fields to return.
-                )
-
-            [4] => Array
-                (
-                    [#name] => operator
-                    [#type] => string
-                    [#optional] => 1
-                    [#description] => How to interpret multiple IDs in the array. Can be "or" or "and".
-                )
-
-            [5] => Array
-                (
-                    [#name] => depth
-                    [#type] => string
-                    [#optional] => 1
-                    [#description] => How many levels deep to traverse the taxonomy tree. Can be a nonnegative integer or "all".
-                )
-
-            [6] => Array
-                (
-                    [#name] => pager
-                    [#type] => boolean
-                    [#optional] => 1
-                    [#description] => Whether the nodes are to be used with a pager (the case on most Drupal pages) or not (in an XML feed, for example).
-                )
-
-            [7] => Array
-                (
-                    [#name] => order
-                    [#type] => string
-                    [#optional] => 1
-                    [#description] => The order clause for the query that retrieve the nodes.
-                )
-
-        )
-
-    [#return] => struct
-    [#help] => Finds all nodes that match selected taxonomy conditions.
-    [#auth] => 1
-)
-
-Array
-(
-    [#method] => user.login
-    [#callback] => user_service_login
-    [#args] => Array
-        (
-            [0] => Array
-                (
-                    [#name] => api_key
-                    [#type] => string
-                    [#description] => A valid API key.
-                    [#optional] => 
-                )
-
-            [1] => Array
-                (
-                    [#name] => sessid
-                    [#type] => string
-                    [#description] => A valid sessid.
-                    [#optional] => 
-                )
-
-            [2] => Array
-                (
-                    [#name] => username
-                    [#type] => string
-                    [#description] => A valid username.
-                    [#optional] => 
-                )
-
-            [3] => Array
-                (
-                    [#name] => password
-                    [#type] => string
-                    [#description] => A valid password.
-                    [#optional] => 
-                )
-
-        )
-
-    [#return] => struct
-    [#help] => Logs in a user.
-    [#auth] => 1
-)
-
-Array
-(
-    [#method] => user.logout
-    [#callback] => user_service_logout
-    [#args] => Array
-        (
-            [0] => Array
-                (
-                    [#name] => api_key
-                    [#type] => string
-                    [#description] => A valid API key.
-                    [#optional] => 
-                )
-
-            [1] => Array
-                (
-                    [#name] => sessid
-                    [#type] => string
-                    [#description] => A valid sessid.
-                    [#optional] => 
-                )
-
-        )
-
-    [#return] => struct
-    [#help] => Logs out a user.
-    [#auth] => 1
-)
-
-
-*/
