nuSoap函数不是有效的方法

Kri*_*ian 3 php soap wsdl nusoap

在尝试实例化我的nuSoap方法时authenticateUser,它说:

致命错误:未捕获的SoapFault异常:[Client]函数("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';
    }
}
Run Code Online (Sandbox Code Playgroud)

我能想到的两件事会导致这个错误:

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

  2. 不太可能:不知何故,该函数不再被破坏,但它的缓存,所以我看到一个旧的错误.

问题:当尝试使用此 soap服务方法时PHP,为什么我会收到一个输出错误,指出该功能在服务中不存在,当它显然是?

小智 7

ini_set("soap.wsdl_cache_enabled", "0"); 
Run Code Online (Sandbox Code Playgroud)

在每个文件使用香皂,或设置wsdl_cache_enabled0您的php.ini文件.

[soap]
; Enables or disables WSDL caching feature.
soap.wsdl_cache_enabled=0
Run Code Online (Sandbox Code Playgroud)