简体   繁体   English

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

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

when i call a method and var_dump($result) then show bool(false) why? 当我调用一个方法和var_dump($ result)然后显示bool(false)为什么? i change my parameters to example and 1234 for writing here: 我将参数更改为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);

As per PHP SoapClient documentation the second parameter for the SoapClient constructor should be an array 根据PHP SoapClient文档,SoapClient构造函数的第二个参数应为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. 其次,在使用wsdl进行Soap调用时,我们可以按照示例使用参数直接调用wsdl方法。

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

Here is a simple PHP soap call example 这是一个简单的PHP soap调用示例

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

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