Hi,
When implementing a SOAP server, I encountered several weird things. I'm not sure if these are expected/intentional behavior or not.
Relevant portions of the Controller code:
public function actions()
{
return array(
'ws'=> array(
'class'=> 'CWebServiceAction',
'classMap'=> array(
'positionDTO'=>'Location',
'pointDTO'=>'Point'
),
'wsdlUrl'=> $this->createAbsoluteUrl('wsdl'),
),
);
}
public function actionWsdl()
{
$this->renderFile($this->viewPath . '/FrontEndService.wsdl');
}
public function setLocation($positions)
{
Yii::log(print_r($positions, true));
$response->completed = false;
return $response;
}
Location code:
protected function afterConstruct()
{
parent::afterConstruct();
Yii::log('Location constructed');
}
The request is handled fine, and Location/Point objects get marshaled fine as well. However, two things with this code are behaving differently than I'd expected:
-
Calling controller/ws returns WSDL generated by reflection. Since I've supplied a WSDL myself through wsdlUrl, I'd expect it to return that WSDL.
-
The 'afterConstruct' method in Location is not called. This seems to be caused by CActiveRecord being constructed without arguments by the soap server, so the code at line 376 (if($attributes===null) return;) causes it not to execute the rest of the constructor.
I could of course call 'afterConstruct' manually in setLocation for each position, but I was expecting this to happen automatically.
Could you please explain if these two are intentional behavior, bug, or something that's just better done in a different fashion?