webservice/application/controllers/SinterneController.php
2010-11-15 14:14:33 +00:00

62 lines
1.6 KiB
PHP

<?php
require_once 'framework/fwk.php';
class SinterneController extends Zend_Controller_Action
{
protected $classmap = array();
public function init()
{
$this->_helper->viewRenderer->setNoRender();
}
public function preDispatch()
{
$wsConfig = new Zend_Config_Ini(APPLICATION_PATH .
'/configs/WsInterne.ini');
foreach ($wsConfig->Type 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);
$server->handle();
}
catch (Zend_Exception $e)
{
Zend_Registry::get('log')->err("Sinterne - ".$e->getMessage());
}
}
exit;
}
}