/** * This function sends a method call to a specified service. * * @param string $method The name of the remote method to call. * @param mixed $data The data to send to the web service. * @return mixed The response from the server or false in the event of failure. */ function _send($method, $data) { $dataMessage = array(); foreach ($data as $element) { if (is_object($element) && is_subclass_of($element, 'OA_Info')) { $dataMessage[] = XmlRpcUtils::getEntityWithNotNullFields($element); } else { $dataMessage[] = XML_RPC_encode($element); } } $message = new XML_RPC_Message($method, $dataMessage); $client =& $this->_getClient(); // Send the XML-RPC message to the server. $response = $client->send($message, $this->timeout, $this->ssl ? 'https' : 'http'); // Check for an error response. if ($response && $response->faultCode() == 0) { $result = XML_RPC_decode($response->value()); } else { trigger_error('XML-RPC Error (' . $response->faultCode() . '): ' . $response->faultString() . ' in method ' . $method . '()', E_USER_ERROR); } return $result; }
/** * Converts Info Object into the array of XML_RPC_Response structures * * @access public * * @param object $aInfoObjects * * @return XML_RPC_Response */ function getArrayOfEntityResponse($aInfoObjects) { $cRecords = 0; foreach ($aInfoObjects as $oInfoObject) { $xmlValue[$cRecords] = XmlRpcUtils::getEntityWithNotNullFields($oInfoObject); $cRecords++; } $value = new XML_RPC_Value($xmlValue, $GLOBALS['XML_RPC_Array']); return new XML_RPC_Response($value); }