我有一个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