![](/img/trans.png)
[英]PHP nusoap call returns bool false instead of complexType array
[英]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.