2010-10-20 12:21:35 +00:00
|
|
|
<?php
|
|
|
|
class SinterneController extends Zend_Controller_Action
|
|
|
|
{
|
|
|
|
protected $classmap = array();
|
|
|
|
|
|
|
|
public function init()
|
|
|
|
{
|
|
|
|
$this->_helper->viewRenderer->setNoRender();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function preDispatch()
|
|
|
|
{
|
2010-10-25 14:29:50 +00:00
|
|
|
$wsConfig = new Zend_Config_Ini(APPLICATION_PATH .
|
|
|
|
'/configs/WsInterne.ini');
|
|
|
|
foreach ($wsConfig->Type as $type){
|
2010-10-20 12:21:35 +00:00
|
|
|
$this->classmap[$type] = $type;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function indexAction()
|
|
|
|
{
|
|
|
|
// action body
|
|
|
|
require_once 'Zend/Exception.php';
|
|
|
|
require_once 'Zend/Soap/AutoDiscover.php';
|
|
|
|
require_once 'Zend/Soap/Server.php';
|
|
|
|
require_once 'WsScore/WsInterne.php';
|
|
|
|
require_once 'WsScore/WrappedServiceProxy.php';
|
|
|
|
|
|
|
|
// Fourniture du wsdl
|
|
|
|
if (isset($_GET['wsdl']))
|
|
|
|
{
|
|
|
|
// Définition du webservice
|
|
|
|
$wsdl = new Zend_Soap_AutoDiscover();
|
|
|
|
$wsdl->setComplexTypeStrategy(Zend_Soap_Wsdl_Strategy_ArrayOfTypeSequence);
|
|
|
|
$wsdl->setOperationBodyStyle( array('use' => 'literal') );
|
|
|
|
$wsdl->setBindingStyle( array('style' => 'document') );
|
|
|
|
$wsdl->setClass('WsInterne');
|
|
|
|
$wsdl->handle();
|
|
|
|
}
|
|
|
|
// Fourniture du service
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// traitement
|
|
|
|
try
|
|
|
|
{
|
|
|
|
$hostName = $this->getRequest()->getHttpHost();
|
|
|
|
$server = new Zend_Soap_Server('http://'.$hostName.'/sinterne?wsdl');
|
|
|
|
$proxy = new WrappedService_Proxy('WsInterne', array(), array('wrappedParts' => true));
|
|
|
|
$server->setObject($proxy);
|
|
|
|
$server->setClassmap($this->classmap);
|
|
|
|
|
|
|
|
//@todo Vérifier l'utilisateur, sinon renvoyé erreur soap
|
|
|
|
//$server->fault();
|
|
|
|
$server->handle();
|
|
|
|
|
|
|
|
} catch (Zend_Exception $e) {
|
2010-10-25 14:29:50 +00:00
|
|
|
Zend_Registry::get('log')->err("Sinterne - ".$e->getMessage());
|
2010-10-20 12:21:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
}
|