繁体   English   中英

nuSoap Function 不是有效方法

[英]nuSoap Function is Not a Valid method

当试图实例化我的nuSoap方法authenticateUser时,它说:

致命错误:未捕获的 SoapFault 异常:[Client] Function(“authenticateUser”)不是 /Applications/MAMP/htdocs/projo/dev/home.php:14 中此服务的有效方法

但是,当我将该方法名称替换为已经有效的方法名称时,一切正常。 所以我认为实例化语法没有错。

/*-----------
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';
    }
}

我可以想到有两件事会导致此错误:

  1. 更有可能:我对 function 的注册在某种程度上不正确,即使wsdl gui显示 function 已通过正确注册的方法并且我已经能够成功使用SoapUI程序。

  2. 不太可能:不知何故,function 不再损坏,但它被缓存了,所以我看到了一个旧错误。

The Question : When trying to consume this soap service method via PHP , why do I get an output error stating that this function doesn't exist in the service, when it clearly is?

ini_set("soap.wsdl_cache_enabled", "0"); 

在您使用 soap 的每个文件中,或在php.ini文件中将wsdl_cache_enabled设置为0

[soap]
; Enables or disables WSDL caching feature.
soap.wsdl_cache_enabled=0

如果你在 Linux 上,你也可以直接从 /tmp/ 目录中删除缓存的 wsdl 文件

这是CACHE ..,愚蠢的。 我所要做的就是关闭我的电脑和 go 睡觉。 当我醒来时,我再次运行该文件,它就像一个魅力。

这是 SOAP 服务中的 function 第二次发生这种情况。

现在我需要知道如何清除 soap 服务的缓存。 (nuSoap)

暂无
暂无

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

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