13if (version_compare(PHP_VERSION,
'5.0',
'>=')) {
14 if (!class_exists(
'soap_server',
false)) {
18 if (!class_exists(
'soap_server')) {
27 $this->
debug(
'in invoke_method, methodname=' . $this->methodname .
' methodURI=' . $this->methodURI .
' SOAPAction=' . $this->SOAPAction);
30 if ($this->opData = $this->wsdl->getOperationData($this->methodname)) {
31 $this->
debug(
'in invoke_method, found WSDL operation=' . $this->methodname);
33 } elseif ($this->opData = $this->wsdl->getOperationDataForSoapAction($this->SOAPAction)) {
35 $this->
debug(
'in invoke_method, found WSDL soapAction=' . $this->SOAPAction .
' for operation=' . $this->opData[
'name']);
37 $this->methodname = $this->opData[
'name'];
39 $this->
debug(
'in invoke_method, no WSDL for operation=' . $this->methodname);
40 $this->
fault(
'Client',
"Operation '" . $this->methodname .
"' is not defined in the WSDL for this service");
44 $this->
debug(
'in invoke_method, no WSDL to validate method');
52 if (strpos($this->methodname,
'..') > 0) {
54 } elseif (strpos($this->methodname,
'.') > 0) {
60 if (strlen($delim) > 0 && 1 == substr_count($this->methodname, $delim)
62 XC_CLASS_EXISTS(substr($this->methodname, 0, strpos($this->methodname, $delim)))) {
64 $class = substr($this->methodname, 0, strpos($this->methodname, $delim));
65 $method = substr($this->methodname, strpos($this->methodname, $delim) + strlen($delim));
66 $this->
debug(
"in invoke_method, class=$class method=$method delim=$delim");
71 if (!function_exists($this->methodname)) {
72 $this->
debug(
"in invoke_method, function '$this->methodname' not found!");
73 $this->result =
'fault: method not found';
74 $this->
fault(
'Client',
"method '$this->methodname' not defined in service");
78 $method_to_compare = (
'4.' == substr(phpversion(), 0, 2)) ? strtolower($method) : $method;
79 if (!in_array($method_to_compare, get_class_methods($class))) {
80 $this->
debug(
"in invoke_method, method '$this->methodname' not found in class '$class'!");
81 $this->result =
'fault: method not found';
82 $this->
fault(
'Client',
"method '$this->methodname' not defined in service");
89 if (! $this->
verify_method($this->methodname, $this->methodparams)) {
91 $this->
debug(
'ERROR: request not verified against method signature');
92 $this->result =
'fault: request failed validation against method signature';
94 $this->
fault(
'Client',
"Operation '$this->methodname' not defined in service.");
99 $this->
debug(
'in invoke_method, params:');
101 $this->
debug(
"in invoke_method, calling '$this->methodname'");
104 $this->
debug(
'in invoke_method, calling function using call_user_func_array()');
105 $call_arg = (string)$this->methodname;
106 } elseif (
'..' == $delim) {
107 $this->
debug(
'in invoke_method, calling class method using call_user_func_array()');
108 $call_arg = [$class, $method];
110 $this->
debug(
'in invoke_method, calling instance method using call_user_func_array()');
111 $instance =
new $class ();
112 $call_arg = [&$instance, $method];
118 $root =& XCube_Root::getSingleton();
120 $retValue = call_user_func_array($call_arg, [$root->mContext->mUser, $this->methodparams]);
122 if (is_array($retValue)) {
123 $retValue = $this->_encodeUTF8($retValue, $root->mLanguageManager);
125 $retValue = $root->mLanguageManager->encodeUTF8($retValue);
128 $this->methodreturn = $retValue;
130 $this->
debug(
'in invoke_method, methodreturn:');
132 $this->
debug(
"in invoke_method, called method $this->methodname, received $this->methodreturn of type ".gettype($this->methodreturn));
135 public function _encodeUTF8($arr, &$languageManager)
137 foreach (array_keys($arr) as $key) {
138 if (is_array($arr[$key])) {
139 $arr[$key] = $this->_encodeUTF8($arr[$key], $languageManager);
141 $arr[$key] = $languageManager->encodeUTF8($arr[$key]);
verify_method($operation, $request)
fault($faultcode, $faultstring, $faultactor='', $faultdetail='')