function genericExecute($params)
 {
     $method = $params['method'];
     unset($params['method']);
     $session = new PluginWebservicesMethodSession();
     return $session->execute($method, $params, WEBSERVICE_PROTOCOL_SOAP);
 }
Пример #2
0
    header("HTTP/1.0 500 Bad content type");
    die("Bad content type");
}
if (!isset($GLOBALS["HTTP_RAW_POST_DATA"]) || empty($GLOBALS["HTTP_RAW_POST_DATA"])) {
    header("HTTP/1.0 500 No content");
}
$method = "";
$allparams = "";
if (isset($GLOBALS["HTTP_RAW_POST_DATA"])) {
    $allparams = xmlrpc_decode_request($GLOBALS["HTTP_RAW_POST_DATA"], $method, 'UTF-8');
}
if (empty($method) || !is_array($allparams)) {
    header("HTTP/1.0 500 Bad content");
}
$params = isset($allparams[0]) && is_array($allparams[0]) ? $allparams[0] : array();
if (isset($params['iso8859'])) {
    $iso = true;
    unset($params['iso8859']);
} else {
    $iso = false;
}
$session = new PluginWebservicesMethodSession();
$resp = $session->execute($method, $params, WEBSERVICE_PROTOCOL_XMLRPC);
header("Content-type: text/xml");
if ($iso) {
    decodeFromUtf8Array($resp);
    echo xmlrpc_encode_request(NULL, $resp, array('encoding' => 'ISO-8859-1'));
} else {
    // request without method is a response ;)
    echo xmlrpc_encode_request(NULL, $resp, array('encoding' => 'UTF-8', 'escaping' => 'markup'));
}
Пример #3
0
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with webservices. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
if (!function_exists("json_encode")) {
    header("HTTP/1.0 500 Extension json not loaded");
    die("Extension json not loaded");
}
define('DO_NOT_CHECK_HTTP_REFERER', 1);
define('GLPI_ROOT', '../..');
// define session_id before any other think
if (isset($_GET['session'])) {
    include_once "inc/methodcommon.class.php";
    include_once "inc/methodsession.class.php";
    $session = new PluginWebservicesMethodSession();
    $session->setSession($_GET['session']);
}
include GLPI_ROOT . "/inc/includes.php";
Plugin::load('webservices', true);
Plugin::doHook("webservices");
plugin_webservices_registerMethods();
error_reporting(E_ALL);
$method = isset($_GET['method']) ? $_GET['method'] : '';
$session = new PluginWebservicesMethodSession();
$resp = $session->execute($method, $_GET, WEBSERVICE_PROTOCOL_REST);
// Send UTF8 Headers
header("Content-Type: text/html; charset=UTF-8");
echo json_encode($resp);