|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2005-07-10 12:14 UTC] jw at jwscripts dot com
Description:
------------
SOAP-RPC calls with parameters only succeed when __call() invoked explicitly; when no parameters are required, $soapclient->functionName() succeed as expected.
In the reproduce code below, when replacing:
$result = $client->getRate($params);
with
$result = $client->__call('getRate', $params);
everything works...
Reproduce code:
---------------
$wsdl = 'http://www.xmethods.net/sd/CurrencyExchangeService.wsdl';
// Parameters to send
$params = array(
'country1' => 'USA',
'country2' => 'UK'
);
$client = new SoapClient($wsdl);
$result = $client->getRate($params);
Expected result:
----------------
No output
Actual result:
--------------
Notice: Array to string conversion in G:\Apache Group\Apache2\htdocs\xins-soap\rpc-test.php on line 13
Notice: Undefined property: SoapFault::$faultstring in Unknown on line 0
Fatal error: Uncaught SoapFault exception: [soap:Server] (null) in G:\Apache Group\Apache2\htdocs\xins-soap\rpc-test.php:13 Stack trace: #0 G:\Apache Group\Apache2\htdocs\xins-soap\rpc-test.php(13): SoapClient->__call('getRate', Array) #1 G:\Apache Group\Apache2\htdocs\xins-soap\rpc-test.php(13): SoapClient->getRate(Array) #2 {main} thrown in G:\Apache Group\Apache2\htdocs\xins-soap\rpc-test.php on line 13
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 15:00:01 2025 UTC |
getRate() SOAP method accepts two arguments. You pass them proper using __call() because it accepts array of argument. Using getRate() you shouldn't pass array but just one by one. $client->getRate('USA', 'UK'); I got float(0.5736)