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