Add new code to manage webservice connection
This commit is contained in:
parent
f1f025e8c3
commit
33b66b0df3
160
library/Scores/Ws.php
Normal file
160
library/Scores/Ws.php
Normal file
@ -0,0 +1,160 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Load User Info
|
||||
*/
|
||||
require_once 'Scores/Utilisateur.php';
|
||||
|
||||
|
||||
/**
|
||||
* Distribute Scores Webservice
|
||||
*/
|
||||
class Scores_Ws
|
||||
{
|
||||
/**
|
||||
* User login
|
||||
* @var string
|
||||
*/
|
||||
protected $login = null;
|
||||
|
||||
/**
|
||||
* Password
|
||||
* @var string
|
||||
*/
|
||||
protected $password = null;
|
||||
|
||||
/**
|
||||
* Enable/Disable Cache
|
||||
* @var boolean
|
||||
*/
|
||||
protected $cache = true;
|
||||
|
||||
/**
|
||||
* Enable/Disable cache writing
|
||||
* Override the cache flag
|
||||
* @var boolean
|
||||
*/
|
||||
protected $cacheWrite = true;
|
||||
|
||||
/**
|
||||
* Number of response
|
||||
* @var int
|
||||
*/
|
||||
protected $nbReponses = 20;
|
||||
|
||||
protected $obj = null;
|
||||
|
||||
/**
|
||||
* Scores_Ws
|
||||
* @param string $login
|
||||
* @param string $password
|
||||
*/
|
||||
public function __construct($login = null, $password = null)
|
||||
{
|
||||
if ( !empty($login) && !empty($password) ){
|
||||
$this->login = $login;
|
||||
$this->password = $password;
|
||||
} else {
|
||||
$user = new Scores_Utilisateur();
|
||||
$this->login = $user->getLogin();
|
||||
$this->password = $user->getPassword();
|
||||
$this->nbReponses = $user->getNbRep();
|
||||
if ( $user->checkModeEdition() ) {
|
||||
//Disable cache
|
||||
$this->cache = false;
|
||||
//Don't write cache
|
||||
if ( APPLICATION_ENV == 'staging' ) {
|
||||
$this->cacheWrite = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Distribute call on each separate class for each service
|
||||
* Schema for $name is {Class}_{Method}
|
||||
* @param string $name
|
||||
* @param array $args
|
||||
* @return mixed
|
||||
*/
|
||||
public function __call($name, $args)
|
||||
{
|
||||
$response = false;
|
||||
|
||||
$pos = strpos($name, '_');
|
||||
$className = substr($name, 0, $pos);
|
||||
$methodName = substr($name, $pos+1);
|
||||
|
||||
$objR = new ReflectionClass('Scores_Ws_'.$className);
|
||||
|
||||
$this->obj = $objR->newInstance($methodName);
|
||||
$this->obj->setSoapClientOption('login', $this->login);
|
||||
$this->obj->setSoapClientOption('password', $this->password);
|
||||
|
||||
//Check cache
|
||||
if ($this->cacheWrite && $this->obj->getCache()) {
|
||||
$filename = $this->obj->getFilename();
|
||||
$cache = new Cache($filename);
|
||||
if ($cache->exist() && $this->cacheEnable ){
|
||||
$response = $cache->getBlock();
|
||||
}
|
||||
}
|
||||
//Execute the request
|
||||
else {
|
||||
call_user_func_array(array($this->obj, $methodName), $args);
|
||||
if ( !$this->obj->isError() || !$this->obj->isMessage() ) {
|
||||
$response = $obj->getSoapResponse();
|
||||
//Put in cache the response
|
||||
if ($this->cacheWrite && $obj->getCache()) {
|
||||
$cache->deletefile();
|
||||
$cache->setBlock($responses);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Type du retour
|
||||
* @return string
|
||||
* ERR or MSG
|
||||
*/
|
||||
public function getResponseType()
|
||||
{
|
||||
if ( $this->obj->isError() ) {
|
||||
return 'ERR';
|
||||
} elseif ( $this->obj->isMessage() ) {
|
||||
return 'MSG';
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Message de retour pour affichage
|
||||
* @return string
|
||||
*/
|
||||
public function getResponseMsg()
|
||||
{
|
||||
return $this->obj->getMessage();
|
||||
}
|
||||
|
||||
/**
|
||||
* Retourne les éléments pour debuggage
|
||||
* @return object
|
||||
*/
|
||||
public function getError()
|
||||
{
|
||||
$error = new stdClass();
|
||||
$error->service = $this->obj->getServiceName();
|
||||
$error->method = $this->obj->getMethodName();
|
||||
//Request Parameter
|
||||
$error->args = $this->obj->getParams();
|
||||
$error->faultCode = $this->obj->getFaultCode();
|
||||
$error->faultMessage = $this->obj->getMessage();
|
||||
|
||||
return $error;
|
||||
}
|
||||
}
|
254
library/Scores/Ws/Abstract.php
Normal file
254
library/Scores/Ws/Abstract.php
Normal file
@ -0,0 +1,254 @@
|
||||
<?php
|
||||
require_once 'Scores/Ws/Config.php';
|
||||
|
||||
/** @see Scores_Ws_Interface */
|
||||
require_once 'Scores/Ws/Interface.php';
|
||||
|
||||
/**
|
||||
* Abstract class for Scores_Ws.
|
||||
*/
|
||||
abstract class Scores_Ws_Abstract implements Scosres_Ws_Interface
|
||||
{
|
||||
/**
|
||||
* Service name
|
||||
* @var string
|
||||
*/
|
||||
protected $service = null;
|
||||
|
||||
/**
|
||||
* Method Name
|
||||
* @var string
|
||||
*/
|
||||
protected $method = null;
|
||||
|
||||
/**
|
||||
* Params for soap call as stdClass
|
||||
* @var stdClass
|
||||
*/
|
||||
protected $params = null;
|
||||
|
||||
/**
|
||||
* Default max response
|
||||
* @var int
|
||||
*/
|
||||
protected $nbReponses = 20;
|
||||
|
||||
/**
|
||||
* Set to false to disable cache for one method
|
||||
* @var boolean
|
||||
*/
|
||||
protected $cache = true;
|
||||
|
||||
/**
|
||||
* WSDL URI
|
||||
* @var string
|
||||
*/
|
||||
protected $wsdl = null;
|
||||
|
||||
/**
|
||||
* Options for WSDL
|
||||
* @var array
|
||||
*/
|
||||
protected $options = array();
|
||||
|
||||
/**
|
||||
* Soap Response
|
||||
* @var object
|
||||
*/
|
||||
protected $response = null;
|
||||
|
||||
/**
|
||||
* 0 = no error
|
||||
* 1 = error
|
||||
* 2 = message
|
||||
* @var int
|
||||
*/
|
||||
protected $error = 0;
|
||||
|
||||
/**
|
||||
* Error / Message
|
||||
* @var string
|
||||
*/
|
||||
protected $message = '';
|
||||
|
||||
/**
|
||||
* Original soap fault code
|
||||
* @var string
|
||||
*/
|
||||
protected $faultcode = null;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$config = new Scores_Ws_Config();
|
||||
$config->setLocation('local');
|
||||
$serviceConfig = $config->getService($this->service);
|
||||
|
||||
$this->setSoapClientWsdl($serviceConfig['wsdl']);
|
||||
|
||||
foreach ( $serviceConfig['options'] as $name => $value ) {
|
||||
$this->setSoapClientOption($name, $value);
|
||||
}
|
||||
|
||||
$this->setSoapClientOption('features', SOAP_USE_XSI_ARRAY_TYPE + SOAP_SINGLE_ELEMENT_ARRAYS);
|
||||
$this->setSoapClientOption('compression', SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP | SOAP_COMPRESSION_DEFLATE);
|
||||
$this->setSoapClientOption('trace', true);
|
||||
$this->setSoapClientOption('encoding', 'utf-8');
|
||||
|
||||
if (APPLICATION_ENV == 'development'){
|
||||
$this->setSoapClientOption('cache_wsdl', WSDL_CACHE_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* (non-PHPdoc)
|
||||
* @see Scores_Ws_Service_Interface::setService()
|
||||
*/
|
||||
public function setService($name)
|
||||
{
|
||||
$this->service = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* (non-PHPdoc)
|
||||
* @see Scores_Ws_Interface::getServiceName()
|
||||
*/
|
||||
public function getServiceName()
|
||||
{
|
||||
return $this->service;
|
||||
}
|
||||
|
||||
/**
|
||||
* (non-PHPdoc)
|
||||
* @see Scores_Ws_Interface::getMethodName()
|
||||
*/
|
||||
public function getMethodName()
|
||||
{
|
||||
return $this->method;
|
||||
}
|
||||
|
||||
/**
|
||||
* (non-PHPdoc)
|
||||
* @see Scores_Ws_Interface::getParams()
|
||||
*/
|
||||
public function getParams()
|
||||
{
|
||||
return var_export($this->params, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* (non-PHPdoc)
|
||||
* @see Scores_Ws_Interface::getFaultCode()
|
||||
*/
|
||||
public function getFaultCode()
|
||||
{
|
||||
return $this->faultcode;
|
||||
}
|
||||
|
||||
/**
|
||||
* (non-PHPdoc)
|
||||
* @see Scores_Ws_Service_Interface::setNbReponses()
|
||||
*/
|
||||
public function setNbReponses($nb)
|
||||
{
|
||||
$this->nbReponses = $nb;
|
||||
}
|
||||
|
||||
/**
|
||||
* (non-PHPdoc)
|
||||
* @see Scores_Ws_Service_Interface::setSoapClientWsdl()
|
||||
*/
|
||||
public function setSoapClientWsdl($wsdl = null)
|
||||
{
|
||||
$this->wsdl = $wsdl;
|
||||
}
|
||||
|
||||
/**
|
||||
* (non-PHPdoc)
|
||||
* @see Scores_Ws_Service_Interface::setSoapClientOption()
|
||||
*/
|
||||
public function setSoapClientOption($name = null , $value = null)
|
||||
{
|
||||
$this->options[$name] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* (non-PHPdoc)
|
||||
* @see Scores_Ws_Service_Interface::getSoapClient()
|
||||
*/
|
||||
public function getSoapClient()
|
||||
{
|
||||
$client = false;
|
||||
try {
|
||||
$client = new SoapClient($this->wsdl, $this->options);
|
||||
} catch (Exception $e) {
|
||||
throw new Exception('Application Error');
|
||||
}
|
||||
return $client;
|
||||
}
|
||||
|
||||
/**
|
||||
* (non-PHPdoc)
|
||||
* @see Scores_Ws_Service_Interface::isError()
|
||||
*/
|
||||
public function isError()
|
||||
{
|
||||
if ( $this->error == 1 ) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* (non-PHPdoc)
|
||||
* @see Scores_Ws_Service_Interface::isMessage()
|
||||
*/
|
||||
public function isMessage()
|
||||
{
|
||||
if ( $this->error == 2 ) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* (non-PHPdoc)
|
||||
* @see Scores_Ws_Service_Interface::getSoapResponse()
|
||||
*/
|
||||
public function getSoapResponse()
|
||||
{
|
||||
return $this->response;
|
||||
}
|
||||
|
||||
/**
|
||||
* (non-PHPdoc)
|
||||
* @see Scores_Ws_Service_Interface::getMessage()
|
||||
*/
|
||||
public function getMessage()
|
||||
{
|
||||
return $this->message;
|
||||
}
|
||||
|
||||
/**
|
||||
* (non-PHPdoc)
|
||||
* @see Scores_Ws_Service_Interface::getFilename()
|
||||
*/
|
||||
public function getFilename($method, $args)
|
||||
{
|
||||
$filename = $this->service . '-' . $method . '-' . implode('-', $args);
|
||||
return $filename;
|
||||
}
|
||||
|
||||
public function getCache()
|
||||
{
|
||||
return $this->cache;
|
||||
}
|
||||
|
||||
public function setCache($enable = true)
|
||||
{
|
||||
$this->cache = $enable;
|
||||
}
|
||||
|
||||
}
|
229
library/Scores/Ws/Config.php
Normal file
229
library/Scores/Ws/Config.php
Normal file
@ -0,0 +1,229 @@
|
||||
<?php
|
||||
/**
|
||||
* WebService Configuration
|
||||
*/
|
||||
class Scores_Ws_Config
|
||||
{
|
||||
protected $location = null;
|
||||
|
||||
protected $services = array(
|
||||
//Local
|
||||
'local' => array(
|
||||
'interne' => array(
|
||||
'wsdl' => "http://webservice-2.4.sd.dev/interne/v0.6?wsdl-auto",
|
||||
'options' => array(
|
||||
'soap_version' => SOAP_1_2
|
||||
),
|
||||
),
|
||||
'entreprise' => array(
|
||||
'wsdl' => "http://webservice-2.4.sd.dev/entreprise/v0.8?wsdl-auto",
|
||||
'options' => array(
|
||||
'soap_version' => SOAP_1_2
|
||||
),
|
||||
),
|
||||
'gestion' => array(
|
||||
'wsdl' => "http://webservice-2.4.sd.dev/gestion/v0.3?wsdl-auto",
|
||||
'options' => array(
|
||||
'soap_version' => SOAP_1_2
|
||||
),
|
||||
),
|
||||
'saisie' => array(
|
||||
'wsdl' => "http://webservice-2.4.sd.dev/saisie/v0.2?wsdl-auto",
|
||||
'options' => array(
|
||||
'soap_version' => SOAP_1_2
|
||||
),
|
||||
),
|
||||
'pieces' => array(
|
||||
'wsdl' => "http://webservice-2.4.sd.dev/pieces/v0.1?wsdl-auto",
|
||||
'options' => array(
|
||||
'soap_version' => SOAP_1_2
|
||||
),
|
||||
),
|
||||
'catalog' => array(
|
||||
'wsdl' => "http://webservice-2.4.sd.dev/catalog/v0.1?wsdl-auto",
|
||||
'options' => array(
|
||||
'soap_version' => SOAP_1_2
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
//Development
|
||||
'development' => array(
|
||||
'interne' => array(
|
||||
'wsdl' => "http://webservice-2.4.sd.lan/interne/v0.6?wsdl-auto",
|
||||
'options' => array(
|
||||
'soap_version' => SOAP_1_2
|
||||
),
|
||||
),
|
||||
'entreprise' => array(
|
||||
'wsdl' => "http://webservice-2.4.sd.lan/entreprise/v0.8?wsdl-auto",
|
||||
'options' => array(
|
||||
'soap_version' => SOAP_1_2
|
||||
),
|
||||
),
|
||||
'gestion' => array(
|
||||
'wsdl' => "http://webservice-2.4.sd.lan/gestion/v0.3?wsdl-auto",
|
||||
'options' => array(
|
||||
'soap_version' => SOAP_1_2
|
||||
),
|
||||
),
|
||||
'saisie' => array(
|
||||
'wsdl' => "http://webservice-2.4.sd.lan/saisie/v0.2?wsdl-auto",
|
||||
'options' => array(
|
||||
'soap_version' => SOAP_1_2
|
||||
),
|
||||
),
|
||||
'pieces' => array(
|
||||
'wsdl' => "http://webservice-2.4.sd.lan/pieces/v0.1?wsdl-auto",
|
||||
'options' => array(
|
||||
'soap_version' => SOAP_1_2
|
||||
),
|
||||
),
|
||||
'catalog' => array(
|
||||
'wsdl' => "http://webservice-2.4.sd.lan/catalog/v0.1?wsdl-auto",
|
||||
'options' => array(
|
||||
'soap_version' => SOAP_1_2
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
//sd-25137
|
||||
'sd-25137' => array(
|
||||
'interne' => array(
|
||||
'wsdl' => "http://wse.scores-decisions.com:8081/interne/v0.6?wsdl",
|
||||
'options' => array(
|
||||
'soap_version' => SOAP_1_2
|
||||
),
|
||||
),
|
||||
'entreprise' => array(
|
||||
'wsdl' => "http://wse.scores-decisions.com:8081/entreprise/v0.8?wsdl",
|
||||
'options' => array(
|
||||
'soap_version' => SOAP_1_2
|
||||
),
|
||||
),
|
||||
'gestion' => array(
|
||||
'wsdl' => "http://wse.scores-decisions.com:8081/gestion/v0.3?wsdl",
|
||||
'options' => array(
|
||||
'soap_version' => SOAP_1_2
|
||||
),
|
||||
),
|
||||
'saisie' => array(
|
||||
'wsdl' => "http://wse.scores-decisions.com:8081/saisie/v0.2?wsdl",
|
||||
'options' => array(
|
||||
'soap_version' => SOAP_1_2
|
||||
),
|
||||
),
|
||||
'pieces' => array(
|
||||
'wsdl' => "http://wse.scores-decisions.com:8081/pieces/v0.1?wsdl",
|
||||
'options' => array(
|
||||
'soap_version' => SOAP_1_2
|
||||
),
|
||||
),
|
||||
'catalog' => array(
|
||||
'wsdl' => "http://wse.scores-decisions.com:8081/catalog/v0.1?wsdl",
|
||||
'options' => array(
|
||||
'soap_version' => SOAP_1_2
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
//Celeste
|
||||
'celeste' => array(
|
||||
'interne' => array(
|
||||
'wsdl' => "http://wse.scores-decisions.com:8081/interne/v0.6?wsdl",
|
||||
'options' => array(
|
||||
'soap_version' => SOAP_1_2
|
||||
),
|
||||
),
|
||||
'entreprise' => array(
|
||||
'wsdl' => "http://wse.scores-decisions.com:8081/entreprise/v0.8?wsdl",
|
||||
'options' => array(
|
||||
'soap_version' => SOAP_1_2
|
||||
),
|
||||
),
|
||||
'gestion' => array(
|
||||
'wsdl' => "http://wse.scores-decisions.com:8081/gestion/v0.3?wsdl",
|
||||
'options' => array(
|
||||
'soap_version' => SOAP_1_2
|
||||
),
|
||||
),
|
||||
'saisie' => array(
|
||||
'wsdl' => "http://wse.scores-decisions.com:8081/saisie/v0.2?wsdl",
|
||||
'options' => array(
|
||||
'soap_version' => SOAP_1_2
|
||||
),
|
||||
),
|
||||
'pieces' => array(
|
||||
'wsdl' => "http://wse.scores-decisions.com:8081/pieces/v0.1?wsdl",
|
||||
'options' => array(
|
||||
'soap_version' => SOAP_1_2
|
||||
),
|
||||
),
|
||||
'catalog' => array(
|
||||
'wsdl' => "http://wse.scores-decisions.com:8081/catalog/v0.1?wsdl",
|
||||
'options' => array(
|
||||
'soap_version' => SOAP_1_2
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
//Celeste Staging
|
||||
'celeste-staging' => array(
|
||||
'interne' => array(
|
||||
'wsdl' => "http://wsrec.scores-decisions.com:8000/interne/v0.6?wsdl",
|
||||
'options' => array(
|
||||
'soap_version' => SOAP_1_2
|
||||
),
|
||||
),
|
||||
'entreprise' => array(
|
||||
'wsdl' => "http://wsrec.scores-decisions.com:8000/interne/v0.6?wsdl",
|
||||
'options' => array(
|
||||
'soap_version' => SOAP_1_2
|
||||
),
|
||||
),
|
||||
'gestion' => array(
|
||||
'wsdl' => "http://wsrec.scores-decisions.com:8000/interne/v0.6?wsdl",
|
||||
'options' => array(
|
||||
'soap_version' => SOAP_1_2
|
||||
),
|
||||
),
|
||||
'saisie' => array(
|
||||
'wsdl' => "http://wsrec.scores-decisions.com:8000/interne/v0.6?wsdl",
|
||||
'options' => array(
|
||||
'soap_version' => SOAP_1_2
|
||||
),
|
||||
),
|
||||
'pieces' => array(
|
||||
'wsdl' => "http://wsrec.scores-decisions.com:8000/interne/v0.6?wsdl",
|
||||
'options' => array(
|
||||
'soap_version' => SOAP_1_2
|
||||
),
|
||||
),
|
||||
'catalog' => array(
|
||||
'wsdl' => "http://wsrec.scores-decisions.com:8000/interne/v0.6?wsdl",
|
||||
'options' => array(
|
||||
'soap_version' => SOAP_1_2
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function setLocation($name)
|
||||
{
|
||||
$this->location = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return service parameters
|
||||
* @param string $name
|
||||
* @return array
|
||||
*/
|
||||
public function getService($name)
|
||||
{
|
||||
return $this->services[$this->location][$name];
|
||||
}
|
||||
|
||||
}
|
944
library/Scores/Ws/Entreprise.php
Normal file
944
library/Scores/Ws/Entreprise.php
Normal file
@ -0,0 +1,944 @@
|
||||
<?php
|
||||
require_once 'Scores/Ws/Abstract.php';
|
||||
|
||||
class Scores_Ws_Entreprise extends Scores_Ws_Abstract
|
||||
{
|
||||
public function __construct($method = null)
|
||||
{
|
||||
//Set service to use
|
||||
$this->setService('entreprise');
|
||||
|
||||
//Prepare method configuration
|
||||
if(null !== $method && method_exists($this, $method)) {
|
||||
$this->{$method.'Params'}();
|
||||
}
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* getAnnonces
|
||||
* @param string $siren
|
||||
* @param integer $filtre
|
||||
* @param string $idAnn
|
||||
* @param integer $position
|
||||
* @param integer $nbRep
|
||||
* @void
|
||||
*/
|
||||
public function getAnnonces($siren, $filtre=0, $idAnn='', $position=0, $nbRep=100)
|
||||
{
|
||||
$this->method = __METHOD__;
|
||||
|
||||
$this->params = new StdClass();
|
||||
$this->params->siren = $siren;
|
||||
$this->params->filtre = $filtre;
|
||||
$this->params->idAnn = $idAnn;
|
||||
|
||||
$client = $this->getSoapClient();
|
||||
try {
|
||||
$response = $client->getAnnonces($this->params);
|
||||
$this->response = $response->getAnnoncesResult;
|
||||
} catch (SoapFault $fault) {
|
||||
$this->faultcode = $fault->getCode();
|
||||
$this->message = $fault->getMessage();
|
||||
$this->error = 1;
|
||||
}
|
||||
}
|
||||
|
||||
public function getAnnoncesAsso($siren, $idAnn=null, $filtre=null, $position=0, $nbRep=20)
|
||||
{
|
||||
$this->method = __METHOD__;
|
||||
|
||||
$this->params = new StdClass();
|
||||
$this->params->siren = $siren;
|
||||
$this->params->idAnn = $idAnn;
|
||||
$this->params->filtre = $filtre;
|
||||
$this->params->position = $position;
|
||||
$this->params->nbRep = $nbRep;
|
||||
|
||||
$client = $this->getSoapClient();
|
||||
try {
|
||||
$response = $client->getAnnoncesAsso($this->params);
|
||||
$this->response = $response->getAnnoncesAssoResult;
|
||||
} catch (SoapFault $fault) {
|
||||
$this->faultcode = $fault->getCode();
|
||||
$this->message = $fault->getMessage();
|
||||
$this->error = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* getAnnoncesBalo
|
||||
* @param string $siren
|
||||
* @param string $idAnn
|
||||
* @param string $filtre
|
||||
* @param number $position
|
||||
* @param number $nbRep
|
||||
* @void
|
||||
*/
|
||||
public function getAnnoncesBalo($siren, $idAnn=null, $filtre=null, $position=0, $nbRep=20)
|
||||
{
|
||||
$this->method = __METHOD__;
|
||||
|
||||
$this->params = new StdClass();
|
||||
$this->params->siren = $siren;
|
||||
$this->params->idAnn = $idAnn;
|
||||
$this->params->filtre = $filtre;
|
||||
$this->params->position = $position;
|
||||
$this->params->nbRep = $nbRep;
|
||||
|
||||
$client = $this->getSoapClient();
|
||||
try {
|
||||
$response = $client->getAnnoncesBalo($this->params);
|
||||
$this->response = $response->getAnnoncesBaloResult;
|
||||
} catch (SoapFault $fault) {
|
||||
$this->faultcode = $fault->getCode();
|
||||
$this->message = $fault->getMessage();
|
||||
$this->error = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* getAnnoncesBoamp
|
||||
* @param string $siren
|
||||
* @param string $idAnn
|
||||
* @param string $filtre
|
||||
* @param number $position
|
||||
* @param number $nbRep
|
||||
* @void
|
||||
*/
|
||||
public function getAnnoncesBoamp($siren, $idAnn=null, $filtre = null, $position=0, $nbRep=20)
|
||||
{
|
||||
$this->method = __METHOD__;
|
||||
|
||||
$this->params = new StdClass();
|
||||
$this->params->siren = $siren;
|
||||
$this->params->idAnn = $idAnn;
|
||||
$this->params->filtre = null;
|
||||
if (!empty($filtre) && in_array($filtre,array('A','M'))) {
|
||||
$filtreStruct = new stdClass();
|
||||
$filtreStruct->key = 'type';
|
||||
$filtreStruct->value = $filtre;
|
||||
$this->params->filtre[] = $filtreStruct;
|
||||
}
|
||||
$this->params->position = $position;
|
||||
$this->params->nbRep = $nbRep;
|
||||
|
||||
$client = $this->getSoapClient();
|
||||
try {
|
||||
$response = $client->getAnnoncesBoamp($this->params);
|
||||
$this->response = $response->getAnnoncesBoampResult;
|
||||
} catch (SoapFault $fault) {
|
||||
$this->faultcode = $fault->getCode();
|
||||
$this->message = $fault->getMessage();
|
||||
$this->error = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* getAnnoncesLegales
|
||||
* @param string $siren
|
||||
* @param string $idAnn
|
||||
* @param string $filtre
|
||||
* @param number $position
|
||||
* @param number $nbRep
|
||||
* @void
|
||||
*/
|
||||
public function getAnnoncesLegales($siren, $idAnn=null, $filtre=null, $position=0, $nbRep=20)
|
||||
{
|
||||
$this->method = __METHOD__;
|
||||
|
||||
$this->params = new StdClass();
|
||||
$this->params->siren = $siren;
|
||||
$this->params->idAnn = $idAnn;
|
||||
$this->params->filtre = $filtre;
|
||||
$this->params->position = $position;
|
||||
$this->params->nbRep = $nbRep;
|
||||
|
||||
$client = $this->getSoapClient();
|
||||
try {
|
||||
$response = $client->getAnnoncesLegales($this->params);
|
||||
$this->response = $response->getAnnoncesLegalesResult;
|
||||
} catch (SoapFault $fault) {
|
||||
$this->faultcode = $fault->getCode();
|
||||
$this->message = $fault->getMessage();
|
||||
$this->error = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* getAnnoncesNum
|
||||
* @param string $siren
|
||||
* @void
|
||||
*/
|
||||
public function getAnnoncesNum($siren)
|
||||
{
|
||||
$this->method = __METHOD__;
|
||||
|
||||
$this->params = new StdClass();
|
||||
$this->params->siren = $siren;
|
||||
|
||||
|
||||
$client = $this->getSoapClient();
|
||||
try {
|
||||
$response = $client->getAnnoncesNum($this->params);
|
||||
$this->response = $response->getAnnoncesNumResult;
|
||||
} catch (SoapFault $fault) {
|
||||
$this->faultcode = $fault->getCode();
|
||||
$this->message = $fault->getMessage();
|
||||
$this->error = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* getBanques
|
||||
* @param string $siren
|
||||
* @void
|
||||
*/
|
||||
public function getBanques($siren)
|
||||
{
|
||||
$this->method = __METHOD__;
|
||||
|
||||
$this->params = new StdClass();
|
||||
$this->params->siren = $siren;
|
||||
|
||||
$client = $this->getSoapClient();
|
||||
try {
|
||||
$response = $client->getBanques($this->params);
|
||||
$this->response = $response->getBanquesResult;
|
||||
} catch (SoapFault $fault) {
|
||||
$this->faultcode = $fault->getCode();
|
||||
$this->message = $fault->getMessage();
|
||||
$this->error = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* getBilan
|
||||
* @param string $siren
|
||||
* @param string $millesime
|
||||
* @param string $typeBilan
|
||||
* @param string $ref
|
||||
* @void
|
||||
*/
|
||||
public function getBilan($siren, $millesime, $typeBilan, $ref)
|
||||
{
|
||||
$this->method = __METHOD__;
|
||||
|
||||
$this->params = new StdClass();
|
||||
$this->params->siren = $siren;
|
||||
$this->params->millesime = $millesime;
|
||||
$this->params->typeBilan = $typeBilan;
|
||||
$this->params->ref = $ref;
|
||||
|
||||
$client = $this->getSoapClient();
|
||||
try {
|
||||
$response = $client->getBilan($this->params);
|
||||
$this->response = $response->getBilanResult;
|
||||
} catch (SoapFault $fault) {
|
||||
$this->faultcode = $fault->getCode();
|
||||
$this->message = $fault->getMessage();
|
||||
$this->error = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* getIdentiteParams
|
||||
* @void
|
||||
*/
|
||||
public function getIdentiteParams()
|
||||
{
|
||||
$this->setCache(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* getIdentite
|
||||
* @param string $siret
|
||||
* @param int $id
|
||||
* @void
|
||||
*/
|
||||
public function getIdentite($siret, $id = 0)
|
||||
{
|
||||
$this->method = __METHOD__;
|
||||
|
||||
$this->params = new StdClass();
|
||||
$this->params->siret = $siret;
|
||||
$this->params->id = $id;
|
||||
|
||||
$client = $this->getSoapClient();
|
||||
try {
|
||||
$response = $client->getIdentite($this->params);
|
||||
$this->response = $response->getIdentiteResult;
|
||||
} catch (SoapFault $fault) {
|
||||
$this->faultcode = $fault->getCode();
|
||||
$this->message = $fault->getMessage();
|
||||
if ( in_array($fault->getCode(), array('1020')) ){
|
||||
$this->error = 2;
|
||||
} else {
|
||||
$this->error = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* getIdentiteProcol
|
||||
* @param string $siret
|
||||
* @param int $id
|
||||
* @void
|
||||
*/
|
||||
public function getIdentiteProcol($siret, $id = 0)
|
||||
{
|
||||
$this->method = __METHOD__;
|
||||
|
||||
$this->params = new StdClass();
|
||||
$this->params->siret = $siret;
|
||||
$this->params->id = $id;
|
||||
|
||||
$client = $this->getSoapClient();
|
||||
try {
|
||||
$response = $client->getIdentiteProcol($this->params);
|
||||
$this->response = $response->getIdentiteProcolResult;
|
||||
} catch (SoapFault $fault) {
|
||||
$this->faultcode = $fault->getCode();
|
||||
$this->message = $fault->getMessage();
|
||||
$this->error = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* getIndiScore
|
||||
* @param string $siren
|
||||
* @param string $nic
|
||||
* @param integer $niveau
|
||||
* @param boolean $plus
|
||||
* @param string $ref
|
||||
* @param integer $encours
|
||||
* @param string $email
|
||||
*/
|
||||
public function getIndiScore($siren, $nic=0, $niveau=2, $plus=false, $ref='', $encours=0, $email='')
|
||||
{
|
||||
$this->method = __METHOD__;
|
||||
|
||||
$this->params = new StdClass();
|
||||
$this->params->siren = $siren;
|
||||
$this->params->nic = $nic;
|
||||
$this->params->niveau = $niveau;
|
||||
$this->params->plus = $plus;
|
||||
$this->params->ref = $ref;
|
||||
$this->params->encours = $encours;
|
||||
$this->params->email = $email;
|
||||
|
||||
$client = $this->getSoapClient();
|
||||
try {
|
||||
$response = $client->getIndiScore($this->params);
|
||||
$this->response = $response->getIndiScoreResult;
|
||||
} catch (SoapFault $fault) {
|
||||
$this->faultcode = $fault->getCode();
|
||||
$this->message = $fault->getMessage();
|
||||
if ( in_array($fault->getCode(), array('1020')) ){
|
||||
$this->error = 2;
|
||||
} else {
|
||||
$this->error = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* getInfosBourse
|
||||
* @param string $siren
|
||||
* @void
|
||||
*/
|
||||
public function getInfosBourse($siren)
|
||||
{
|
||||
$this->method = __METHOD__;
|
||||
|
||||
$this->params = new StdClass();
|
||||
$this->params->siren = $siren;
|
||||
|
||||
$client = $this->getSoapClient();
|
||||
try {
|
||||
$response = $client->getInfosBourse($this->params);
|
||||
$this->response = $response->getInfosBourseResult;
|
||||
} catch (SoapFault $fault) {
|
||||
$this->faultcode = $fault->getCode();
|
||||
$this->message = $fault->getMessage();
|
||||
if ( in_array($fault->getCode(), array('1030')) ){
|
||||
$this->error = 2;
|
||||
} else {
|
||||
$this->error = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* getInfosReg
|
||||
* @param string $siren
|
||||
* @param mixed $id
|
||||
* @void
|
||||
*/
|
||||
public function getInfosReg($siren, $id = false)
|
||||
{
|
||||
$this->method = __METHOD__;
|
||||
|
||||
$this->params = new StdClass();
|
||||
$this->params->siren = $siren;
|
||||
$this->params->id = $id;
|
||||
|
||||
$client = $this->getSoapClient();
|
||||
try {
|
||||
$response = $client->getInfosReg($this->params);
|
||||
$this->response = $response->getInfosRegResult;
|
||||
} catch (SoapFault $fault) {
|
||||
$this->faultcode = $fault->getCode();
|
||||
$this->message = $fault->getMessage();
|
||||
if ( in_array($fault->getCode(), array('1030')) ){
|
||||
$this->error = 2;
|
||||
} else {
|
||||
$this->error = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* getDirigeants
|
||||
* @param string $siren
|
||||
* @param boolean $histo
|
||||
* @void
|
||||
*/
|
||||
public function getDirigeants($siren, $histo=false)
|
||||
{
|
||||
$this->method = __METHOD__;
|
||||
|
||||
$this->params = new StdClass();
|
||||
$this->params->siren = $siren;
|
||||
$this->params->histo = $histo;
|
||||
|
||||
$client = $this->getSoapClient();
|
||||
try {
|
||||
$response = $client->getDirigeants($this->params);
|
||||
$this->response = $response->getDirigeantsResult;
|
||||
} catch (SoapFault $fault) {
|
||||
$this->faultcode = $fault->getCode();
|
||||
$this->message = $fault->getMessage();
|
||||
$this->error = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* getLienRef
|
||||
* @param string $id
|
||||
* @void
|
||||
*/
|
||||
public function getLienRef($id)
|
||||
{
|
||||
$this->method = __METHOD__;
|
||||
|
||||
$this->params = new StdClass();
|
||||
$this->params->id = $id;
|
||||
|
||||
$client = $this->getSoapClient();
|
||||
try {
|
||||
$response = $client->getLienRef($this->params);
|
||||
$this->response = $response->getLienRefResult;
|
||||
} catch (SoapFault $fault) {
|
||||
$this->faultcode = $fault->getCode();
|
||||
$this->message = $fault->getMessage();
|
||||
if ( in_array($fault->getCode(), array('ERR','MSG')) ){
|
||||
$this->error = 2;
|
||||
} else {
|
||||
$this->error = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* getLiens
|
||||
* @param string $siren
|
||||
* @void
|
||||
*/
|
||||
public function getLiens($siren)
|
||||
{
|
||||
$this->method = __METHOD__;
|
||||
|
||||
$this->params = new StdClass();
|
||||
$this->params->siren = $siren;
|
||||
|
||||
$client = $this->getSoapClient();
|
||||
try {
|
||||
$response = $client->getLiens($this->params);
|
||||
$this->response = $response->getLiensResult;
|
||||
} catch (SoapFault $fault) {
|
||||
$this->faultcode = $fault->getCode();
|
||||
$this->message = $fault->getMessage();
|
||||
if ( in_array($fault->getCode(), array('MSG')) ){
|
||||
$this->error = 2;
|
||||
} else {
|
||||
$this->error = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* getLiensById
|
||||
* @param int $id
|
||||
* @void
|
||||
*/
|
||||
public function getLiensById($id)
|
||||
{
|
||||
$this->method = __METHOD__;
|
||||
|
||||
$this->params = new StdClass();
|
||||
$this->params->id = $id;
|
||||
|
||||
$client = $this->getSoapClient();
|
||||
try {
|
||||
$response = $client->getLiensById($this->params);
|
||||
$this->response = $response->getLiensByIdResult;
|
||||
} catch (SoapFault $fault) {
|
||||
$this->faultcode = $fault->getCode();
|
||||
$this->message = $fault->getMessage();
|
||||
if ( in_array($fault->getCode(), array('MSG')) ){
|
||||
$this->error = 2;
|
||||
} else {
|
||||
$this->error = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* getListeBilans
|
||||
* @param string $siren
|
||||
*/
|
||||
public function getListeBilans($siren)
|
||||
{
|
||||
$this->method = __METHOD__;
|
||||
|
||||
$this->params = new StdClass();
|
||||
$this->params->siren = $siren;
|
||||
|
||||
$client = $this->getSoapClient();
|
||||
try {
|
||||
$response = $client->getListeBilans($this->params);
|
||||
$this->response = $response-getListeBilansResult;
|
||||
} catch (SoapFault $fault) {
|
||||
$this->faultcode = $fault->getCode();
|
||||
$this->message = $fault->getMessage();
|
||||
$this->error = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* getListeCompetences
|
||||
* @param string $siret
|
||||
* @param string $type
|
||||
* @param string $codeInsee
|
||||
*/
|
||||
public function getListeCompetences($siret, $type, $codeInsee)
|
||||
{
|
||||
$this->method = __METHOD__;
|
||||
|
||||
$this->params = new StdClass();
|
||||
$this->params->siret = $siret;
|
||||
$this->params->type = $type;
|
||||
$this->params->codeInsee = $codeInsee;
|
||||
|
||||
$client = $this->getSoapClient();
|
||||
try {
|
||||
$response = $client->getListeCompetences($this->params);
|
||||
$this->response = $response->getListeCompetencesResult;
|
||||
} catch (SoapFault $fault) {
|
||||
$this->faultcode = $fault->getCode();
|
||||
$this->message = $fault->getMessage();
|
||||
$this->error = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* getListeEtablissements
|
||||
* @param string $siren
|
||||
* @void
|
||||
*/
|
||||
public function getListeEtablissements($siren, $actif = -1, $position = 0)
|
||||
{
|
||||
$this->method = __METHOD__;
|
||||
|
||||
$this->params = new StdClass();
|
||||
$params->siren = $siren;
|
||||
$params->actif = $actif;
|
||||
$params->position = $position;
|
||||
|
||||
$client = $this->getSoapClient();
|
||||
try {
|
||||
$response = $client->getListeEtablissements($this->params);
|
||||
$this->response = $response->getListeEtablissementsResult;
|
||||
} catch (SoapFault $fault) {
|
||||
$this->faultcode = $fault->getCode();
|
||||
$this->message = $fault->getMessage();
|
||||
$this->error = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* getListeEvenements
|
||||
* @param string $siren
|
||||
* @param string $nic
|
||||
* @param integer $position
|
||||
* @param integer $nbRep
|
||||
* @void
|
||||
*/
|
||||
public function getListeEvenements($siren, $nic=0, $position=0, $nbRep=200)
|
||||
{
|
||||
$this->method = __METHOD__;
|
||||
|
||||
$this->params = new StdClass();
|
||||
$params->siren = $siren;
|
||||
$params->nic = $nic;
|
||||
$params->position = $position;
|
||||
$params->nbRep = $nbRep;
|
||||
|
||||
$client = $this->getSoapClient();
|
||||
try {
|
||||
$response = $client->getListeEvenements($this->params);
|
||||
$this->response = $response->getListeEvenementsResult;
|
||||
} catch (SoapFault $fault) {
|
||||
$this->faultcode = $fault->getCode();
|
||||
$this->message = $fault->getMessage();
|
||||
$this->error = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* getRapport
|
||||
* @param string $siren
|
||||
* @param integer $niveau
|
||||
* @param integer $id
|
||||
* @param boolean $plus
|
||||
* @param string $ref
|
||||
* @param integer $encours
|
||||
* @param string $email
|
||||
* @void
|
||||
*/
|
||||
public function getRapport($siren, $niveau=3, $id=0, $plus=false, $ref='', $encours=0, $email='')
|
||||
{
|
||||
$this->method = __METHOD__;
|
||||
|
||||
$this->params = new StdClass();
|
||||
$this->params->siren = $siren;
|
||||
$this->params->niveau = $niveau;
|
||||
$this->params->d = $id;
|
||||
$this->params->plus = $plus;
|
||||
$this->params->ref = $ref;
|
||||
$this->params->encours = $encours;
|
||||
$this->params->email = $email;
|
||||
|
||||
$client = $this->getSoapClient();
|
||||
try {
|
||||
$response = $client->getRapport($this->params);
|
||||
$this->response = $response->getRapportResult;
|
||||
} catch (SoapFault $fault) {
|
||||
$this->faultcode = $fault->getCode();
|
||||
$this->message = $fault->getMessage();
|
||||
$this->error = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* getRatios
|
||||
* @param string $siren
|
||||
* @param string $page
|
||||
*/
|
||||
public function getRatios($siren, $page = 'ratios')
|
||||
{
|
||||
$this->method = __METHOD__;
|
||||
|
||||
$this->params = new StdClass();
|
||||
$this->params->siren = $siren;
|
||||
$this->params->page = $page;
|
||||
|
||||
$client = $this->getSoapClient();
|
||||
try {
|
||||
$response = $client->getRapport($this->params);
|
||||
$this->response = $response->getRapportResult;
|
||||
} catch (SoapFault $fault) {
|
||||
$this->faultcode = $fault->getCode();
|
||||
$this->message = $fault->getMessage();
|
||||
$this->error = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* getSurveillancesParams
|
||||
*/
|
||||
public function getSurveillancesParams()
|
||||
{
|
||||
$this->setCache(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* getSurveillances
|
||||
* @param object $filtre
|
||||
* @param integer $deb
|
||||
* @param integer $nbRep
|
||||
* @param string $tri
|
||||
*/
|
||||
public function getSurveillances($filtre, $deb=0, $nbRep=100)
|
||||
{
|
||||
$this->method = __METHOD__;
|
||||
|
||||
$this->params = new StdClass();
|
||||
$this->params->filtre = $filtre;
|
||||
$this->params->position = $deb;
|
||||
$this->params->nbRep = $nbRep;
|
||||
|
||||
$client = $this->getSoapClient();
|
||||
try {
|
||||
$response = $client->getSurveillances($this->params);
|
||||
$this->response = $response->getSurveillancesResult;
|
||||
} catch (SoapFault $fault) {
|
||||
$this->faultcode = $fault->getCode();
|
||||
$this->message = $fault->getMessage();
|
||||
$this->error = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* getValo
|
||||
* @param string $siren
|
||||
* @void
|
||||
*/
|
||||
public function getValo($siren)
|
||||
{
|
||||
$this->method = __METHOD__;
|
||||
|
||||
$this->params = new StdClass();
|
||||
$this->params->siren = $siren;
|
||||
|
||||
$client = $this->getSoapClient();
|
||||
try {
|
||||
$response = $client->getValo($this->params);
|
||||
$this->response = $response->getValoResult;
|
||||
} catch (SoapFault $fault) {
|
||||
$this->faultcode = $fault->getCode();
|
||||
$this->message = $fault->getMessage();
|
||||
if ( in_array($fault->getCode(), array('1020')) ){
|
||||
$this->error = 2;
|
||||
} else {
|
||||
$this->error = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* isSirenExistant
|
||||
* @param string $siren
|
||||
*/
|
||||
public function isSirenExistant($siren)
|
||||
{
|
||||
$this->method = __METHOD__;
|
||||
|
||||
$this->params = new StdClass();
|
||||
$this->params->siren = $siren;
|
||||
|
||||
$client = $this->getSoapClient();
|
||||
try {
|
||||
$response = $client->isSirenExistant($this->params);
|
||||
$this->response = $response->isSirenExistantResult;
|
||||
} catch (SoapFault $fault) {
|
||||
$this->faultcode = $fault->getCode();
|
||||
$this->message = $fault->getMessage();
|
||||
$this->error = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* rechercheAnnonceParams
|
||||
* @void
|
||||
*/
|
||||
public function rechercheAnnonceParams()
|
||||
{
|
||||
$this->setCache(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Recherche Annonce
|
||||
* @param string $source
|
||||
* @param string $dateAnnee
|
||||
* @param integer $numParution
|
||||
* @param integer $numAnnonce
|
||||
*/
|
||||
public function rechercheAnnonce($source, $dateAnnee, $numParution, $numAnnonce)
|
||||
{
|
||||
$this->method = __METHOD__;
|
||||
|
||||
$this->params = new StdClass();
|
||||
$this->params->source = $source;
|
||||
$this->params->dateAnnee = $dateAnnee;
|
||||
$this->params->numParution = $numParution;
|
||||
$this->params->numAnnonce = $numAnnonce;
|
||||
|
||||
$client = $this->getSoapClient();
|
||||
try {
|
||||
$response = $client->rechercheAnnonce($this->params);
|
||||
$this->response = $response->rechercheAnnonceResult;
|
||||
} catch (SoapFault $fault) {
|
||||
$this->faultcode = $fault->getCode();
|
||||
$this->message = $fault->getMessage();
|
||||
$this->error = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* searchEntrepriseParams
|
||||
* @void
|
||||
*/
|
||||
public function searchEntrepriseParams()
|
||||
{
|
||||
$this->setCache(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* searchEntreprise
|
||||
* @param array $criteres
|
||||
* @param int $position
|
||||
* @param int $nbRep
|
||||
* @param int $actif
|
||||
*/
|
||||
public function searchEntreprise($criteres, $position = 0, $nbRep = null)
|
||||
{
|
||||
$this->method = __METHOD__;
|
||||
|
||||
$this->params = new StdClass();
|
||||
$this->params->criteres = new StdClass;
|
||||
$this->params->criteres->identifiant = $criteres['identifiant'];
|
||||
$this->params->criteres->raisonSociale = $criteres['raisonSociale'];
|
||||
$this->params->criteres->adresse = $criteres['adresse'];
|
||||
$this->params->criteres->codePostal = $criteres['codePostal'];
|
||||
$this->params->criteres->ville = $criteres['ville'];
|
||||
$this->params->criteres->telFax = $criteres['telFax'];
|
||||
$this->params->criteres->naf = $criteres['naf'];
|
||||
$this->params->criteres->siege = false;
|
||||
$this->params->criteres->actif = in_array($criteres['actif'], array(0,1,2)) ? $criteres['actif'] : 2;
|
||||
$this->params->criteres->fj = $criteres['fj'];
|
||||
$this->params->position = $position;
|
||||
$this->params->nbRep = empty($nbRep) ? $this->nbReponses : $nbRep ;
|
||||
|
||||
$client = $this->getSoapClient();
|
||||
try {
|
||||
$response = $client->searchEntreprise($this->params);
|
||||
$this->response = $response->searchEntrepriseeResult;
|
||||
} catch (SoapFault $fault) {
|
||||
$this->faultcode = $fault->getCode();
|
||||
$this->message = $fault->getMessage();
|
||||
$this->error = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* searchDirParams
|
||||
* @void
|
||||
*/
|
||||
public function searchDirParams()
|
||||
{
|
||||
$this->setCache(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Recherche par dirigeants
|
||||
* @param array $criteres
|
||||
* @param integer $deb
|
||||
* @param integer $nbRep
|
||||
* @param integer $maxRep
|
||||
*/
|
||||
public function searchDir($criteres, $deb=0, $nbRep=20, $maxRep=200)
|
||||
{
|
||||
$this->method = __METHOD__;
|
||||
|
||||
$this->params = new StdClass();
|
||||
$this->params->criteres->nom = $criteres['dirNom'];
|
||||
$this->params->criteres->prenom = $criteres['dirPrenom'];
|
||||
$this->params->criteres->dateNaiss = $criteres['dirDateNaiss'];
|
||||
$this->params->criteres->lieuNaiss = $criteres['lieuNaiss'];
|
||||
$this->params->criteres->pertinence = ($criteres['pertinence']===true) ? true : false ;
|
||||
$this->params->deb = $deb;
|
||||
$this->params->nbRep = $nbRep;
|
||||
$this->params->maxRep = $maxRep;
|
||||
|
||||
$client = $this->getSoapClient();
|
||||
try {
|
||||
$response = $client->searchDir($this->params);
|
||||
$this->response = $response->searchDirResult;
|
||||
} catch (SoapFault $fault) {
|
||||
$this->faultcode = $fault->getCode();
|
||||
$this->message = $fault->getMessage();
|
||||
$this->error = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* searchRefClientParams
|
||||
* @void
|
||||
*/
|
||||
public function searchRefClientParams()
|
||||
{
|
||||
$this->setCache(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Recherche par référence client
|
||||
* @param string $search
|
||||
* @param integer $position
|
||||
* @param integer $nbRep
|
||||
*/
|
||||
public function searchRefClient($search, $position=0, $nbRep=20)
|
||||
{
|
||||
$this->method = __METHOD__;
|
||||
|
||||
$this->params = new StdClass();
|
||||
$this->params->search = $search;
|
||||
$this->params->position = $position;
|
||||
$this->params->nbRep = $nbRep;
|
||||
|
||||
$client = $this->getSoapClient();
|
||||
try {
|
||||
$response = $client->searchRefClient($this->params);
|
||||
$this->response = $response->searchRefClientResult;
|
||||
} catch (SoapFault $fault) {
|
||||
$this->faultcode = $fault->getCode();
|
||||
$this->message = $fault->getMessage();
|
||||
$this->error = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* setSurveillance
|
||||
* @param string $siret
|
||||
* @param string $email
|
||||
* @param string $ref
|
||||
* @param string $source
|
||||
* @param boolean $delete
|
||||
* @param integer $encoursClient
|
||||
* @void
|
||||
*/
|
||||
public function setSurveillance($siret, $email, $ref = '', $source='annonces', $delete=false, $encoursClient=0)
|
||||
{
|
||||
$this->method = __METHOD__;
|
||||
|
||||
$this->params = new StdClass();
|
||||
$this->params->siret = $siret;
|
||||
$this->params->email = $email;
|
||||
$this->params->ref = $ref;
|
||||
$this->params->source = $source;
|
||||
$this->params->delete = $delete;
|
||||
$this->params->encoursClient = $encoursClient;
|
||||
|
||||
$client = $this->getSoapClient();
|
||||
try {
|
||||
$response = $client->setSurveillance($this->params);
|
||||
$this->response = $response->setSurveillanceResult;
|
||||
} catch (SoapFault $fault) {
|
||||
$this->faultcode = $fault->getCode();
|
||||
$this->message = $fault->getMessage();
|
||||
$this->error = 1;
|
||||
}
|
||||
}
|
||||
}
|
88
library/Scores/Ws/Interface.php
Normal file
88
library/Scores/Ws/Interface.php
Normal file
@ -0,0 +1,88 @@
|
||||
<?php
|
||||
/**
|
||||
* Interface class for Scores_Ws
|
||||
*/
|
||||
interface Scores_Ws_Interface
|
||||
{
|
||||
/**
|
||||
* Define service name
|
||||
* @param string $name
|
||||
*/
|
||||
public function setService($name);
|
||||
|
||||
/**
|
||||
* Get the service name
|
||||
* @void
|
||||
*/
|
||||
public function getServiceName();
|
||||
|
||||
/**
|
||||
* Get Method name
|
||||
* @void
|
||||
*/
|
||||
public function getMethodName();
|
||||
|
||||
/**
|
||||
* Get Params
|
||||
* @void
|
||||
*/
|
||||
public function getParams();
|
||||
|
||||
/**
|
||||
* Get fault code
|
||||
* @void
|
||||
*/
|
||||
public function getFaultCode();
|
||||
|
||||
/**
|
||||
* Set the default for max responses
|
||||
* @param int $nb
|
||||
*/
|
||||
public function setNbReponses($nb);
|
||||
|
||||
/**
|
||||
* Define WSDL URI
|
||||
* @param string $wsdl
|
||||
*/
|
||||
public function setSoapClientWsdl($wsdl = null);
|
||||
|
||||
/**
|
||||
* Define options for SoapClient
|
||||
* @param string $name
|
||||
* @param string $value
|
||||
*/
|
||||
public function setSoapClientOption($name = null , $value = null);
|
||||
|
||||
/**
|
||||
* Instantiate Soap Client
|
||||
*/
|
||||
public function getSoapClient();
|
||||
|
||||
/**
|
||||
* Get Soap Response
|
||||
*/
|
||||
public function getSoapResponse();
|
||||
|
||||
/**
|
||||
* True if the response is an error
|
||||
*/
|
||||
public function isError();
|
||||
|
||||
/**
|
||||
* True if the response is a message
|
||||
*/
|
||||
public function isMessage();
|
||||
|
||||
/**
|
||||
* Return message (error)
|
||||
*/
|
||||
public function getMessage();
|
||||
|
||||
/**
|
||||
* Get the filename for a mathod
|
||||
* @param string $method
|
||||
* @param array $args
|
||||
*/
|
||||
public function getFilename($method, $args);
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user