[ Index ] |
PHP Cross Reference of moodle-2.8 |
[Summary view] [Print] [Text view]
1 <?php 2 // This file is part of Moodle - http://moodle.org/ 3 // 4 // Moodle is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // Moodle is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU General Public License for more details. 13 // 14 // You should have received a copy of the GNU General Public License 15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 16 17 18 /** 19 * Moodle SOAP library 20 * 21 * @package webservice_soap 22 * @copyright 2009 Jerome Mouneyrac 23 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 24 */ 25 26 require_once 'Zend/Soap/Client.php'; 27 28 /** 29 * Moodle SOAP client 30 * 31 * It has been implemented for unit testing purpose (all protocols have similar client) 32 * 33 * @package webservice_soap 34 * @copyright 2010 Jerome Mouneyrac 35 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 36 */ 37 class webservice_soap_client extends Zend_Soap_Client { 38 39 /** @var string server url e.g. https://yyyyy.com/server.php */ 40 private $serverurl; 41 42 /** 43 * Constructor 44 * 45 * @param string $serverurl a Moodle URL 46 * @param string $token the token used to do the web service call 47 * @param array $options PHP SOAP client options - see php.net 48 */ 49 public function __construct($serverurl, $token, $options = null) { 50 $this->serverurl = $serverurl; 51 $wsdl = $serverurl . "?wstoken=" . $token . '&wsdl=1'; 52 parent::__construct($wsdl, $options); 53 } 54 55 /** 56 * Set the token used to do the SOAP call 57 * 58 * @param string $token the token used to do the web service call 59 */ 60 public function set_token($token) { 61 $wsdl = $this->serverurl . "?wstoken=" . $token . '&wsdl=1'; 62 $this->setWsdl($wsdl); 63 } 64 65 /** 66 * Execute client WS request with token authentication 67 * 68 * @param string $functionname the function name 69 * @param array $params the parameters of the function 70 * @return mixed 71 */ 72 public function call($functionname, $params) { 73 global $DB, $CFG; 74 75 //zend expects 0 based array with numeric indexes 76 $params = array_values($params); 77 78 //traditional Zend soap client call (integrating the token into the URL) 79 $result = $this->__call($functionname, $params); 80 81 return $result; 82 } 83 84 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 20:29:05 2014 | Cross-referenced by PHPXref 0.7.1 |