我正在尝试使用ZF2创建Soap服务器。使用以下代码:
use Zend\Soap\Server;
use Zend\Soap\Autodiscover;
class Book {
/** @var string */
public $Code;
/** @var string */
public $Description;
}
class Items {
/** @var Book[] */
public $it;
}
class test{
/**
*
* @param integer $Code
* @return Items
*/
public function readData($Code)
{
$db = new test();
$dbs=$db->connect();
mysql_select_db("db", $dbs);
$statement = mysql_query("SELECT * FROM lookup_branchinfo");
$itemss = new Items();
$add = array();
$add[] = new Book();
while($row = mysql_fetch_array($statement))
{
$add['Code']=$row['Code'];
$add['Description']=$row['Description'];
$itemss->it[]=$add;
}
return $itemss;
}
}
ini_set("soap.wsdl_cache_enabled", 0);
if (isset($_GET['wsdl']))
{
$autodiscover = new AutoDiscover('Zend_Soap_Wsdl_Strategy_ArrayOfTypeComplex');
$autodiscover->setClass('test');
$autodiscover->setUri("http://localhost:10088/ZF1/application/zSoapServer.php");
$autodiscover->handle();
} else
{
$options = array('soap_version' => SOAP_1_2);
$server = new Server("http://localhost:10088/ZF1/application/zSoapServer.php?wsdl", $options);
$server->setClass('test');
$server->setObject(new test());
$server->handle();
}
问题是它无法识别/ vendor / zendframework / zendframework / zend中的库类
我一直试图解决这个问题2天没有运气。我有一个Mac,我已经尝试下载骨架应用程序并运行composer.phar但它没有帮助解决问题。