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

142 lines
4.5 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');
$gServiceHeader = new StdClass;
$gServiceHeader->ConsumerId = 1234;
//$gServiceHeader->CustomerId = 1234;
$gServiceHeader->Provider = new StdClass;
$gServiceHeader->Provider->ProviderId = 2345;
$gServiceHeader->Provider->CountryCode = 'FR';
$gServiceHeader->TimeStamp = date('Y-m-d\TH:i:s');
$gServiceHeader->TestIndication = true;
if (NDEBUG) {
$soap_header =
new SoapHeader('http://extranet.devlocal.com/services/'.
'schema/services/shared/1.0', 'ServiceHeader',
$gServiceHeader);
$soap_client =
new SoapClient('http://extranet.devlocal.com/services/'.
'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';
break;
case 'RetrieveOptions':
$o->CompanyId = $companyId;
$fonction = 'RetrieveOptions';
break;
case 'OrderDataSet':
$o->CompanyId = $companyId;
$o->DataSetType = new StdClass;
$o->DataSetType->_ = 'Full';
$o->DataSetVersion = VERSION;
2010-05-28 14:03:37 +00:00
$o->LanguageCode = 'fr';
2010-05-21 13:15:25 +00:00
$fonction = 'OrderDataSet';
break;
case 'RetrieveOrderStatus':
$o->ProviderOrderId = $providerOrderId;
$fonction = 'RetrieveOrderStatus';
break;
case 'RetrieveDataSet':
$o->ProviderOrderId = $providerOrderId;
$fonction = 'RetrieveDataSet';
break;
case 'StartInvestigation':
$o->CompanyId = $companyId;
$o->DataSetType = new StdClass;
$o->DataSetType->_ = 'Full';
$o->DataSetVersion = VERSION;
$o->ServiceLevelName = 'Normal';
2010-05-28 14:03:37 +00:00
$o->LanguageCode = 'fr';
2010-05-21 13:15:25 +00:00
$fonction = 'StartInvestigation';
break;
case 'StartMonitoring':
$o->CompanyId = $companyId;
$o->CategoryName = 'All';
$o->EventType = 'EventOnly';
$o->MonitoringVersion = '1.0';
2010-05-28 14:03:37 +00:00
$o->LanguageCode = 'fr';
2010-05-21 13:15:25 +00:00
//$o->PreferredStartDate = ;
//$o->PreferredEndDate = ;
$fonction = 'StartMonitoring';
break;
case 'StopMonitoring':
$o->ProviderOrderId = $providerOrderId;
//$o->PreferredEndDate = ;
$fonction = 'StopMonitoring';
break;
case 'UpdateMonitoringOptions':
$o->ProviderOrderId = $providerOrderId;
//$o->NewCategoryName = ;
$o->NewEventType = 'EventWithData';
//$o->NewMonitoringVersion = ;
//$o->NewLanguageCode = ;
$o->PreferredStartDate = date('Y-m-d');
$fonction = 'UpdateMonitoringOptions';
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)));
//print '<br/>';
//print 'Requete: '.htmlspecialchars($soap_client->__getLastRequest());
//print '<br/>';
//print 'Reponse: '.htmlspecialchars($soap_client->__getLastResponse());
} else {
require_once 'credit-data/v1/index.php';
print_r(call_user_func($fonction, $o));
}
print "</pre>";
?>