/** * * @param WSRequestParameters $paramObj * @return mixed */ public function callMethod(WSRequestParameters $paramObj) { $methodName = $paramObj->getMethod(); $methodParameters = $paramObj->getParameters(); $methodConfiguration = $this->getConfiguration('methods', $methodName); $serviceWrapperClassName = $methodConfiguration['wrapper']; if ($paramObj->getWrapperObject()) { $serviceWrapperInstance = $paramObj->getWrapperObject(); } else { $serviceWrapperInstance = new $serviceWrapperClassName(); } // If web service config mentions parameters, only get them in that order // if (isset($methodConfiguration['params'])) { $paramNames = $methodConfiguration['params']; $expectedParams = array(); $missingParameters = array(); foreach ($paramNames as $paramName) { if (isset($methodParameters[$paramName])) { $expectedParams[$paramName] = $methodParameters[$paramName]; } else { $missingParameters[] = $paramName; } } if (count($missingParameters) > 0) { throw new WebServiceException("Parameters missing: " . implode(',', $missingParameters), 400); } } else { $expectedParams = $methodParameters; } return call_user_func_array(array($serviceWrapperInstance, $methodName), $expectedParams); }
/** * * @param WSRequestParameters $paramObj * @return mixed */ public function callMethod(WSRequestParameters $paramObj) { $methodName = $paramObj->getMethod(); $methodConfigurations = $this->getConfiguration('methods', $methodName); $serviceWrapperClassName = $methodConfigurations['wrapper']; $serviceWrapperInstance = new $serviceWrapperClassName(); return call_user_func_array(array($serviceWrapperInstance, $methodName), $paramObj->getParameters()); }