Overriding __soapCall

From: Date: Thu, 14 Jul 2005 15:07:38 +0000
Subject: Overriding __soapCall
Groups: php.general 
Request: Send a blank email to php-general+get-218689@lists.php.net to get a copy of this message
I'm working on a soap client in PHP5, which I'm building by subclassing the built-in SoapClient class. However, it seems my overridden __soapCall method is never being called. My class looks something like this: class myClient extends SoapClient {
    public function __construct($wsdl = 'http://www.example.com/my.wsdl', $options = NULL) {
    if (!is_array($options))
        $options = array('soap_version'  => SOAP_1_1, 'trace' => true, 'exceptions' => true);
        parent::__construct($wsdl, $options);
    }
    public function __soapCall($function_name, $arguments = array(), $options = array(), $input_headers = NULL, &$output_headers = array()) {
        echo "doing __soapCall\n";
        return parent::__soapCall($function_name, $arguments, $options, $input_headers, $output_headers);
    }
} The constructor works fine. As you can see __soapCall does nothing but pass through the call to the parent, but it's just not being called. I've found various references to overriding the __call function (which is now completely obsolete as it clashes with a magic method) for the same kind of reason that I need to. So, it seems as if __soapCall is NOT called internally when calling a WSDL function, so if my client has a login function: $sc = new myClient(); $sc->login(array('username' => 'abc', 'password' => 'xyz')); but this does not seem to go via the internal __soapCall function, thus denying me the ability to tweak the request on its way through. If I call it manually (i.e. non-WSDL way), something like: $sc->__soapCall('login', array('username' => 'abc', 'password' => 'xyz')); then it works, but in that simple gesture I've lost most of the WSDL advantage. What am I supposed to do? Marcus -- Marcus Bointon Synchromedia Limited: Putting you in the picture marcus@synchromedia.co.uk | http://www.synchromedia.co.uk

« previous php.general (#218689) next »