Doc #55476 [Ver]: Method doesn't exist with magic method for soap
| From: | cmb@php.net | Date: | Thu, 22 Jul 2021 09:19:13 +0000 |
| Subject: | Doc #55476 [Ver]: Method doesn't exist with magic method for soap | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-18981@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=55476&edit=1
ID: 55476
Updated by: cmb@php.net
Reported by: donaldinou at gmail dot com
Summary: Method doesn't exist with magic method for soap
Status: Verified
Type: Documentation Problem
Package: Reflection related
Operating System: Linux
PHP Version: 5.3.7
Block user comment: N
Private report: N
New Comment:
Right, Reflection does not know about any methods implemented via
__call[1] or similar mechanisms. This should be documented.
[1] <https://3v4l.org/jqXe6>
Previous Comments:
------------------------------------------------------------------------
[2021-07-22 09:19:12] cmb@php.net
Right, Reflection does not know about any methods implemented via
__call[1] or similar mechanisms. This should be documented.
[1] <https://3v4l.org/jqXe6>
------------------------------------------------------------------------
[2015-02-24 09:24:57] donaldinou at gmail dot com
This is old, but I gave the code. How to be more verbose?
Anyway, you can copy/paste code below, it is an example more explicit
<?php
$clientSoap = new SoapClient('http://www.webservicex.net/geoipservice.asmx?WSDL');
$arguments = array('IPAddress' => '8.8.8.8');
// classic call
$result = $clientSoap->GetGeoIP($arguments);
//var_dump($result); // $result is ok
// call_user_func_array
$result = call_user_func_array( array($clientSoap, 'GetGeoIP'), array($arguments) );
if (!is_soap_fault($result)) {
echo 'OK not a problem.'.PHP_EOL;
}
// with reflection
$reflectionMethod = new ReflectionMethod($clientSoap, 'GetGeoIP');
try {
$result = $reflectionMethod->invokeArgs( $clientSoap, array($arguments) );
if (!is_soap_fault($result)) {
echo 'Ok not a problem.'.PHP_EOL;
}
} catch (ReflectionException $r) {
print_r($r); // Method SoapClient::GetGeoIP() does not exist
}
-------------------------------------------
The error raise is:
"Uncaught exception 'ReflectionException' with message 'Method
SoapClient::GetGeoIP() does not exist' in [...]"
This is because $clientSoap is an instanceof SoapClient and the Reflection object does not try to
use __getFunctions methods.
Why? Because the call is like this:
ReflectionMethod->__construct(Object(SoapClient), 'GetGeoIP')
------------------------------------------------------------------------
[2015-02-24 09:23:40] donaldinou at gmail dot com
I cannot "re-open" this one
------------------------------------------------------------------------
[2013-02-18 00:34:59] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.
------------------------------------------------------------------------
[2011-08-22 13:51:49] kalle@php.net
And the error from $r is? Please be more verbose
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=55476
--
Edit this bug report at https://bugs.php.net/bug.php?id=55476&edit=1