diff --git a/php/classes/WSClientInterface.php b/php/classes/WSClientInterface.php
new file mode 100644
index 0000000..c41367b
--- /dev/null
+++ b/php/classes/WSClientInterface.php
@@ -0,0 +1,136 @@
+<?php 
+abstract class WSOutputFileFormat
+{
+	const NETCDF  = "netCDF";
+	const VOTABLE = "VOTable";
+	const ASCII   = "ASCII";
+}
+
+abstract class WSOutputTimeFormat
+{
+	const ISO  = "ISO8601";
+	const TIMESTAMP = "unixtime";
+}
+
+abstract class WSOrbitUnit
+{
+	const KM  = "km";
+	const RS  = "Rs";
+	const RJ  = "Rj";
+	const RCA = "Rca";
+	const RGA = "Rga";
+	const RIO = "Rio";
+	const REU = "Reu";
+	const RV  = "Rv";
+	const RM  = "Rm";
+	const RE  = "Re";
+	const AU  = "AU";
+}
+
+abstract class WSSpacecraft
+{
+	const CASSINI       = "Cassini_Public";
+	const GALILEO       = "Galileo";
+	const VOYAGER1      = "Voyager_1";
+	const VOYAGER2      = "Voyager_2";
+	const PIONEER10     = "Pioneer_10";
+	const PIONEER11     = "Pioneer_11";
+	const PVO           = "PVO";
+	const ACE           = "ACE";
+	const VEX           = "VEX";
+	const MEX           = "MEX";
+	const MGS           = "MGS";
+	const MAVEN         = "MAVEN";
+	const MESSENGER     = "MESSENGER";
+	const ULYSSES       = "ULYSSES";
+	const STEREOA       = "Stereo-A";
+	const STEREOB       = "Stereo-B";
+	const WIND          = "WIND";
+	const THEMISA       = "THEMIS-A";
+	const THEMISB       = "THEMIS-B";
+	const THEMISC       = "THEMIS-C";
+	const THEMISD       = "THEMIS-D";
+	const THEMISE       = "THEMIS-E";
+	const CLUSTER1      = "CLUSTER1";
+	const CLUSTER2      = "CLUSTER2";
+	const CLUSTER3      = "CLUSTER3";
+	const CLUSTER4      = "CLUSTER4";
+	const DOUBLESTAR1   = "DoubleStar1";
+	const IMP8          = "IMP-8";
+	const GEOTAIL       = "GEOTAIL";
+	const POLAR         = "POLAR";
+	const INTERBALLTAIL = "INTERBALL-Tail";
+	const ISEE1         = "ISEE-1";
+	const ISEE2         = "ISEE-2";
+}
+
+abstract class WSCoordinatesSytem
+{
+	const CPHIO              = "CPHIO";
+	const GPHIO              = "GPHIO";
+	const IPHIO              = "IPHIO";
+	const EPHIO              = "EPHIO";
+	const EQUATORIAL         = "Equatorial";
+	const CGM                = "CGM";
+	const CARRINGTON         = "Carrington";
+	const DM                 = "DM";
+	const GEI                = "GEI";
+	const GEO                = "GEO";
+	const GSE                = "GSE";
+	const GSEQ               = "GSEQ";
+	const GSM                = "GSM";
+	const HAE                = "HAE";
+	const HCC                = "HCC";
+	const HCI                = "HCI";
+	const HCR                = "HCR";
+	const HEE                = "HEE";
+	const HEEQ               = "HEEQ";
+	const HG                 = "HG";
+	const HGI                = "HGI";
+	const HPC                = "HPC";
+	const HPR                = "HPR";
+	const J2000              = "J2000";
+	const LGM                = "LGM";
+	const MAG                = "MAG";
+	const MFA                = "MFA";
+	const RTN                = "RTN";
+	const SC                 = "SC";
+	const SE                 = "SE";
+	const SM                 = "SM";
+	const SR                 = "SR";
+	const SR2                = "SR2";
+	const SSE                = "SSE";
+	const SSE_L              = "SSE_L";
+	const SPACECRAFTORBPLANE = "SpacecraftOrbitPlane";
+	const WGS84              = "WGS84";
+	const MSO                = "MSO";
+	const VSO                = "VSO";
+}
+
+Interface WSClientInterface
+{
+	public function getTimeTablesList($userID = "", $password = "");
+
+	public function getTimeTable($ttID, $userID = "", $password = "");
+
+	public function getParameterList($userID, $password = "");
+
+	public function getParameter($startTime, $stopTime, $parameterID, $sampling = 0, $userID = "", $password = "",
+			$outputFormat = WSOutputFileFormat::NETCDF, $timeFormat = WSOutputTimeFormat::ISO, $gzip = 0);
+
+	public function getDataset($startTime, $stopTime, $datasetID, $sampling = 0, $userID = "", $password = "",
+			$outputFormat = WSOutputFileFormat::NETCDF, $timeFormat = WSOutputTimeFormat::ISO, $gzip = 0);
+
+	/*public function getPlot($startTime, $stopTime, $missionID, $userID = "", $password = "");
+
+	public function getResultPlot($plotDirectoryURL);*/
+
+	public function getOrbites($startTime, $stopTime, $spacecraft, $coordinateSystem, $units = WSOrbitUnit::KM,
+			$sampling = 0, $userID = "", $password = "", $outputFormat = WSOutputFileFormat::NETCDF,
+			$timeFormat = WSOutputTimeFormat::ISO, $gzip = 0);
+
+	public function isAlive();
+
+	public function getObsDataTree();
+}
+?>
\ No newline at end of file
diff --git a/php/classes/WSClientREST.php b/php/classes/WSClientREST.php
new file mode 100644
index 0000000..7aac843
--- /dev/null
+++ b/php/classes/WSClientREST.php
@@ -0,0 +1,153 @@
+<?php
+
+require_once("WSClientInterface.php");
+
+class WSClientREST implements WSClientInterface
+{
+	private $baseURL = "";
+	
+	function __construct($baseURL)
+	{
+		$this->baseURL = $baseURL;
+	}
+
+	public function isAlive()
+	{
+		return $this->call(__FUNCTION__, array());
+	}
+
+	public function getObsDataTree()
+	{
+		return $this->call(__FUNCTION__, array());
+	}
+
+	public function getTimeTablesList($userID = "", $password = "")
+	{
+		$params = array('parameters' => array());
+		if ($userID != "" && $password != "")
+		{
+			$params['parameters'] = array(
+					"userID" => $userID,
+					"password"=> $password
+			);
+		}
+		return $this->call(__FUNCTION__, $params);
+	}
+
+	public function getTimeTable($ttID, $userID = "", $password = "")
+	{
+		$params = array('parameters' => array());
+		if ($userID != "" && $password != "")
+		{
+			$params['parameters'] = array(
+					"userID" => $userID,
+					"password"=> $password
+			);
+		}
+		$params['parameters']['ttID'] = $ttID;
+		return $this->call(__FUNCTION__, $params);
+	}
+
+	public function getParameterList($userID, $password = "")
+	{
+		$params = array('parameters' => array(
+				"userID" => $userID
+		));
+		if ($password != "")
+			$params['parameters']["password"] = $password;
+		return $this->call(__FUNCTION__, $params);
+	}
+
+	public function getParameter($startTime, $stopTime, $parameterID, $sampling = 0, $userID = "", $password = "",
+			$outputFormat = WSOutputFileFormat::NETCDF, $timeFormat = WSOutputTimeFormat::ISO, $gzip = 0)
+	{
+		$params = array('parameters' => array(
+				"startTime" => $startTime,
+				"stopTime"  => $stopTime,
+				"parameterID" => $parameterID,
+				"outputFormat" => $outputFormat,
+				"timeFormat" => $timeFormat,
+				"gzip" => $gzip
+		));
+
+		if ($sampling > 0)
+			$params["parameters"]["sampling"] = $sampling;
+
+		if ($userID != "" && $password != "")
+		{
+			$params["parameters"]["userID"] = $userID;
+			$params["parameters"]["password"] = $password;
+		}
+
+		return $this->call(__FUNCTION__, $params);
+	}
+
+	public function getDataset($startTime, $stopTime, $datasetID, $sampling = 0, $userID = "", $password = "",
+			$outputFormat = WSOutputFileFormat::NETCDF, $timeFormat = WSOutputTimeFormat::ISO, $gzip = 0)
+	{
+		$params = array('parameters' => array(
+				"startTime" => $startTime,
+				"stopTime"  => $stopTime,
+				"datasetID" => $datasetID,
+				"outputFormat" => $outputFormat,
+				"timeFormat" => $timeFormat,
+				"gzip" => $gzip
+		));
+
+		if ($sampling > 0)
+			$params["parameters"]["sampling"] = $sampling;
+
+		if ($userID != "" && $password != "")
+		{
+			$params["parameters"]["userID"] = $userID;
+			$params["parameters"]["password"] = $password;
+		}
+
+		return $this->call(__FUNCTION__, $params);
+	}
+
+	public function getOrbites($startTime, $stopTime, $spacecraft, $coordinateSystem, $units = WSOrbitUnit::KM,
+			$sampling = 0, $userID = "", $password = "", $outputFormat = WSOutputFileFormat::NETCDF,
+			$timeFormat = WSOutputTimeFormat::ISO, $gzip = 0)
+	{
+		$params = array('parameters' => array(
+				"startTime" => $startTime,
+				"stopTime"  => $stopTime,
+				"spacecraft" => $spacecraft,
+				"coordinateSystem" => $coordinateSystem,
+				"units" => $units,
+				"outputFormat" => $outputFormat,
+				"timeFormat" => $timeFormat,
+				"gzip" => $gzip
+		));
+
+		if ($sampling > 0)
+			$params["parameters"]["sampling"] = $sampling;
+
+		if ($userID != "" && $password != "")
+		{
+			$params["parameters"]["userID"] = $userID;
+			$params["parameters"]["password"] = $password;
+		}
+
+		return $this->call(__FUNCTION__, $params);
+	}
+
+	private function call($function, $params)
+	{
+		$functionURL = $this->baseURL."/".$function.".php";
+		
+		$isFirstParam = true;
+		foreach ($params as $paramName => $paramValue)
+		{
+			if ($isFirstParam)
+				$functionURL .= "?";
+			else
+				$functionURL .= "&";
+			$functionURL .= $paramName."=".$paramValue;
+		}
+		
+		return file_get_contents($functionURL);
+	}
+}
+?>
\ No newline at end of file
diff --git a/php/classes/WSClientSOAP.php b/php/classes/WSClientSOAP.php
new file mode 100644
index 0000000..52c1187
--- /dev/null
+++ b/php/classes/WSClientSOAP.php
@@ -0,0 +1,162 @@
+<?php
+
+require_once("WSClientInterface.php");
+
+class WSClientSOAP implements WSClientInterface
+{
+	private $wsdl   = "";
+	private $client = null;
+
+	function __construct($wsdl)
+	{
+		$this->wsdl = $wsdl;
+		ini_set('soap.wsdl_cache_enabled', 0);
+	}
+
+	public function isAlive()
+	{
+		return $this->call(__FUNCTION__, array());
+	}
+
+	public function getObsDataTree()
+	{
+		return $this->call(__FUNCTION__, array());
+	}
+
+	public function getTimeTablesList($userID = "", $password = "")
+	{
+		$params = array('parameters' => array());
+		if ($userID != "" && $password != "")
+		{
+			$params['parameters'] = array(
+					"userID" => $userID,
+					"password"=> $password
+			);
+		}
+		return $this->call(__FUNCTION__, $params);
+	}
+
+	public function getTimeTable($ttID, $userID = "", $password = "")
+	{
+		$params = array('parameters' => array());
+		if ($userID != "" && $password != "")
+		{
+			$params['parameters'] = array(
+					"userID" => $userID,
+					"password"=> $password
+			);
+		}
+		$params['parameters']['ttID'] = $ttID;
+		return $this->call(__FUNCTION__, $params);
+	}
+
+	public function getParameterList($userID, $password = "")
+	{
+		$params = array('parameters' => array(
+				"userID" => $userID
+		));
+		if ($password != "")
+			$params['parameters']["password"] = $password;
+		return $this->call(__FUNCTION__, $params);
+	}
+
+	public function getParameter($startTime, $stopTime, $parameterID, $sampling = 0, $userID = "", $password = "",
+			$outputFormat = WSOutputFileFormat::NETCDF, $timeFormat = WSOutputTimeFormat::ISO, $gzip = 0)
+	{
+		$params = array('parameters' => array(
+				"startTime" => $startTime,
+				"stopTime"  => $stopTime,
+				"parameterID" => $parameterID,
+				"outputFormat" => $outputFormat,
+				"timeFormat" => $timeFormat,
+				"gzip" => $gzip
+		));
+
+		if ($sampling > 0)
+			$params["parameters"]["sampling"] = $sampling;
+
+		if ($userID != "" && $password != "")
+		{
+			$params["parameters"]["userID"] = $userID;
+			$params["parameters"]["password"] = $password;
+		}
+
+		return $this->call(__FUNCTION__, $params);
+	}
+
+	public function getDataset($startTime, $stopTime, $datasetID, $sampling = 0, $userID = "", $password = "",
+			$outputFormat = WSOutputFileFormat::NETCDF, $timeFormat = WSOutputTimeFormat::ISO, $gzip = 0)
+	{
+		$params = array('parameters' => array(
+				"startTime" => $startTime,
+				"stopTime"  => $stopTime,
+				"datasetID" => $datasetID,
+				"outputFormat" => $outputFormat,
+				"timeFormat" => $timeFormat,
+				"gzip" => $gzip
+		));
+
+		if ($sampling > 0)
+			$params["parameters"]["sampling"] = $sampling;
+
+		if ($userID != "" && $password != "")
+		{
+			$params["parameters"]["userID"] = $userID;
+			$params["parameters"]["password"] = $password;
+		}
+
+		return $this->call(__FUNCTION__, $params);
+	}
+
+	public function getOrbites($startTime, $stopTime, $spacecraft, $coordinateSystem, $units = WSOrbitUnit::KM,
+			$sampling = 0, $userID = "", $password = "", $outputFormat = WSOutputFileFormat::NETCDF,
+			$timeFormat = WSOutputTimeFormat::ISO, $gzip = 0)
+	{
+		$params = array('parameters' => array(
+				"startTime" => $startTime,
+				"stopTime"  => $stopTime,
+				"spacecraft" => $spacecraft,
+				"coordinateSystem" => $coordinateSystem,
+				"units" => $units,
+				"outputFormat" => $outputFormat,
+				"timeFormat" => $timeFormat,
+				"gzip" => $gzip
+		));
+
+		if ($sampling > 0)
+			$params["parameters"]["sampling"] = $sampling;
+
+		if ($userID != "" && $password != "")
+		{
+			$params["parameters"]["userID"] = $userID;
+			$params["parameters"]["password"] = $password;
+		}
+
+		return $this->call(__FUNCTION__, $params);
+	}
+
+	private function call($function, $params)
+	{
+		if ($this->client == null)
+			$this->createSOAPClient();
+		try {
+			return  $this->client ->__call($function, $params);
+		}
+		catch (Exception $e) {
+			print_r($this->client->__getLastResponse());
+			var_dump($e);
+			return null;
+		}
+	}
+
+	private function createSOAPClient()
+	{
+		$this->client = new SoapClient(
+				$this->wsdl,
+				array(
+						"trace"=> 1,
+						"soap_version"=> SOAP_1_1
+				));
+	}
+}
+?>
\ No newline at end of file
diff --git a/php/classes/WebServer.php b/php/classes/WebServer.php
index 7300ba4..306eff9 100644
--- a/php/classes/WebServer.php
+++ b/php/classes/WebServer.php
@@ -10,6 +10,8 @@ class WebResultMgr
   private $resDOM;
   private $rootEl;
   private $resXP;
+  private $requestManager = null;
+  private $paramLoader = null;
 
   function __construct()
   {
@@ -787,146 +789,141 @@ $vars["sampling"] = strtr($vars["sampling"], array($matches[1] => ""));
 
 
   protected function doDownloadRequest($interval,$paramList,$user,$formatInfo,$dataFileName) {
-  
-  
-     $duration = $this->timeIntervalToDuration($interval['startTime'],$interval['stopTime']);
-
-     if ($interval['sampling']) $structure = 0;// sampling
-else $structure = 2;   // not sampling
-
-     $obj = (object)array(
-"nodeType"     => "download",
-"type"         => "Download",
-"downloadSrc"  => "0",
-"structure"    => $structure,
-"sampling"     => $interval['sampling'],
-"output"       => "",
-"header"       => "0",
-"timesrc"      => "Interval",
-"startDate"    => $interval['startTime'],
-"durationDay"  => $duration["days"],
-"durationHour" => $duration["hours"],
-"durationMin"  => $duration["mins"],
-"durationSec"  => $duration["secs"],
-"list"         => $paramList['params'],
-"milli"        => true,
-"fileformat"   => "ASCII",
-"timeformat"   => "YYYY-MM-DDThh:mm:ss",
-"compression"  => "tar+gzip",
-"leaf"         => true,
-    //ToChange
-    "username"     => $user['userName'],
-    "password"     => $user['userPwd'],
-    "sessionID"    => $user['sessionID']
-   );
-
-    $objectMgr = new RequestMgr('download');
-
-    if (!$objectMgr){
-      if ($this->isSoap)  throw new SoapFault("server01","Cannot init request manager"); 
-      else return array('success' => false, 'message' => "Cannot init request manager");
-    }
-   
-//     $res = $objectMgr->execute($obj);
-
-    $downloadResult = $objectMgr->execute($obj); $error = $downloadResult['error'];
-    $pid = $downloadResult['pid'];
-    $bach= false;
-    if ( $downloadResult['pid'] != 0)
-  $bach= true;
-  
-    $jobMgr = new JobsMgr();
-    
-    if ($bach){
-
-if (!$jobMgr){
-  if ($this->isSoap)  throw new SoapFault("server06","Cannot init job manager"); 
-  else return array('success' => false, 'message' => "Cannot init job manager");
-} 
-  
- while (!($jobMgr->isFinished($pid))){
-  sleep(JOBTIMEOUT);
-}
-
-$newName='result_'.$objectMgr->cachekiller();
-$objectMgr->postProcessing($downloadResult['rawname'], $newName);
-$downloadResult['id']= $downloadResult['rawname'];
-$downloadResult['name'] = $newName;
-$downloadResult['pid'] = 0;
-
-  }
-
-    $from_path = USERPATH.$this->userID.'/RES/'.$downloadResult['id'].'_/';
-
-    if (!file_exists($from_path)){
-      if ($this->isSoap)  throw new SoapFault("server07","User result folder doesn't exist $from_path ERROR $error  "); 
-      else return array('success' => false, 'message' => "User result folder doesn't exist");
-    }
-      
-    $from_file = $from_path.$downloadResult['name'].'.tar.gz';
-
-   if (!file_exists($from_file)){
-      if ($this->isSoap)  throw new SoapFault("server08","Impossible find result file"); 
-      else return array('success' => false, 'message' => "Impossible find result file");
-    }
-
-    if(($downloadResult['pid'] == 0) && file_exists($from_file)){
-if ($formatInfo['format'] == "VOTable"){
-    $res = $objectMgr->generateVOTableFromDownloadResult($downloadResult['id'], $downloadResult['name']);
-    if ($res['success']){
-      $outputFile = $res['files'][0];
-      rename($res['files'][0], WSRESULT.$this->dataFileName.".xml");
-      $outputFile = WSRESULT.$this->dataFileName.".xml";
-    }
-    else {
-      if ($this->isSoap)  throw new SoapFault("server08",$res['message']); 
-      else return array('success' => false, 'message' => $res['message']);
-    }
-}
-elseif ($formatInfo['format'] == "netCDF"){
-  $formatNc = true;
-  if ($this->isSoap)  throw new SoapFault("server09","netCDF format not implemented yet"); 
-    else return array('success' => false, 'message' => "netCDF format not implemented yet");
-}
-else {
-  exec("tar zxvf $from_file");
-  exec("mv $from_path*.txt ".WSRESULT."'".$this->dataFileName.".txt'");
-  $outputFile = WSRESULT.$this->dataFileName.".txt";
-  chmod ($outputFile, 0664);
-}
-    }
-
-    if ($formatInfo['gzip'] == 1){
-      $zipFile = $outputFile.".gz";
-      $this->compress($outputFile, $zipFile);
-      $outputFile = $zipFile;
-    }
-
-    if ($outputFile) {
-      if ($formatInfo['format'] == "VOTable"){
-         $dom = new DOMDocument;
-          $dom->load($outputFile);
-          $tds = $dom->getElementsByTagName('TD');
-    
-          if ($tds->length < 1){
-          if ($this->isSoap)  throw new SoapFault("server10","No data");
-          else return array('success' => false, 'message' => "No data");
-          }
-      }
-      $outputFile = 'http://'.str_replace(BASE_PATH,$_SERVER['SERVER_NAME'].APACHE_ALIAS,$outputFile);
-    }
-
-      if ($bach){
-  $obj = (object)array(
-    "id" => "bkgrd_down_".$pid,
-    "leaf" => true,
-    "nodeType"=>"bkgWorks");
-  $jobMgr->deleteObject($obj);
-  
-}
-else $jobMgr->deleteTmp();
-
-    return  array('success' => true, 'dataFileURLs' => $outputFile);
+  	if ($interval['sampling'])
+  		$structure = 0;// sampling
+  	else
+  		$structure = 2;   // not sampling
+  	
+  	$fileExtension = "";
+  	switch ($formatInfo['format'])
+  	{
+  		case 'netCDF' :
+  			if (!$jobMgr){
+  				if ($this->isSoap)  throw new SoapFault("server01","netCDF format not implemented");
+  				else return array('success' => false, 'message' => "netCDF format not implemented");
+  			}
+  			break;
+  		case 'VOTable' :
+  			$fileformat = "vot";
+  			$kernelExtension = ".vot";
+  			$wsExtension = ".xml";
+  			break;
+  		case 'ASCII' :
+  		default :
+  			$fileformat = "ASCII";
+  			$kernelExtension = ".txt";
+  			$wsExtension = ".txt";
+  	}
+  	
+  	switch ($formatInfo['timeFormat'])
+  	{
+  		case 'unixtime' :
+  			$timeformat = 'Timestamp';
+  			break;
+  		default :
+  			$timeformat = 'YYYY-MM-DDThh:mm:ss';
+  	}
+  	
+  	if ($formatInfo['gzip'] == 1)
+  	{
+  		$compression = "gzip";
+  		$kernelExtension .= ".gz";
+  		$wsExtension .= ".gz";
+  	}
+  	else
+  		$compression = "";
+  	
+  	require_once(INTEGRATION_SRC_DIR."RequestManager.php");
+  	IHMConfigClass::setUserName($this->userID);
+  	if (!isset($this->paramLoader))
+  		 $this->paramLoader = new IHMUserParamLoaderClass();
+
+  	//Build parameter list
+  	$params = array();
+  	
+  	foreach ($paramList['params'] as $paramId)
+  	{
+  		if (preg_match("#^ws_#",$paramId))
+  		{
+  			$res = $this->paramLoader->getDerivedParameterNameFromId($paramId);
+  			if (!$res["success"])
+  			{
+  				if ($this->isSoap)  throw new SoapFault("server02", 'Not available derived parameter '.$paramId);
+  				else return array('success' => false, 'message' => 'Not available derived parameter '.$paramId);
+  			}
+  			$params[] = "ws_".$res['name'];
+  		}
+  		else if (preg_match("#^wsd_#",$paramId))
+  		{
+  			$res = $this->paramLoader->getUploadedParameterNameFromId($paramId);
+  			if (!$res["success"])
+  			{
+  				if ($this->isSoap)  throw new SoapFault("server02", 'Not available user parameter '.$paramId);
+  				else return array('success' => false, 'message' => 'Not available user parameter '.$paramId);
+  			}
+  			$params[] = "wsd_".$res['name'];
+  		}
+  		else
+  			$params[] = $paramId;
+  	}
+  	
+  	$obj = (object)array(
+  			"nodeType"         => "download",
+  			"downloadSrc"      => "0",
+  			"structure"        => $structure,
+  			"refparamSampling" => false,
+  			"sampling"         => $interval['sampling'],
+  			"timesrc"          => "Interval",
+  			"startDate"        => $interval['startTime'],
+  			"stopDate"         => $interval['stopTime'],
+  			"list"             => $params,
+  			"fileformat"       => $fileformat,
+  			"timeformat"       => $timeformat,
+  			"compression"      => $compression,
+  			"disablebatch"     => true
+  	);
+  	
+  	if (!isset($this->requestManager))
+  		$this->requestManager = new RequestManagerClass();
+  	
+  	try {
+  		$downloadResult = $this->requestManager->runIHMRequest($this->userID, $this->getIPclient(), FunctionTypeEnumClass::PARAMS, $obj);
+  	} catch (Exception $e) {
+  		if ($this->isSoap)  throw new SoapFault("server02", 'Exception detected : '.$e->getMessage());
+  		else return array('success' => false, 'message' => 'Exception detected : '.$e->getMessage());
+  	}
+  	  	
+  	if (!$downloadResult['success'])
+  	{
+  		if ($this->isSoap)  throw new SoapFault("server03", $downloadResult['message']);
+  		else return array('success' => false, 'message' => $downloadResult['message']);
+  	}
+  	
+  	$resultFile = USERPATH.$this->userID.'/RES/'.$downloadResult['folder'].'/'.$downloadResult['result'];
+  	$resultFile .= $kernelExtension;
+  	
+  	if (!file_exists($resultFile))
+  	{
+  		if ($this->isSoap)  throw new SoapFault("server04", 'Cannot retrieve result file '.$resultFile);
+  		else return array('success' => false, 'message' => 'Cannot retrieve result file');
+  	}
+  	
+  	rename($resultFile, WSRESULT.$this->dataFileName.$wsExtension);
+  	$outputFile = WSRESULT.$this->dataFileName.$wsExtension;
+  	chmod ($outputFile, 0664);
+  	$outputFile = 'http://'.str_replace(BASE_PATH,$_SERVER['SERVER_NAME'].APACHE_ALIAS,$outputFile);
+  	
+  	$obj = (object)array(
+  			'id' => $downloadResult['id']
+  	);
+  	
+  	try {
+  		$downloadResult = $this->requestManager->runIHMRequest($this->userID, $this->getIPclient(), FunctionTypeEnumClass::PROCESSDELETE, id);
+  	} catch (Exception $e) {
+  		//Nothing to do
+  	}
+  	
+  	return  array('success' => true, 'dataFileURLs' => $outputFile);
      
   }
 
@@ -948,26 +945,30 @@ else $jobMgr->deleteTmp();
   }
 
   protected function getDataFileName($vars, $multiParam){
-      if ($vars['startTime'] && $vars['stopTime'] && $vars['parameterID'] && !$multiParam){
-  $fileName = $vars['parameterID']."-".strtotime($vars['startTime'])."-".strtotime($vars['stopTime'])."-".$vars['sampling'];
-  return array('success' => true, 'fileName' => $fileName);
-      }
-      elseif ($vars['startTime'] && $vars['stopTime'] && $vars['datasetID'] && $multiParam){
-  $datasetName = strtr($vars["datasetID"], array(":" => "_"));
-  $fileName = $datasetName."-".strtotime($vars['startTime'])."-".strtotime($vars['stopTime'])."-".$vars['sampling'];
-  return array('success' => true, 'fileName' => $fileName);
-      }
-      else {
-if (!$vars['startTime'])
-$message="Start time not specified";
-if (!$vars['stopTime'])
-$message="Stop time not specified";
-if (!$vars['parameterID'] && !$multiParam)
-$message="Parameter not specified";
-if (!$vars['datasetID'] && $multiParam)
-$message="DataSet not specified";
-return array('success' => false, 'message' => $message);
-      }
+	if ($vars['startTime'] && $vars['stopTime'] && $vars['parameterID'] && !$multiParam){
+		$fileName = $vars['parameterID']."-".strtotime($vars['startTime'])."-".strtotime($vars['stopTime']);
+  		if (isset($vars['sampling']) && $vars['sampling'] != "" && $vars['sampling'] != 0)
+  			$fileName .= "-".$vars['sampling'];
+  		return array('success' => true, 'fileName' => $fileName);
+	}
+    else if ($vars['startTime'] && $vars['stopTime'] && $vars['datasetID'] && $multiParam){
+		$datasetName = strtr($vars["datasetID"], array(":" => "_"));
+		$fileName = $datasetName."-".strtotime($vars['startTime'])."-".strtotime($vars['stopTime']);
+		if (isset($vars['sampling']) && $vars['sampling'] != "" && $vars['sampling'] != 0)
+			$fileName .= "-".$vars['sampling'];
+		return array('success' => true, 'fileName' => $fileName);
+	}
+	else {
+		if (!$vars['startTime'])
+			$message="Start time not specified";
+		if (!$vars['stopTime'])
+			$message="Stop time not specified";
+		if (!$vars['parameterID'] && !$multiParam)
+			$message="Parameter not specified";
+		if (!$vars['datasetID'] && $multiParam)
+			$message="DataSet not specified";
+		return array('success' => false, 'message' => $message);
+	}
   }
 
    private  function compress($srcName, $dstName) {
@@ -982,5 +983,4 @@ return array('success' => false, 'message' => $message);
     }
 
 }
-?>
-
+?>
\ No newline at end of file
diff --git a/php/testWebServer.php b/php/testWebServer.php
new file mode 100644
index 0000000..b1ae973
--- /dev/null
+++ b/php/testWebServer.php
@@ -0,0 +1,138 @@
+<?php 
+
+require_once("classes/WSClientSOAP.php");
+require_once("classes/WSClientREST.php");
+
+function runSuiteTests($client)
+{
+	//Test isAlive function
+	$res = $client->isAlive();
+	if (!isset($res) || ($res != true))
+		echo "[ERROR] - Error during call of isAlive function".PHP_EOL;
+	else
+		echo "[OK] - isAlive".PHP_EOL;
+	
+	//Test getTimeTablesList function without userID & password
+	$res = $client->getTimeTablesList();
+	if (!isset($res) || !$res->success)
+		echo "[ERROR] - Error during call of getTimeTablesList function - Test 1".PHP_EOL;
+	else
+		echo "[OK] - getTimeTablesList - Test 1 - ".$res->TimeTablesList.PHP_EOL;
+	
+	//Test getTimeTablesList function with userID & password
+	$res = $client->getTimeTablesList("testKernel", "amda");
+	if (!isset($res) || !$res->success)
+		echo "[ERROR] - Error during call of getTimeTablesList function - Test 2".PHP_EOL;
+	else
+		echo "[OK] - getTimeTablesList - Test 2 - ".$res->TimeTablesList.PHP_EOL;
+	
+	//Test getTimeTable function without userID & password
+	$res = $client->getTimeTable("sharedtt_0");
+	if (!isset($res) || !$res->success)
+		echo "[ERROR] - Error during call of getTimeTable function - Test 1".PHP_EOL;
+	else
+		echo "[OK] - getTimeTable - Test 1 - ".$res->ttFileURL.PHP_EOL;
+	
+	//Test getTimeTable function with userID & password
+	$res = $client->getTimeTable("tt_0", "testKernel", "amda");
+	if (!isset($res) || !$res->success)
+		echo "[ERROR] - Error during call of getTimeTable function - Test 2".PHP_EOL;
+	else
+		echo "[OK] - getTimeTable - Test 2 - ".$res->ttFileURL.PHP_EOL;
+	
+	//Test getParameterList function for impex user
+	$res = $client->getParameterList("impex");
+	if (!isset($res) || !$res->success)
+		echo "[ERROR] - Error during call of getParameterList function - Test 1".PHP_EOL;
+	else
+		echo "[OK] - getParameterList - Test 1 - ".$res->ParameterList->LocalDataBaseParameters.PHP_EOL;
+	
+	//Test getParameterList function with userID & password
+	$res = $client->getParameterList("testKernel", "amda");
+	if (!isset($res) || !$res->success)
+		echo "[ERROR] - Error during call of getParameterList function - Test 2".PHP_EOL;
+	else
+	{
+		echo "[OK] - getParameterList - Test 2 :".PHP_EOL;
+		echo "		- UserDefinedParameters : ".$res->ParameterList->UserDefinedParameters.PHP_EOL;
+		echo "		- LocalDataBaseParameters : ".$res->ParameterList->LocalDataBaseParameters.PHP_EOL;
+	}
+	
+	//Test getObsDataTree function
+	$res = $client->getObsDataTree();
+	if (!isset($res) || !$res->success)
+		echo "[ERROR] - Error during call of getObsDataTree function".PHP_EOL;
+	else
+		echo "[OK] - getObsDataTree - Test 1 - ".$res->WorkSpace->LocalDataBaseParameters.PHP_EOL;
+	
+	//Test getParameter function
+	$res = $client->getParameter("2008-01-01T00:00:00", "2008-01-02T00:00:00", "imf", 0, "", "", WSOutputFileFormat::ASCII);
+	if (!isset($res) || !$res->success)
+		echo "[ERROR] - Error during call of getParameter function - Test 1".PHP_EOL;
+	else
+		echo "[OK] - getParameter - Test 1 - ".$res->dataFileURLs.PHP_EOL;
+		
+	//Test getParameter function
+	$res = $client->getParameter("2008-01-01T00:00:00", "2008-01-02T00:00:00", "imf", 3600, "", "", WSOutputFileFormat::ASCII);
+	if (!isset($res) || !$res->success)
+		echo "[ERROR] - Error during call of getParameter function - Test 2".PHP_EOL;
+	else
+		echo "[OK] - getParameter - Test 2 - ".$res->dataFileURLs.PHP_EOL;
+	
+	//Test getParameter function
+	$res = $client->getParameter("2008-01-01T00:00:00", "2008-01-02T00:00:00", "imf", 0, "", "", WSOutputFileFormat::VOTABLE);
+	if (!isset($res) || !$res->success)
+		echo "[ERROR] - Error during call of getParameter function - Test 3".PHP_EOL;
+	else
+		echo "[OK] - getParameter - Test 3 - ".$res->dataFileURLs.PHP_EOL;
+	
+	//Test getParameter function
+	$res = $client->getParameter("2008-01-01T00:00:00", "2008-01-02T00:00:00", "imf", 3600, "", "", WSOutputFileFormat::VOTABLE);
+	if (!isset($res) || !$res->success)
+		echo "[ERROR] - Error during call of getParameter function - Test 4".PHP_EOL;
+	else
+		echo "[OK] - getParameter - Test 4 - ".$res->dataFileURLs.PHP_EOL;
+	
+	//Test getParameter function
+	$res = $client->getParameter("2008-01-01T00:00:00", "2008-01-02T00:00:00", "imf", 0, "", "", WSOutputFileFormat::ASCII, WSOutputTimeFormat::TIMESTAMP);
+	if (!isset($res) || !$res->success)
+		echo "[ERROR] - Error during call of getParameter function - Test 5".PHP_EOL;
+	else
+		echo "[OK] - getParameter - Test 5 - ".$res->dataFileURLs.PHP_EOL;
+	
+	//Test getParameter function
+	$res = $client->getParameter("2008-01-01T00:00:00", "2008-01-02T00:00:00", "imf", 0, "", "", WSOutputFileFormat::VOTABLE, WSOutputTimeFormat::ISO, 1);
+	if (!isset($res) || !$res->success)
+		echo "[ERROR] - Error during call of getParameter function - Test 6".PHP_EOL;
+	else
+		echo "[OK] - getParameter - Test 6 - ".$res->dataFileURLs.PHP_EOL;
+	
+	//Test getDataset function
+	$res = $client->getDataset("2008-01-01T00:00:00", "2008-01-02T00:00:00", "ground:based:asy", 0, "", "", WSOutputFileFormat::ASCII);
+	if (!isset($res) || !$res->success)
+		echo "[ERROR] - Error during call of getDataset function".PHP_EOL;
+	else
+		echo "[OK] - getDataset - ".$res->dataFileURLs.PHP_EOL;
+	
+	//Test getOrbites function
+	$res = $client->getOrbites("2008-01-01T00:00:00", "2008-01-02T00:00:00", WSSpacecraft::VEX, WSCoordinatesSytem::VSO, WSOrbitUnit::RV,
+			0, "", "", WSOutputFileFormat::ASCII);
+	if (!isset($res) || !$res->success)
+		echo "[ERROR] - Error during call of getOrbites function".PHP_EOL;
+	else
+		echo "[OK] - getOrbites - ".$res->dataFileURLs.PHP_EOL;
+}
+
+$clientSOAP = new WSClientSOAP("http://localhost/NEWAMDA-BENJAMIN/public/wsdl/Methods_AMDA.wsdl");
+
+echo "==> Suite tests for SOAP client".PHP_EOL;
+runSuiteTests($clientSOAP);
+
+//REST client is obsolete
+/*$clientREST = new WSClientREST("http://localhost/NEWAMDA-BENJAMIN/php/rest/");
+
+echo "==> Suite tests for REST client".PHP_EOL;
+runSuiteTests($clientREST);*/
+
+
+?>
\ No newline at end of file
--
libgit2 0.21.2