Re: [SOAP] PHP overloading

From: Date: Fri, 09 May 2003 23:19:15 +0000
Subject: Re: [SOAP] PHP overloading
References: 1  Groups: php.soap 
Request: Send a blank email to php-soap+get-588@lists.php.net to get a copy of this message
Yes, overload had problems on and off that caused failures in soap, so I dissabled it. You can get the same behaviour by doing: $wsdl =& new SOAP_WSDL("...wsdl"); $client =& $wsdl->getProxy(); $client->runSearch($params); Overloading will be a default feature in SOAP when it is modified more for PHP 5. Shane Christopher Lewis wrote:
Hi all, I notice that PHP object overloading was disabled in 0.7.1. Why was this? I'm using 0.7.2, and I decided to see what would happen if I turned overloading back on again in Client.php. I had to add a bit to the SOAP_Client->__call() function (patch attached) to make it work correctly with the requirement that $params be specified as an associative array. I'm now able to successfully call an RPC method specified in a WSDL file: require_once("SOAP/Client.php"); $search = new SOAP_Client("....wsdl",true); $params = array("searchtext" => "stuff"); $result = $search->runSearch($params); Were there deeper issues with overloading that would make it a bad idea for me to use this? I'm new to SOAP so I could easily be missing something! -Chris ------------------------------------------------------------------------ --- Client.php.orig Thu Apr 17 20:43:47 2003 +++ Client.php Fri May 9 18:04:38 2003 @@ -264,7 +264,15 @@
     function __call($method, $args, &$return_value)
     {
         if ($this->_wsdl) $this->_wsdl->matchMethod($method);
-        $return_value = $this->call($method, $args);
+ + #since call() expects an assoc array of params, we'll enforce that here + if (!is_array($args[0])) + { + $return_value = $this->_raiseSoapFault("Parameters must be passed in associative array.","Client"); + return true; + } +
+        $return_value = $this->call($method, $args[0]);
         return TRUE;
     }
     @@ -528,7 +536,7 @@
     }
} -#if (extension_loaded('overload')) {
-#    overload('SOAP_Client');
-#} +if (extension_loaded('overload')) {
+    overload('SOAP_Client');
+} ?> \ No newline at end of file


« previous php.soap (#588) next »