? soap_server.module-soapextensionerror.patch
Index: README.txt
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/soap_server/README.txt,v
retrieving revision 1.2
diff -u -p -r1.2 README.txt
--- README.txt	5 Feb 2008 05:58:40 -0000	1.2
+++ README.txt	6 Feb 2008 16:28:52 -0000
@@ -1,9 +1,19 @@
+
+$Id: README.txt,v 1.2 2008/02/05 05:58:40 robloach Exp $
+
+
 SOAP Server
 ===========
 The SOAP Server module allows a Drupal site to access services using the same
 callback code.
 
-$Id: README.txt,v 1.2 2008/02/05 05:58:40 robloach Exp $
+Note: if soap extension is loaded in the PHP engine, the NuSOAP will not work, but
+still the soap server will reply using standard xml error to don't break services
+consumption. It faults with a 404 error.
+
+If soap extension is loaded, it's advised to unload it from the server for now.
+
+
 
 
 Requirements to call services via SOAP Server
Index: soap_server.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/soap_server/Attic/soap_server.module,v
retrieving revision 1.2
diff -u -p -r1.2 soap_server.module
--- soap_server.module	5 Feb 2008 05:58:40 -0000	1.2
+++ soap_server.module	6 Feb 2008 16:28:55 -0000
@@ -13,7 +13,7 @@
  */
 
 /**
- * Implementation of hook_menu()
+ * Implementation of hook_help()
  */ 
 function soap_server_help($section) {
   switch ($section) {
@@ -43,24 +43,32 @@ function soap_server_menu($may_cache) {
  */
 function soap_server_admin_settings() {
   $form = array();
-  
-  // Check to see if the SOAP Server is available.
-  $status = t('NuSOAP was not found');
-  if (@include_once(realpath(soap_server_nusoap_path()))) {
+  $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 = t('Version %version found', array('%version' => $nusoap->version));
+    $status = $nusoap->version;
   }
-  
-  // Create the settings form to input the NuSOAP path.
+
   $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.', array('@NuSOAP' => 'http://sourceforge.net/projects/nusoap/', '!status' => $status)),
+    '#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
   );
-  
-  // Create the settings form.
+
   return system_settings_form($form);
 }
 
@@ -87,14 +95,16 @@ function soap_server_server_info() {
  * Implementation of hook_server()
  */
 function soap_server_server() {
+  // Use internal soap..
+  $phpsoap = extension_loaded('soap');
   // Load soap library
-  if (@include_once(realpath(soap_server_nusoap_path()))) {
+  if (($phpsoap)||(@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>. 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_set_message(t('The <em>SOAP Server</em> requires at least one SOAP engine in this server. PHP Soap extension is not enabled in this server, so a proper installation of <a href="@nusoap" target="_blank">NuSOAP</a> is required. 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();
   }
 }
@@ -106,7 +116,10 @@ function soap_server() {
   // Get the global var with post data..
   global $HTTP_RAW_POST_DATA;
   global $soap_server;
-  
+ 
+  // Again, check if using nusoap or php soap service
+  $phpsoap = extension_loaded('soap');
+
   // Construct URL.
   if (isset($_SERVER)) {
     $server_name = $_SERVER['SERVER_NAME'];
@@ -132,8 +145,14 @@ function soap_server() {
   $name_space = $scheme . $server_name . base_path() . $q;
   
   // Create server instance
-  $soap_server = new soap_server();
+  if ($phpsoap) {
+    $soap_server = new SoapServer(NULL, array('uri' => $name_space));
+    $soap_server->fault(t('404'),t('This SOAP server doesn\'t provide any service. Please advise the site administrator about the configuration of the SOAP server.'));
+    exit;
+  }
   
+  // Create server instance
+  $soap_server = new soap_server();
   // Initialize WSDL support
   $soap_server->configureWSDL('DrupalSoap', $name_space, $name_space);
   $soap_server->wsdl->schemaTargetNamespace = $name_space;
