繁体   English   中英

调用一个方法在nusoap中返回bool(false)

[英]call a method return bool(false) in nusoap

当我调用一个方法和var_dump($ result)然后显示bool(false)为什么? 我将参数更改为example和1234以便在此处编写:

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);

根据PHP SoapClient文档,SoapClient构造函数的第二个参数应为array

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

但是在您的情况下,您正在传递一系列参数。 我不确定这是否行得通。

其次,在使用wsdl进行Soap调用时,我们可以按照示例使用参数直接调用wsdl方法。

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

这是一个简单的PHP soap调用示例

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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