mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
web serviceMDL-12886 refactor servers into object + add Zend_soap and Zend_xmlrpc server
This commit is contained in:
parent
625b51d4e0
commit
06e7fadc43
79 changed files with 10475 additions and 211 deletions
61
webservice/amf/lib.php
Normal file
61
webservice/amf/lib.php
Normal file
|
@ -0,0 +1,61 @@
|
|||
<?php
|
||||
/**
|
||||
* Moodle - Modular Object-Oriented Dynamic Learning Environment
|
||||
* http://moodle.com
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details:
|
||||
*
|
||||
* http://www.gnu.org/copyleft/gpl.html
|
||||
*
|
||||
* @category Moodle
|
||||
* @package webservice
|
||||
* @copyright Copyright (c) 1999 onwards Martin Dougiamas http://dougiamas.com
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL License
|
||||
*/
|
||||
|
||||
|
||||
require_once('../lib.php');
|
||||
|
||||
/*
|
||||
* AMF server class
|
||||
*/
|
||||
final class amf_server extends webservice_server {
|
||||
|
||||
|
||||
public function __construct() {
|
||||
//set web service proctol name
|
||||
$this->set_protocolname("Amf");
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the AMF server
|
||||
*/
|
||||
public function run() {
|
||||
include "Zend/Loader.php";
|
||||
Zend_Loader::registerAutoload();
|
||||
|
||||
//retrieve the api name
|
||||
$classpath = optional_param(classpath,'user',PARAM_ALPHA);
|
||||
require_once(dirname(__FILE__) . '/../../'.$classpath.'/external.php');
|
||||
|
||||
/// run the Zend AMF server
|
||||
$server = new Zend_Amf_Server();
|
||||
$server->setClass($classpath."_external");
|
||||
$response = $server->handle();
|
||||
echo $response;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
?>
|
|
@ -1,32 +1,39 @@
|
|||
<?php
|
||||
/**
|
||||
* Created on 01/20/2009
|
||||
* Moodle - Modular Object-Oriented Dynamic Learning Environment
|
||||
* http://moodle.com
|
||||
*
|
||||
* AMF Moodle server.
|
||||
* LICENSE
|
||||
*
|
||||
* @author Jerome Mouneyrac
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details:
|
||||
*
|
||||
* http://www.gnu.org/copyleft/gpl.html
|
||||
*
|
||||
* @category Moodle
|
||||
* @package webservice
|
||||
* @copyright Copyright (c) 1999 onwards Martin Dougiamas http://dougiamas.com
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL License
|
||||
*/
|
||||
|
||||
/**
|
||||
* Moodle AMF server
|
||||
*/
|
||||
require_once(dirname(__FILE__) . '/../../config.php');
|
||||
include "Zend/Loader.php";
|
||||
Zend_Loader::registerAutoload();
|
||||
require_once('lib.php');
|
||||
|
||||
if (empty($CFG->enablewebservices)) {
|
||||
die;
|
||||
}
|
||||
|
||||
/*
|
||||
* FULL SERVER
|
||||
*
|
||||
*/
|
||||
//retrieve the api name
|
||||
$classpath = optional_param(classpath,'user',PARAM_ALPHA);
|
||||
require_once(dirname(__FILE__) . '/../../'.$classpath.'/external.php');
|
||||
|
||||
/// run the server
|
||||
$server = new Zend_Amf_Server();
|
||||
$server->setClass($classpath."_external");
|
||||
$response = $server->handle();
|
||||
echo $response;
|
||||
|
||||
$server = new amf_server();
|
||||
$server->run();
|
||||
|
||||
?>
|
Loading…
Add table
Add a link
Reference in a new issue