function ProcessRequestBody(&$cserver, $body) { $functionName = $body->name(); $namespaceURI = $body->namespaceURI(); $requestNode = $body; // If this is request name in functionName, get functionName. if (!in_array($functionName, $this->FunctionList) and isset($this->MessageTags[$functionName])) { $functionName = $this->MessageTags[$functionName]; } if (!in_array($functionName, $this->FunctionList)) { CSOAPServer::ShowSOAPFault("Trying to access unregistered function: " . $functionName); return true; } $objectName = ""; $params = array(); $paramsDecoder = new CSOAPResponse($functionName, $namespaceURI); $paramsDecoder->setTypensVars($this->TypensVars); if (!isset($this->TypensVars[$functionName]) or !isset($this->TypensVars[$functionName]["myclassname"]) or !isset($this->TypensVars[$functionName]["input"])) { CSOAPServer::ShowSOAPFault("Requested function has no type specified: " . $functionName); return true; } $objectName = $this->TypensVars[$functionName]["myclassname"]; $inputParams = $this->TypensVars[$functionName]["input"]; $httpAuth = "N"; if (isset($this->TypensVars[$functionName]["httpauth"])) { $httpAuth = $this->TypensVars[$functionName]["httpauth"]; } if ($httpAuth == "Y" and !CWebService::MethodRequireHTTPAuth($objectName, $functionName)) { CSOAPServer::ShowSOAPFault("Requested function requires HTTP Basic Auth to be done before."); return true; } $requestParams = array(); // reorganize params foreach ($requestNode->children() as $parameterNode) { if (!$parameterNode->name()) { continue; } $requestParams[$parameterNode->name()] = $parameterNode; } // check parameters/decode // check strict params foreach ($inputParams as $pname => $param) { $decoded = null; if (isset($requestParams[$pname])) { $decoded = $paramsDecoder->decodeDataTypes($requestParams[$pname]); } if (is_object($decoded) and (get_class($decoded) == "CSOAPFault" or get_class($decoded) == "csoapfault")) { CSOAPServer::ShowSOAPFault($decoded); return true; } if (!isset($decoded) and (!isset($param["strict"]) or isset($param["strict"]) and $param["strict"] == "strict")) { CSOAPServer::ShowSOAPFault("Request has no enought params of strict type to be decoded. "); return true; } $params[] = $decoded; } //AddMessage2Log(mydump($params)); unset($paramsDecoder); $object = null; if (class_exists($objectName)) { $object = new $objectName(); } if (is_object($object) && method_exists($object, $functionName)) { $this->ShowResponse($cserver, $functionName, $namespaceURI, call_user_func_array(array($object, $functionName), $params)); } else { if (!class_exists($objectName)) { $this->ShowResponse($cserver, $functionName, $namespaceURI, new CSOAPFault('Server Error', 'Object not found')); } else { $this->ShowResponse($cserver, $functionName, $namespaceURI, new CSOAPFault('Server Error', 'Method not found')); } } return true; }