/**
  * Store avatar picture
  * @param int $a_vuserid
  * @param array $a_file_info array('name' => filename, 'type' => 0|1, 'file' => path)
  */
 public function storeAvatar($a_vuserid, $a_file_info)
 {
     try {
         $this->initClient('cid:myid', $a_file_info['file']);
         $avatar = new stdClass();
         $avatar->userid = $a_vuserid;
         $payload = '<ns1:storeAvatarRequest xmlns:ns1="http://www.vitero.de/schema/mtom">' . '<ns1:userid>' . $a_vuserid . '</ns1:userid>' . '<ns1:filename>' . $a_file_info['name'] . '</ns1:filename>' . '<ns1:type>' . $a_file_info['type'] . '</ns1:type>' . '<ns1:file><xop:Include xmlns:xop="http://www.w3.org/2004/08/xop/include" href="cid:myid"/></ns1:file>' . '</ns1:storeAvatarRequest>';
         $message = new WSMessage($payload, array('inputHeaders' => array(ilViteroSoapWsseAuthHeader::getWSFHeader($this->getSettings()->getAdminUser(), $this->getSettings()->getAdminPass())), 'attachments' => array('myid' => file_get_contents($a_file_info['file']))));
         $resp = $this->client->request($message);
     } catch (Exception $e) {
         $GLOBALS['ilLog']->write(__METHOD__ . ': ' . $e->getMessage());
         $GLOBALS['ilLog']->write(__METHOD__ . ': Last Request: ' . $this->client->getLastRequest());
         $GLOBALS['ilLog']->write(__METHOD__ . ': Last Response: ' . $this->client->getLastResponse());
         #throw new ilViteroConnectorException($e->getMessage(),0);
     }
 }
Example #2
0
 /**
  * sendRequest()
  */
 public function sendRequest($action, $req)
 {
     if ($this->_h_debug) {
         _h_debug("SEND Action: {$action}");
     }
     $sessid = $this->_h_session;
     $realm = $this->_h_realm;
     $soapClient = new SoapClient(null, array('uri' => H_URI, 'location' => H_URI));
     $ret = $soapClient->request($realm, $action, $req, $sessid);
     if ($this->_h_debug) {
         _h_debug("REQUEST ====>\n");
         _h_debug("REALM: {$realm} ACTION: {$action} SESSID: {$sessid}\n");
         print_r($req);
         _h_debug("RESPONSE <=======\n");
         print_r($ret);
     }
     return $ret;
 }