2011-06-30 27 views
3

當試圖實例我nuSoap方法authenticateUser,它說:的NuSOAP功能是不是一個有效方法

Fatal error: Uncaught SoapFault exception: [Client] Function ("authenticateUser") is not a valid method for this service in /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. 更可能的是:我的功能的註冊是有點不正確,即使WSDL GUI表明,功能已正確註冊,並且我已經能夠通過SoapUI程序成功使用該方法。

  2. 不太可能:不知何故,該功能不會中斷,但它的緩存,所以我看到一箇舊的錯誤。

問題:當試圖通過消費這個PHP服務soap方法,爲什麼我得到一個輸出錯誤,指出此功能不會在服務中存在,當它顯然是?

回答

7

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

中的每個文件使用香皂,或設置wsdl_cache_enabled0php.ini文件。

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

感謝刪除緩存wsdl文件!我一直想弄清楚如何取消緩存。 – Kristian

1

這是CACHE !!!笨。我所要做的就是關閉電腦並上牀睡覺。當我醒來時,我再次運行該文件,它像一個魅力一樣工作。

這是SOAP服務中第二次發生這種情況。

現在我需要知道如何清除肥皂服務的緩存。 (的NuSOAP)

2

如果你是在Linux上,您也可以直接從的/ tmp /目錄

相關問題