Issue #0001653: worlcheck class working version

This commit is contained in:
Aram HARUTYUNYAN 2013-07-02 08:46:43 +00:00
parent 81bc916f71
commit 1d52af8534

View File

@ -9,24 +9,25 @@ class WsWorldCheck
public function __construct()
{
$c = Zend_Registry::get('config');
$location = ($c->profil->webservice->location=='production')?'production':'pilot';
$location = ($c->profil->webservice->location == 'production') ? 'production' : 'pilot';
$cWC = new Zend_Config_Ini('/Worldcheck/webservicesWC.ini', $location);
$config = $cWC->toArray();
$this->webservices = $config['webservices'];
$configWC = new Zend_Config_Ini('/Worldcheck/applicationWC.ini');
$data = $configWC->toArray();
$this->headerData = $data['worldcheck'];
}
/**
* loadClient
* loadClientWC
* @param string $webservice
* @return SOAP client with Header
*/
protected function loadClientWC($webservice)
{
$wsdl = $this->webservices[$webservice]['wsdl'];
$options['soap_version'] = SOAP_1_1;
$options['features'] = SOAP_USE_XSI_ARRAY_TYPE + SOAP_SINGLE_ELEMENT_ARRAYS;
$options['compression'] = SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP | SOAP_COMPRESSION_DEFLATE;
@ -34,11 +35,11 @@ class WsWorldCheck
$options['use'] = SOAP_LITERAL;
$options['trace'] = true;
$options['encoding'] = 'utf-8';
$client = false;
$header = $this->headerWC();
try {
$client = new SoapClient($wsdl, $options);
$client->__setSoapHeaders($header);
@ -48,7 +49,7 @@ class WsWorldCheck
return $client;
}
/**
* Create security Header for WorldCheck
* @return SoapHeader
@ -61,32 +62,28 @@ class WsWorldCheck
$headerPart .= '<wsse:Password Type="'.$this->headerData['passwordType'].'">'.$this->headerData['password'].'</wsse:Password>';
$headerPart .= '</wsse:UsernameToken></wsse:Security>';
$headerVar = new SoapVar($headerPart,XSD_ANYXML);
$headerVar = new SoapVar($headerPart, XSD_ANYXML);
$header = new SoapHeader($this->headerData['namespace'], $this->headerData['securityType'], $headerVar, true);
return $header;
}
/**
* getScreener
* @param array $data
* @return Identifier
* @param object $data
* @return NameIdentifier
*/
public function getScreener($data)
{
$params = new stdClass();
$params->data = $data;
$params->screenRequest = $data;
$client = $this->loadClientWC('screener');
try {
$reponse = $client->screen($params);
return $reponse->screenResponse;
return $client->screen($params)->return;
} catch (SoapFault $fault) {
Zend_Registry::get('firebug')->info($params);
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
echo $client->__getLastResponse();
//$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}