我有一個wsdl文件,我試圖從一個php類調用它。我正在使用以下代碼:php和webservices
<?php
include(「dbconn.php」);
類數據類 {
function getCountries()
{
$connection = new dbconn();
$sql = "SELECT * FROM tblcountries";
$dataset = $connection -> connectSql($sql);
return $dataset;
}
function getTest()
{
$connection = new dbconn();
$sql = mysql_query('CALL sp_getTest');
$dataset = $connection -> connectSql($sql);
return $dataset;
}
##-------------------------------------------CUSTOMER METHODS-------------------------------------------
function registerCustomer($username,$name,$surname,$password,$email,$country,$tel)
{
$connection = new dbconn();
$sql="INSERT INTO tblcustomer (customer_username, customer_password, customer_name, customer_surname,
customer_email, customer_country, customer_tel)
VALUES('$username','$name','$surname','$password','$email','$country','$tel')";
$dataset = $connection -> connectSql($sql);
}
ini_set("soap.wsdl_cache_enabled", "0");
// start the SOAP server - point to the wsdl file
$webservice = new SoapServer("http://localhost/dataobjects/myWebservice.wsdl", array('soap_version' => SOAP_1_2));
// publish methods
$webservice->addFunction("getCountries");
$webservice->addFunction("registerCustomer");
// publish
$webservice->handle();
} >
它所有的時間給我ini_set("soap.wsdl_cache_enabled", "0");
該錯誤的問題是:
Parse error: syntax error, unexpected T_STRING, expecting T_FUNCTION in C:\Program Files\xampplite\htdocs\dataobjects\dataClass.php on line 47
你可以發表dataClass.php嗎?您的源代碼看起來沒問題。 – opHASnoNAME 2009-11-04 13:44:10
那麼你在第47行和第47行有什麼?因爲這個ini_set現在肯定會給出這個錯誤,所以它一定是前面的東西。 – 2009-11-04 13:44:18
是的,請看看第47行。實際上,這應該被重新標記爲「第47行」。 – Frankie 2009-11-04 13:45:52