Hey all,
I’m trying to set up a SOAP server, but I’ve thus far been unable to use the classMap functionality with namespaced classes.
This is the controller:
<?php
class SoapController extends Controller
{
public function actions() {
return array(
'index'=>array(
'class'=>'CWebServiceAction',
'classMap'=>array('PortalNews'=>'application.services.Db1.PortalNews'),
),
);
}
/**
* @param int $limiet het maximaal aantal gewenste nieuwsberichten
* @return PortalNews[] $newsitems de meest recente nieuwsberichten
* @soap
*/
public function getRecentNews($limiet) {
$model = Service\Db1\PortalNews::model();
$newsitems = $model->search()->getData();
return $newsitems;
}
The code for the PortalNews class, residing in \services\Db1
<?php
namespace Service\Db1;
use \Yii as Yii;
use \PDO as PDO;
class PortalNews extends \CActiveRecord
{
/** @soap @var int */
public $id;
// More code
When calling getRecentNews(4) in a client, I get the following error:
PHP warning
SoapClient::SoapClient(/* link to server */) [<a href=‘soapserver.soapserver’>soapserver.soapserver</a>]: failed to open stream: HTTP request failed! HTTP/1.0 500 Internal Server Error
It does work if I use object[] instead of PortalNews[]
I also tried using the Post instead of the PortalNews class from the Yii SOAP example page, which worked too