-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsoap.php.dist
54 lines (50 loc) · 1.67 KB
/
soap.php.dist
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
// initialization script
require_once 'init.php';
class AdiantiSoapServer
{
public function __call($method, $parameters)
{
$class = isset($_REQUEST['class']) ? $_REQUEST['class'] : '';
$response = NULL;
// aqui implementar mecanismo de controle
if (!in_array($class, array('CustomerService')))
{
throw new SoapFault('server', _t('Permission denied'));
}
try
{
if (class_exists($class))
{
if (method_exists($class, $method))
{
$rf = new ReflectionMethod($class, $method);
if ($rf->isStatic())
{
$response = call_user_func_array(array($class, $method),$parameters);
}
else
{
$response = call_user_func_array(array(new $class($_GET), $method),$parameters);
}
return $response;
}
else
{
throw new SoapFault('server', TAdiantiCoreTranslator::translate('Method ^1 not found', "$class::$method"));
}
}
else
{
throw new SoapFault('server', TAdiantiCoreTranslator::translate('Class ^1 not found', $class));
}
}
catch (Exception $e)
{
throw new SoapFault('server', $e->getMessage());
}
}
}
$server = new SoapServer(NULL, array('encoding' => 'UTF-8', 'uri' => 'http://test-uri/'));
$server->setClass('AdiantiSoapServer');
$server->handle();