While making a library that uses PHP's SoapClient and is compatible with PHP 8.1, I ran into this problem:
All properties of SoapClient are now private when they were previously public.
So things like getting the last soap fault ($soapClient->__soap_fault
) are no longer possible. But if something goes wrong, most methods of SoapClient will return null, and the only way to know what the problem is is to get the __soap_fault
that is no longer accessible.
How should I use method __doRequest
when I don't have access to SoapClient properties?
P粉9696666702023-12-13 13:23:55
Looking at the old SoapClient
documentation, it seems that accessing properties directly is always an error - for php7.2 e.g. depending on the backhaul machine, __soap_fault
is not documented at all (see https:// /web.archive.org/web/20171211100753/http://us3.php.net/manual/en/class.soapclient. php)
The document description is as follows:
I would say, make sure you enable exceptions (by passing $options['exceptions'] => true
to the SoapClient constructor) and handle these exceptions in a try/catch
Correspondingly. If this doesn't help, a new question with the specific error that wasn't handled correctly might be more helpful.