Php nuSoap函数不是有效的方法
当尝试实例化我的nuSoap方法authenticateUser时,它说: 致命错误:未捕获的SoapFault异常:[Client]函数authenticateUser不是/Applications/MAMP/htdocs/projo/dev/home.php:14中此服务的有效方法 但是,当我将该方法名称替换为一个已经有效的方法名称时,一切都很好。所以我认为实例化语法没有错Php nuSoap函数不是有效的方法,php,soap,wsdl,nusoap,Php,Soap,Wsdl,Nusoap,当尝试实例化我的nuSoap方法authenticateUser时,它说: 致命错误:未捕获的SoapFault异常:[Client]函数authenticateUser不是/Applications/MAMP/htdocs/projo/dev/home.php:14中此服务的有效方法 但是,当我将该方法名称替换为一个已经有效的方法名称时,一切都很好。所以我认为实例化语法没有错 /*----------- Authenticate User ------------*/ $server->
/*-----------
Authenticate User
------------*/
$server->register(
// method name
'authenticateUser',
// input parameters
array('sessionUserName' => 'xsd:string', 'sessionHash' => 'xsd:string', 'user' => 'xsd:string', 'pass' => 'xsd:string'),
// output parameters
array('return' => 'xsd:string'),
// namespace
$namespace,
// soapaction
$namespace . '#authenticateUser',
// style
'rpc',
// use
'encoded',
// documentation
'authenticates a user and returns a json array of the user info'
);
function authenticateUser($sessionUserName, $sessionHash, $user, $pass)
{
//Check to see if a countryCode was provided
if ($sessionUserName != '' && $sessionHash != '' && $user == $GLOBALS['wsUser'] && $pass == $GLOBALS['wsPass'])
{
$suid = 'AUTH'.$GLOBALS['guid'].'SESSION';
$database = new SQLDatabase();
$database->openConnection();
$database->selectDb();
//Query
$sql = "SELECT * FROM members WHERE member_email='" . $sessionUserName . "' LIMIT 1";
//Query MySQL
$return = $database->query($sql);
$userDetails = $database->fetch_array( $return );
if(!empty($userDetails)) {
$userDetails[0]['authSession'] = $suid;
$newArr = $userDetails[0];
$response = json_encode($newArr);
}
/*print $sql.'<br /><pre>';
print_r($response);
echo '</pre>';*/
//Throw SQL Errors
if (!mysql_query($sql))
{
die('Error: ' . mysql_error());
}
//Return on Success
return $response;
//Close Connection
mysql_close($con);
}
else
{
return 'Error: You must supply all of the inputs!x';
}
}
有两件事会导致这个错误:
更有可能的是:我对函数的注册在某种程度上是不正确的,即使wsdl gui显示函数注册正确,并且我已经能够通过SoapUI程序成功地使用该方法
不太可能:不知何故,函数不再被破坏,而是被缓存了,所以我看到了一个旧错误
问题:当试图通过PHP使用此soap服务方法时,为什么会出现一个输出错误,指出此函数在服务中不存在,而实际上它确实存在?它是缓存!!!愚蠢的我所要做的就是关上电脑上床睡觉。当我醒来时,我再次运行该文件,它就像一个符咒
这是SOAP服务中的函数第二次出现这种情况
现在我需要知道如何清除soap服务的缓存。nuSoap设置
[soap]
; Enables or disables WSDL caching feature.
soap.wsdl_cache_enabled=0
在每个使用soap的文件中,或者在每个文件中启用wsdl\u缓存
在php.ini文件中设置为0
如果您在Linux上,还可以直接从/tmp/dir删除缓存的wsdl文件谢谢!我一直想知道如何取消缓存。
[soap]
; Enables or disables WSDL caching feature.
soap.wsdl_cache_enabled=0