Traitement HTTPS

This commit is contained in:
Michael RICOIS 2017-03-30 17:11:36 +02:00
parent 4dd354504e
commit b4acea6de5

View File

@ -78,6 +78,7 @@ class ServiceController extends Zend_Controller_Action
} else {
$pathServiceUrl = 'clients/'.$client.'/v'.$version.'?wsdl';
}
$pathServiceUri = 'clients/'.$client.'/v'.$version;
// --- On redéfini le nom du service
$serviceClassName = 'Entreprise';
$fichierWsdl = $clientClassName.'-'.$serviceClassName.'-'.$version.'.wsdl';
@ -92,6 +93,7 @@ class ServiceController extends Zend_Controller_Action
} else {
$pathServiceUrl = $serviceName.'/v'.$version.'?wsdl';
}
$pathServiceUri = $serviceName.'/v'.$version;
$fichierWsdl = $serviceClassName.'-'.$version.'.wsdl';
}
@ -104,6 +106,11 @@ class ServiceController extends Zend_Controller_Action
// --- Get hostname - add compatibility with Reverse Proxy
$hostName = $request->getHttpHost();
$hostScheme = $request->getScheme();
$http = new Zend_Controller_Request_Http();
$proxyScheme = $http->getHeader('X-Forwarded-Proto');
if ($proxyScheme == 'https') {
$hostScheme = 'https';
}
$fichierWsdl = $hostName . '-' . $hostScheme . '-' . $fichierWsdl;
$c = Zend_registry::get('config');
$wsdlPath = $c->profil->path->shared . '/wsdl';
@ -124,6 +131,10 @@ class ServiceController extends Zend_Controller_Action
$wsdl->setBindingStyle(array('style' => 'document'));
$wsdl->setClass($serviceClassName);
if ($hostScheme == 'https') {
$wsdl->setUri($hostScheme.'://'.$hostName.'/'.$pathServiceUri);
}
// --- Enregistrement du WSDL dans un fichier
if (isset($_GET['wsdl-generate'])) {
if (file_exists($wsdlPath . '/' . $fichierWsdl)) {
@ -131,7 +142,6 @@ class ServiceController extends Zend_Controller_Action
}
$wsdl->dump($wsdlPath . '/' . $fichierWsdl);
echo "Le fichier $fichierWsdl a été généré";
// --- Génération/Fourniture du wsdl
} elseif (isset($_GET['wsdl']) && !file_exists($wsdlPath . '/' . $fichierWsdl)) {
$wsdl->dump($wsdlPath . '/' . $fichierWsdl);