I am creating a SOAP client in PHP. Most of my calls look like this
$client->__soapCall('method', $params)
From what I can tell this is one of two ways to call the methods within the WSDL, the other being:
$client->method($params);
I have only been able to get the second way to work when calling a method that only requires strings. Using a method that requires an integer gives me this error:
The value '' cannot be parsed as the type 'Int32'.'
How are these two requests working differently?
Direct call ($client->method()) uses deprecated magical class method __call(). If you are implementing your SoapClient by extending your client class (see example below), you can implement __call() to "callthru" to __soapCall().
class mySoapClient extends SoapClient {
public function __call($method, $parameters) {
return $this->__soapCall($method, $parameters);
}
}
If you are not implementing your client by extending, using direct call ($client->method()) is a bad idea since it will eventually be dropped out of PHP.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With