extranet/www/services/test-credit-data.php

143 lines
4.6 KiB
PHP
Raw Normal View History

2010-05-21 13:15:25 +00:00
<?php
// --------------------------------------------------------------------------- //
// Teste internationalCompanyCreditDataService
// --------------------------------------------------------------------------- //
if (isset($_GET['action']) == true) {
$action = $_GET['action'];
if (isset($_GET['CompanyId']) == true) {
$companyId = $_GET['CompanyId'];
}
if (isset($_GET['ProviderOrderId']) == true) {
$providerOrderId = $_GET['ProviderOrderId'];
}
} else {
$params = array('action',
'companyId',
'providerOrderId');
$argc = $_SERVER['argc'];
$argv = $_SERVER['argv'];
for ($i = 1; $i < $argc; ++$i) {
list($label, $valeur) = explode('=', $argv[$i]);
$var = lcfirst($label);
if (in_array($var, $params) == false) {
print 'attention: parametre non reconnu '.$var."\n";
continue;
}
$$var = $valeur;
}
}
header('Content-Type: text/html; charset=utf-8');
define( 'NDEBUG', '1');
define('VERSION', '1.0');
define('SERVICES_URL', 'http://extranet.devlocal.com/services/');
2010-05-21 13:15:25 +00:00
$gServiceHeader = new StdClass;
$gServiceHeader->ConsumerId = 'a1234';
//$gServiceHeader->CustomerId = 'a1234';
2010-05-21 13:15:25 +00:00
$gServiceHeader->Provider = new StdClass;
2010-06-04 13:28:01 +00:00
$gServiceHeader->Provider->ProviderId = 'SED';
2010-05-21 13:15:25 +00:00
$gServiceHeader->Provider->CountryCode = 'FR';
$gServiceHeader->TimeStamp = date('Y-m-d\TH:i:s');
$gServiceHeader->TestIndication = true;
if (NDEBUG) {
$soap_header =
new SoapHeader(SERVICES_URL.'schema/services/shared/1.0',
'ServiceHeader', $gServiceHeader);
2010-05-21 13:15:25 +00:00
$soap_client =
new SoapClient(SERVICES_URL.
2010-05-21 13:15:25 +00:00
'wsdl/credit-data-service-provider-api-1.0.wsdl',
array('soap_version' => SOAP_1_1,
'trace' => true));
$soap_client->__setSoapHeaders($soap_header);
}
$fonction = '';
$o = new StdClass;
switch ($action) {
case 'Ping':
$o->Type = 'simple';
$fonction = 'Ping';
2010-05-21 13:15:25 +00:00
break;
case 'RetrieveOptions':
$o->CompanyId = $companyId;
$fonction = 'RetrieveOptions';
2010-05-21 13:15:25 +00:00
break;
case 'OrderDataSet':
$o->CompanyId = $companyId;
$o->DataSetType = new StdClass;
//$o->DataSetType->_ = 'CreditRecommendation';
$o->DataSetType->_ = 'Full';
$o->DataSetVersion = VERSION;
$o->LanguageCode = 'fr';
$fonction = 'OrderDataSet';
2010-05-21 13:15:25 +00:00
break;
case 'RetrieveOrderStatus':
$o->ProviderOrderId = $providerOrderId;
$fonction = 'RetrieveOrderStatus';
2010-05-21 13:15:25 +00:00
break;
case 'RetrieveDataSet':
$o->ProviderOrderId = $providerOrderId;
$fonction = 'RetrieveDataSet';
2010-05-21 13:15:25 +00:00
break;
case 'StartInvestigation':
$o->CompanyId = $companyId;
$o->DataSetType = new StdClass;
$o->DataSetType->_ = 'Full';
$o->DataSetVersion = VERSION;
$o->ServiceLevelName = 'Normal';
$o->LanguageCode = 'fr';
$fonction = 'StartInvestigation';
2010-05-21 13:15:25 +00:00
break;
case 'StartMonitoring':
$o->CompanyId = $companyId;
$o->CategoryName = 'All';
$o->EventType = 'EventOnly';
$o->MonitoringVersion = '1.0';
$o->LanguageCode = 'fr';
//$o->PreferredStartDate = ;
//$o->PreferredEndDate = ;
$fonction = 'StartMonitoring';
2010-05-21 13:15:25 +00:00
break;
case 'StopMonitoring':
$o->ProviderOrderId = $providerOrderId;
//$o->PreferredEndDate = ;
$fonction = 'StopMonitoring';
2010-05-21 13:15:25 +00:00
break;
case 'UpdateMonitoringOptions':
$o->ProviderOrderId = $providerOrderId;
//$o->NewCategoryName = ;
$o->NewEventType = 'EventWithData';
//$o->NewMonitoringVersion = ;
//$o->NewLanguageCode = ;
$o->NewPreferredStartDate = date('Y-m-d');
$fonction = 'UpdateMonitoringOptions';
2010-05-21 13:15:25 +00:00
break;
default:
print 'erreur: fonction inconnue';
exit;
}
print '<pre>';
if (NDEBUG) {
print_r($soap_header);
}
print '<br/>';
print_r($o);
print '<br/>';
if (NDEBUG) {
print_r($soap_client->__call($fonction, array($o)));
2010-06-04 13:40:19 +00:00
//print '<br/>';
//print 'Requete: '.htmlspecialchars($soap_client->__getLastRequest());
//print '<br/>';
//print 'Reponse: '.htmlspecialchars($soap_client->__getLastResponse());
2010-05-21 13:15:25 +00:00
} else {
require_once 'credit-data/v1/index.php';
print_r(call_user_func($fonction, $o));
}
print "</pre>";
?>