简体   繁体   中英

call a method return bool(false) in nusoap

when i call a method and var_dump($result) then show bool(false) why? i change my parameters to example and 1234 for writing here:

require_once('../class/nusoap.class.php');
// Create the client instance
$client = new soapclient('sample?wsdl' ,'wsdl', '', '', '', '');
$soapClient->soap_defencoding = 'UTF-8';
$soapClient->debug_flag = false;

// Check for an error
$err = $client->getError();
if ($err) {
    // Display the error
    echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
    // At this point, you know the call that follows will fail
}
// Call the SOAP method
$result = $client->call('enqueue', array('from' => '+12345',
'rcpt_array' => '123456',
'msg' => 'hi',
'uname' => 'example1',
'pass' => 'example2'));
var_dump($result);

As per PHP SoapClient documentation the second parameter for the SoapClient constructor should be an array

public SoapClient::SoapClient ( mixed $wsdl [, array $options ] )

But in your case you're passing series of arguments. I'm not sure this will work or not.

Secondly while working with Soap calls with wsdl we can directly call the wsdl method like this as per your example with the parameters.

$client->enqueue(array('from' => '+12345',
'rcpt_array' => '123456',
'msg' => 'hi',
'uname' => 'example1',
'pass' => 'example2'));

Here is a simple PHP soap call example

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM