/**
  * 
  * @access 
  * @author "Patrick Plichart <*****@*****.**>"
  */
 public function testStoreItemVariable()
 {
     //storeItemVariable(core_kernel_classes_Resource $deliveryResult, $test, $item, taoResultServer_models_classes_Variable $itemVariable, $callId)
     $deliveryResult = $this->service->storeDeliveryResult();
     $this->service->storeTestTaker($deliveryResult, "unittest_testtaker");
     $this->service->storeDelivery($deliveryResult, "unittest_delivery");
     $itemVariable = new taoResultServer_models_classes_ResponseVariable();
     $itemVariable->setCandidateResponse("unittest_candidateResponse");
     $itemVariable->setCardinality("single");
     $itemVariable->setIdentifier("unittest_identifier");
     $itemVariable->setBaseType("file");
     $storedVariable = $this->service->storeItemVariable($deliveryResult, "myTest", "myItem", $itemVariable, "callid_31");
 }
 /**
  * Transmit a QtiSm Runtime Variable to the target Result Server as an Item Result.
  * 
  * @param mixed $variables QtiSm Runtime Variable(s).
  * @param string $transmissionId A unique identifier that identifies uniquely the visited item.
  * @param string $itemUri An optional URI that identifies uniquely the item the $variable comes from.
  * @param string $testUri An optional URL that identifies uniquely the test the $variable comes from.
  * @throws taoQtiCommon_helpers_ResultTransmissionException If an error occurs while transmitting the Variable to the target Result Server.
  */
 public function transmitItemVariable($variables, $transmissionId, $itemUri = '', $testUri = '')
 {
     $itemVariableSet = array();
     if (is_array($variables) === false) {
         $variables = array($variables);
     }
     foreach ($variables as $variable) {
         $identifier = $variable->getIdentifier();
         if ($variable instanceof OutcomeVariable) {
             $value = $variable->getValue();
             $resultVariable = new taoResultServer_models_classes_OutcomeVariable();
             $resultVariable->setIdentifier($identifier);
             $resultVariable->setBaseType(BaseType::getNameByConstant($variable->getBaseType()));
             $resultVariable->setCardinality(Cardinality::getNameByConstant($variable->getCardinality()));
             $resultVariable->setValue(self::transformValue($value));
             $itemVariableSet[] = $resultVariable;
         } else {
             if ($variable instanceof ResponseVariable) {
                 // ResponseVariable.
                 $value = $variable->getValue();
                 $resultVariable = new taoResultServer_models_classes_ResponseVariable();
                 $resultVariable->setIdentifier($identifier);
                 $resultVariable->setBaseType(BaseType::getNameByConstant($variable->getBaseType()));
                 $resultVariable->setCardinality(Cardinality::getNameByConstant($variable->getCardinality()));
                 $resultVariable->setCandidateResponse(self::transformValue($value));
                 // The fact that the response is correct must not be sent for built-in
                 // response variables 'duration' and 'numAttempts'.
                 if (!in_array($identifier, array('duration', 'numAttempts', 'comment'))) {
                     $resultVariable->setCorrectResponse($variable->isCorrect());
                 }
                 $itemVariableSet[] = $resultVariable;
             }
         }
     }
     try {
         common_Logger::d("Sending Variables to result server.");
         $this->getResultServer()->storeItemVariableSet($testUri, $itemUri, $itemVariableSet, $transmissionId);
     } catch (Exception $e) {
         $msg = "An error occured while transmitting an Outcome Variable to the target result server.";
         $code = taoQtiCommon_helpers_ResultTransmissionException::OUTCOME;
         throw new taoQtiCommon_helpers_ResultTransmissionException($msg, $code);
     }
 }
<?php

require_once dirname(__FILE__) . '/../includes/raw_start.php';
//done ahead of your code
$rs = new taoResultServer_models_classes_ResultServerStateFull();
$rs->initResultServer("http://www.tao.lu/Ontologies/taoAltResultStorage.rdf#KeyValueResultStorage");
//optional control on Ids
$id = $rs->spawnResult("myCoolId");
$rs->storeRelatedTestTaker("Jerome the big guy");
$rs->storeRelatedDelivery("Jerome's super delivery");
//you are doing this
$itemVariable = new taoResultServer_models_classes_ResponseVariable();
$itemVariable->setCandidateResponse("[Jerome Awesome]");
$itemVariable->setCardinality("single");
$itemVariable->setIdentifier("unittest_identifier");
$itemVariable->setBaseType("pair");
$callIdItem = "An identifier of the execution of an item occurence for a test taker";
$rs->storeItemVariable("sometest identifier", "someidentifier", $itemVariable, $callIdItem);
//and youn want to do this
$variables = $rs->getVariables($callIdItem);
$variable = $rs->getVariable($callIdItem, "unittest_identifier");
print_r($variable);
$testtaker = $rs->getTestTaker($id);
print_r($testtaker);
$delivery = $rs->getDelivery($id);
print_r($delivery);
//consider results may have been broadcasted to different storages,
//thus if one of them does not contain the readable interface,
//you don't have an exception globally but partial data.
 /**
  * @author  "Patrick Plichart, <*****@*****.**>"
  */
 public function storeItemVariableSet()
 {
     $variables = array();
     $item = $this->hasRequestParameter("itemId") ? $this->getRequestParameter("itemId") : "undefined";
     $callIdItem = $this->hasRequestParameter("serviceCallId") ? $this->getRequestParameter("serviceCallId") : "undefined";
     $test = $this->hasRequestParameter("testId") ? $this->getRequestParameter("testId") : "undefined";
     if ($this->hasRequestParameter("outcomeVariables")) {
         $outcomeVariables = $this->getRequestParameter("outcomeVariables");
         foreach ($outcomeVariables as $variableName => $outcomeValue) {
             $outComeVariable = new taoResultServer_models_classes_OutcomeVariable();
             //$outComeVariable->setBaseType("int");
             $outComeVariable->setCardinality("single");
             $outComeVariable->setIdentifier($variableName);
             $outComeVariable->setValue($outcomeValue);
             $variables[] = $outComeVariable;
         }
     }
     if ($this->hasRequestParameter("responseVariables")) {
         $responseVariables = $this->getRequestParameter("responseVariables");
         foreach ($responseVariables as $variableName => $responseValue) {
             $responseVariable = new taoResultServer_models_classes_ResponseVariable();
             //$responseVariable->setBaseType("int");
             //$responseVariable->setCardinality("single");
             $responseVariable->setIdentifier($variableName);
             $responseVariable->setCandidateResponse($responseValue);
             //$responseVariable->setCorrectResponse(true);
             $variables[] = $responseVariable;
         }
     }
     if ($this->hasRequestParameter("traceVariables")) {
         $traceVariables = $this->getRequestParameter("outcomeVariables");
         foreach ($traceVariables as $variableName => $traceValue) {
             $traceVariable = new taoResultServer_models_classes_TraceVariable();
             //$outComeVariable->setBaseType("int");
             $traceVariable->setIdentifier($variableName);
             $traceVariable->setTrace($traceValue);
             $variables[] = $traceVariable;
         }
     }
     try {
         $data = $this->service->storeItemVariableSet($test, $item, $variables, $callIdItem);
     } catch (exception $e) {
         $this->returnFailure($e);
     }
     return $this->returnSuccess($data);
 }