Service should be rendered in a Container with type of Service. Service will be rendered using: config file, service processor class file, and language file.Config file is rendering control that define what should be used and how to render the service. Service processor class file is used to process the request and render the defined service. Language file is used as language source of rendered service.
Below is as an example:
configuration file:
<?xml version="1.0" encoding="UTF-8"?>
<service name="LogoutService" id="LogoutService" >
<processor PageSecurityCode="0" CanPublic="false" RunEndResponse="false" Authenticate="fase">
</processor>
</service>
service processor file:
class LogoutService extends CIISONLINE_ServiceProcessor{
/**
* LogoutService::Logout($pAccount) Returns status true/false.
*
* @return boolean
**/
function Logout($pAccount) {
if (GetSystemConfig('bBehaveAsLoginService')) {
/*do logout all instance using loginservice & itself*/
$this->LogoutSites($pAccount);
/*do logout itself*/
SetLogoutUserActivityLoginStatus(
$pAccount,GetSystemConfig('sLocalUserCode')
,GetSystemConfig('sInstanceLocalUserCode'));
} else if (GetSystemConfig('bUseLoginService')) {
/*do logout itself*/
SetLogoutUserActivityLoginStatus($pAccount,
GetSystemConfig('sLocalUserCode'),GetSystemConfig('sInstanceLocalUserCode'));
} else {
return (0);
}
return (1);
}
private function LogoutSites($pAccount) {
$cacheFile = CIISONLINE_System::GetCacheDir().$pAccount.'.sites.login';
if (!file_exists($cacheFile)) return;
$sites = new CIISONLINE_Config_XML($cacheFile,'sites');
$sites = $sites->GetConfig();
if (is_object($sites) && count($sites)>0) {
foreach ($sites as $site=>$logoutsvc) {
try {
$soapClient = new SoapClient($logoutsvc);
$soapClient->Logout($pAccount);
} catch (Exception $e) {
}
}
}
unlink($cacheFile);
}
}
No comments:
Post a Comment