70 lines
1.8 KiB
PHP
70 lines
1.8 KiB
PHP
|
<?php
|
||
|
class SinterneController extends Zend_Controller_Action
|
||
|
{
|
||
|
protected $classmap = array();
|
||
|
|
||
|
public function init()
|
||
|
{
|
||
|
$this->_helper->viewRenderer->setNoRender();
|
||
|
}
|
||
|
|
||
|
public function preDispatch()
|
||
|
{
|
||
|
$bootstrap = $this->getInvokeArg('bootstrap');
|
||
|
$appConfig = $bootstrap->getOptions();
|
||
|
$types = $appConfig['classmap']['WsInterne']['Type'];
|
||
|
foreach ($types as $type){
|
||
|
$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) {
|
||
|
//Enregistrement des erreurs
|
||
|
/*
|
||
|
* $e->getMessage()
|
||
|
* $e->getCode()
|
||
|
* $e->getFile()
|
||
|
* $e->getLine()
|
||
|
*/
|
||
|
}
|
||
|
}
|
||
|
exit;
|
||
|
}
|
||
|
}
|