2010-08-30 07:49:44 +00:00
|
|
|
<?php
|
|
|
|
require_once realpath(dirname(__FILE__)).'/functions.php';
|
2010-09-09 11:58:34 +00:00
|
|
|
require_once realpath(dirname(__FILE__)).'/Types/Types.php';
|
2010-08-30 07:49:44 +00:00
|
|
|
|
|
|
|
define ('WEBSERVICE_URL','http://78.31.45.206/ws2/');
|
|
|
|
define ('WEBSERVICE_URI','http://78.31.45.206/');
|
|
|
|
|
2010-09-13 09:54:49 +00:00
|
|
|
class WsEntreprise
|
|
|
|
{
|
2010-08-30 07:49:44 +00:00
|
|
|
/**
|
|
|
|
* Retourne les informations identitaires de l'entreprise ou de l'établissement demandé
|
|
|
|
* @param string $siret
|
|
|
|
* @param integer $id
|
|
|
|
* @param boolean $forceVerif
|
2010-09-08 13:40:57 +00:00
|
|
|
* @return IdentiteReturnType
|
2010-08-30 07:49:44 +00:00
|
|
|
*/
|
2010-09-13 09:54:49 +00:00
|
|
|
function getIdentite($siret, $id = 0, $forceVerif = false)
|
|
|
|
{
|
2010-09-08 13:40:57 +00:00
|
|
|
//Enregistrement des accès à la requête getIdentite
|
|
|
|
Zend_Registry::get('log')->info("getIdentite - ip:".
|
|
|
|
$_SERVER['REMOTE_ADDR'].", login:".$_SERVER['PHP_AUTH_USER'].
|
|
|
|
", pass:".$_SERVER['PHP_AUTH_PW']);
|
2010-09-13 09:54:49 +00:00
|
|
|
|
|
|
|
//Récupérer les paramètres d'accès au webservice scores
|
|
|
|
$webservicesConfig = Zend_Registry::get('webservicesConfig')->webservice->scores;
|
|
|
|
$wsdl = !empty($webservicesConfig->wsdl) ? $webservicesConfig->wsdl : null ;
|
|
|
|
$options = array();
|
|
|
|
foreach ($webservicesConfig->options as $optionName => $optionValue){
|
|
|
|
$options[$optionName] = $optionValue;
|
|
|
|
}
|
|
|
|
$options['login'] = $_SERVER['PHP_AUTH_USER'];
|
|
|
|
$options['password'] = $_SERVER['PHP_AUTH_PW'];
|
|
|
|
|
|
|
|
Zend_Registry::get('log')->info('OPTIONS : '.serialize($options));
|
2010-09-08 13:40:57 +00:00
|
|
|
//Connexion aux webservices V1
|
2010-08-30 07:49:44 +00:00
|
|
|
try {
|
2010-09-13 09:54:49 +00:00
|
|
|
$client = new SoapClient($wsdl, $options);
|
2010-08-30 07:49:44 +00:00
|
|
|
$O = $client->getIdentite($siret, $idEntreprise, $forceVerif);
|
|
|
|
} catch (SoapFault $fault) {
|
2010-09-08 13:40:57 +00:00
|
|
|
Zend_Registry::get('log')->err("getIdentite($siret, $idEntreprise) - ".serialize($fault));
|
2010-08-30 07:49:44 +00:00
|
|
|
}
|
2010-09-08 13:40:57 +00:00
|
|
|
//Gestion du retour
|
2010-08-30 07:49:44 +00:00
|
|
|
$error = new ErrorType();
|
|
|
|
$error = array_to_object($O['error']);
|
|
|
|
$result = new IdentiteResultType();
|
|
|
|
$result = array_to_object($O['result']);
|
|
|
|
$outputParams = new IdentiteReturnType();
|
|
|
|
$outputParams->error = $error;
|
|
|
|
$outputParams->result = $result;
|
|
|
|
return $outputParams;
|
|
|
|
}
|
2010-09-08 13:40:57 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Recherche
|
|
|
|
* @param RechercheEntrepriseType $criteres
|
|
|
|
* @void
|
|
|
|
*/
|
|
|
|
function rechercheEntreprise($criteres){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
$O = $client->searchNomAdr($raisonSociale, $numVoie.' '.$libVoie,
|
|
|
|
$cp, $ville, false, false, $position,
|
|
|
|
$tabInfo['nbReponses'], 200, false, false,
|
|
|
|
$naf);
|
|
|
|
*/
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Retourne le status du webservice
|
|
|
|
* @return StatusResultType
|
|
|
|
*/
|
|
|
|
function status(){
|
2010-09-13 09:54:49 +00:00
|
|
|
/* @todo tester les différents éléments qui peuvent conduire
|
|
|
|
* à un problème dans les services tel que la connexion à la
|
|
|
|
* base de données, l'accès FTP, l'accès HTTP, l'accès système de fichier
|
2010-09-08 13:40:57 +00:00
|
|
|
*/
|
|
|
|
$error = new StatusResultTypes();
|
|
|
|
$error->errCode = 0;
|
|
|
|
$error->errMsg = 'Services disponible';
|
|
|
|
return $error;
|
|
|
|
}
|
|
|
|
|
2010-08-30 07:49:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
?>
|