2013-09-01 45 views
0

我想使用nusoap包來處理一些web服務。根據的NuSOAP的文檔,我們首先必須包括nusoap.php我們的PHP腳本,然後寫其他代碼...使用nusoap獲取服務器500錯誤

http://www.scottnichol.com/nusoapintro.htm

但是當我包括nusoap.php我這樣的代碼:

require_once('nusoap.php'); 

我得到一個服務器的500錯誤,說(IE 10):

Most likely causes: 
    •The website is under maintenance. 
    •The website has a programming error. 

,但我不明白什麼是它的諸CAU ...我啓用的error_reporting在php.ini,但它does notnt顯示任何錯誤,它說服務器500錯誤!
什麼是problrm?我怎麼能更多地瞭解這個問題的原因?

回答

0

我最近有完全相同的問題。這是我創建的第一個Web服務,我什麼都不知道,所以我的問題的原因是我自己的愚蠢。

這是什麼樣子:

error_reporting(E_ALL); 
require_once("lib/nusoap.php"); 
$namespace = "http://www.mywebsite.com/services"; 

$server = new soap_server(); 
$server->configureWSDL("TestService"); 
$server->wsdl->schemaTargetNamespace = $namespace; 

$server->register('TestFunction', array('test'=>'xsd:string'), array('return'=>'xsd:string'), $namespace, false, 'rpc', 'encoded', 'Function for evaluation of SOAP'); 

$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : ''; 
$server->service($HTTP_RAW_POST_DATA); 

所以你看,我剛纔忘了定義函數..

以下工作:

error_reporting(E_ALL); 
require_once("lib/nusoap.php"); 
$namespace = "http://www.mywebsite.com/services"; 

$server = new soap_server(); 
$server->configureWSDL("TestService"); 
$server->wsdl->schemaTargetNamespace = $namespace; 

$server->register('TestFunction', array('test'=>'xsd:string'), array('return'=>'xsd:string'), $namespace, false, 'rpc', 'encoded', 'Function for evaluation of SOAP'); 

function TestFunction($test) { 
    return "Response: ".$test; 
} 

$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : ''; 
$server->service($HTTP_RAW_POST_DATA); 

我希望我能幫助您。