init
This commit is contained in:
153
service/core/NusoapSoap.php
Normal file
153
service/core/NusoapSoap.php
Normal file
@@ -0,0 +1,153 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry'))define('sugarEntry', true);
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
require('service/core/SugarSoapService.php');
|
||||
require('include/nusoap/nusoap.php');
|
||||
|
||||
/**
|
||||
* This is an abstract class for the soap implementation for using NUSOAP. This class is responsible for making
|
||||
* all NUSOAP call by passing the client's request to NUSOAP server and seding response back to client
|
||||
*
|
||||
*/
|
||||
abstract class NusoapSoap extends SugarSoapService{
|
||||
/**
|
||||
* This is the constructor. It creates an instance of NUSOAP server.
|
||||
*
|
||||
* @param String $url - This is the soap URL
|
||||
* @access public
|
||||
*/
|
||||
public function __construct($url){
|
||||
$GLOBALS['log']->info('Begin: NusoapSoap->__construct');
|
||||
$this->server = new soap_server();
|
||||
$this->soapURL = $url;
|
||||
$this->server->configureWSDL('sugarsoap', $this->getNameSpace(), $url);
|
||||
if(!isset($GLOBALS['HTTP_RAW_POST_DATA']))$GLOBALS['HTTP_RAW_POST_DATA'] = file_get_contents('php://input');
|
||||
parent::__construct();
|
||||
$GLOBALS['log']->info('End: NusoapSoap->__construct');
|
||||
} // ctor
|
||||
|
||||
/**
|
||||
* It passes request data to NUSOAP server and sends response back to client
|
||||
* @access public
|
||||
*/
|
||||
public function serve(){
|
||||
$GLOBALS['log']->info('Begin: NusoapSoap->serve');
|
||||
ob_clean();
|
||||
$this->server->service($GLOBALS['HTTP_RAW_POST_DATA']);
|
||||
ob_end_flush();
|
||||
flush();
|
||||
$GLOBALS['log']->info('End: NusoapSoap->serve');
|
||||
} // fn
|
||||
|
||||
/**
|
||||
* This method registers all the complex type with NUSOAP server so that proper WSDL can be generated
|
||||
*
|
||||
* @param String $name - name of complex type
|
||||
* @param String $typeClass - (complexType|simpleType|attribute)
|
||||
* @param String $phpType - array or struct
|
||||
* @param String $compositor - (all|sequence|choice)
|
||||
* @param String $restrictionBase - SOAP-ENC:Array or empty
|
||||
* @param Array $elements - array ( name => array(name=>'',type=>'') )
|
||||
* @param Array $attrs - array(array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'xsd:string[]'))
|
||||
* @param String $arrayType - arrayType: namespace:name (xsd:string)
|
||||
* @access public
|
||||
*/
|
||||
public function registerType($name, $typeClass, $phpType, $compositor, $restrictionBase, $elements, $attrs=array(), $arrayType=''){
|
||||
$this->server->wsdl->addComplexType($name, $typeClass, $phpType, $compositor, $restrictionBase, $elements, $attrs, $arrayType);
|
||||
} // fn
|
||||
|
||||
/**
|
||||
* This method registers all the functions you want to expose as services with NUSOAP
|
||||
*
|
||||
* @param String $function - name of the function
|
||||
* @param Array $input - assoc array of input values: key = param name, value = param type
|
||||
* @param Array $output - assoc array of output values: key = param name, value = param type
|
||||
* @access public
|
||||
*/
|
||||
function registerFunction($function, $input, $output){
|
||||
if(in_array($function, $this->excludeFunctions))return;
|
||||
$use = false;
|
||||
$style = false;
|
||||
if (isset($_REQUEST['use']) && ($_REQUEST['use'] == 'literal')) {
|
||||
$use = "literal";
|
||||
} // if
|
||||
if (isset($_REQUEST['style']) && ($_REQUEST['style'] == 'document')) {
|
||||
$style = "document";
|
||||
} // if
|
||||
$this->server->register($function, $input, $output, $this->getNameSpace(), '',$style, $use);
|
||||
} // fn
|
||||
|
||||
/**
|
||||
* This function registers implementation class name with NUSOAP so when NUSOAP makes a call to a funciton,
|
||||
* it will be made on this class object
|
||||
*
|
||||
* @param String $implementationClass
|
||||
* @access public
|
||||
*/
|
||||
function registerImplClass($implementationClass){
|
||||
$GLOBALS['log']->info('Begin: NusoapSoap->registerImplClass');
|
||||
if (empty($implementationClass)) {
|
||||
$implementationClass = $this->implementationClass;
|
||||
} // if
|
||||
$this->server->register_class($implementationClass);
|
||||
$GLOBALS['log']->info('End: NusoapSoap->registerImplClass');
|
||||
} // fn
|
||||
|
||||
/**
|
||||
* Sets the name of the registry class
|
||||
*
|
||||
* @param String $registryClass
|
||||
* @access public
|
||||
*/
|
||||
function registerClass($registryClass){
|
||||
$GLOBALS['log']->info('Begin: NusoapSoap->registerClass');
|
||||
$this->registryClass = $registryClass;
|
||||
$GLOBALS['log']->info('End: NusoapSoap->registerClass');
|
||||
} // fn
|
||||
|
||||
/**
|
||||
* This function sets the fault object on the NUSOAP
|
||||
*
|
||||
* @param SoapError $errorObject - This is an object of type SoapError
|
||||
* @access public
|
||||
*/
|
||||
public function error($errorObject){
|
||||
$GLOBALS['log']->info('Begin: NusoapSoap->error');
|
||||
$this->server->fault($errorObject->getFaultCode(), $errorObject->getName(), '', $errorObject->getDescription());
|
||||
$GLOBALS['log']->info('Begin: NusoapSoap->error');
|
||||
} // fn
|
||||
|
||||
} // clazz
|
||||
173
service/core/PHP5Soap.php
Normal file
173
service/core/PHP5Soap.php
Normal file
@@ -0,0 +1,173 @@
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
<?php
|
||||
require('service/core/SugarSoapService.php');
|
||||
require('include/nusoap/nusoap.php');
|
||||
|
||||
abstract class PHP5Soap extends SugarSoapService{
|
||||
private $nusoap_server = null;
|
||||
public function __construct($url){
|
||||
$this->soapURL = $url;
|
||||
ini_set("soap.wsdl_cache_enabled", "0"); // disabling WSDL cache
|
||||
global $HTTP_RAW_POST_DATA;
|
||||
if(!isset($HTTP_RAW_POST_DATA)) {
|
||||
$HTTP_RAW_POST_DATA = file_get_contents('php://input');
|
||||
}
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function setObservers() {
|
||||
|
||||
} // fn
|
||||
|
||||
/**
|
||||
* Serves the Soap Request
|
||||
* @return
|
||||
*/
|
||||
public function serve(){
|
||||
ob_clean();
|
||||
global $HTTP_RAW_POST_DATA;
|
||||
$GLOBALS['log']->debug("I am here1 ". $HTTP_RAW_POST_DATA);
|
||||
$qs = '';
|
||||
if (isset($_SERVER['QUERY_STRING'])) {
|
||||
$qs = $_SERVER['QUERY_STRING'];
|
||||
} elseif (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
|
||||
$qs = $HTTP_SERVER_VARS['QUERY_STRING'];
|
||||
} else {
|
||||
$qs = '';
|
||||
}
|
||||
|
||||
if (stristr($qs, 'wsdl') || $HTTP_RAW_POST_DATA == ''){
|
||||
$wsdlCacheFile = $this->getWSDLPath(false);
|
||||
if (stristr($qs, 'wsdl')) {
|
||||
if($fh = @sugar_fopen($wsdlCacheFile, "r")) {
|
||||
$contents = fread($fh, filesize($wsdlCacheFile));
|
||||
fclose($fh);
|
||||
header("Content-Type: text/xml; charset=ISO-8859-1\r\n");
|
||||
print $contents;
|
||||
} // if
|
||||
} else {
|
||||
$this->nusoap_server->service($HTTP_RAW_POST_DATA);
|
||||
} // else
|
||||
} else {
|
||||
$this->server->handle();
|
||||
}
|
||||
ob_end_flush();
|
||||
flush();
|
||||
}
|
||||
|
||||
private function generateSoapServer() {
|
||||
if ($this->server == null) {
|
||||
$soap_url = $this->getSoapURL() . "?wsdl";
|
||||
$this->server = new SoapServer($this->getWSDLPath(true), array('soap_version'=>SOAP_1_2, 'encoding'=>'ISO-8859-1'));
|
||||
}
|
||||
} // fn
|
||||
|
||||
private function generateNuSoap() {
|
||||
if ($this->nusoap_server == null) {
|
||||
$this->nusoap_server = new soap_server();
|
||||
$this->nusoap_server->configureWSDL('sugarsoap', $this->getNameSpace(), "");
|
||||
$this->nusoap_server->register_class('SugarWebServiceImpl');
|
||||
} // if
|
||||
} // fn
|
||||
|
||||
public function getWSDLPath($generateWSDL) {
|
||||
global $sugar_config;
|
||||
$uploadDir = $sugar_config['upload_dir'];
|
||||
$wsdlURL = $this->getSoapURL().'?wsdl';
|
||||
$wsdlCacheFile = $uploadDir.'/wsdlcache-' . md5($wsdlURL);
|
||||
|
||||
if ($generateWSDL) {
|
||||
$oldqs = $_SERVER['QUERY_STRING'];
|
||||
$_SERVER['QUERY_STRING'] = "wsdl";
|
||||
$this->nusoap_server->service($wsdlURL);
|
||||
$_SERVER['QUERY_STRING'] = $oldqs;
|
||||
if($fh = @sugar_fopen($wsdlCacheFile, "w")) {
|
||||
fputs($fh, ob_get_contents());
|
||||
fclose($fh);
|
||||
} // if
|
||||
return $wsdlCacheFile;
|
||||
//ob_clean();
|
||||
} else {
|
||||
return $wsdlCacheFile;
|
||||
}
|
||||
|
||||
} // fn
|
||||
|
||||
public function getNameSpace() {
|
||||
return $this->soapURL;
|
||||
} // fn
|
||||
|
||||
/**
|
||||
* This function allows specifying what version of PHP soap to use
|
||||
* PHP soap supports version 1.1 and 1.2.
|
||||
* @return
|
||||
* @param $version String[optional]
|
||||
*/
|
||||
public function setSoapVersion($version='1.1'){
|
||||
//PHP SOAP supports 1.1 and 1.2 only currently
|
||||
$this->soap_version = ($version == '1.2')?'1.2':'1.1';
|
||||
}
|
||||
|
||||
public function error($errorObject){
|
||||
$this->server->fault($errorObject->getFaultCode(), $errorObject->getName(), '', $errorObject->getDescription()); }
|
||||
|
||||
public function registerImplClass($implementationClass){
|
||||
if (empty($implementationClass)) {
|
||||
$implementationClass = $this->implementationClass;
|
||||
} // if
|
||||
$this->generateSoapServer();
|
||||
$this->server->setClass($implementationClass);
|
||||
parent::setObservers();
|
||||
}
|
||||
|
||||
function registerClass($registryClass){
|
||||
$this->registryClass = $registryClass;
|
||||
}
|
||||
|
||||
public function registerType($name, $typeClass, $phpType, $compositor, $restrictionBase, $elements, $attrs=array(), $arrayType=''){
|
||||
$this->nusoap_server->wsdl->addComplexType($name, $typeClass, $phpType, $compositor, $restrictionBase, $elements, $attrs, $arrayType);
|
||||
}
|
||||
|
||||
function registerFunction($function, $input, $output){
|
||||
if(in_array($function, $this->excludeFunctions))return;
|
||||
if ($this->nusoap_server == null) {
|
||||
$this->generateNuSoap();
|
||||
} // if
|
||||
$this->nusoap_server->register($function, $input, $output, $this->getNameSpace());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
113
service/core/REST/SugarRest.php
Normal file
113
service/core/REST/SugarRest.php
Normal file
@@ -0,0 +1,113 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry'))define('sugarEntry', true);
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
/**
|
||||
* This class is a base class implementation of REST protocol
|
||||
*
|
||||
*/
|
||||
class SugarRest{
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param String $implementation - name of the implementation class
|
||||
*/
|
||||
function __construct($implementation){
|
||||
$this->implementation = $implementation;
|
||||
} // fn
|
||||
|
||||
/**
|
||||
* It will json encode version of the input object
|
||||
*
|
||||
* @param array $input - assoc array of input values: key = param name, value = param type
|
||||
* @return String - print's $input object
|
||||
*/
|
||||
function generateResponse($input){
|
||||
print_r($input);
|
||||
} // fn
|
||||
|
||||
/**
|
||||
* This method calls functions on the implementation class and returns the output or Fault object in case of error to client
|
||||
*
|
||||
* @return unknown
|
||||
*/
|
||||
function serve(){
|
||||
if(empty($_REQUEST['method']) || !method_exists($this->implementation, $_REQUEST['method'])){
|
||||
if (empty($_REQUEST['method'])) {
|
||||
echo '<pre>';
|
||||
$reflect = new ReflectionClass(get_class($this->implementation));
|
||||
$restWSDL = $reflect->__toString();
|
||||
$restWSDL = preg_replace('/@@.*/', "", $restWSDL);
|
||||
echo $restWSDL;
|
||||
}else{
|
||||
$er = new SoapError();
|
||||
$er->set_error('invalid_call');
|
||||
$this->fault($er);
|
||||
}
|
||||
}else{
|
||||
$method = $_REQUEST['method'];
|
||||
return $this->implementation->$method();
|
||||
} // else
|
||||
} // fn
|
||||
|
||||
/**
|
||||
* This function sends response to client containing error object
|
||||
*
|
||||
* @param SoapError $errorObject - This is an object of type SoapError
|
||||
* @access public
|
||||
*/
|
||||
function fault($errorObject){
|
||||
$this->faultServer->generateFaultResponse($errorObject);
|
||||
|
||||
} // fn
|
||||
|
||||
function generateFaultResponse($errorObject){
|
||||
//ob_clean();
|
||||
$GLOBALS['log']->info('In SugarRest->fault. Setting fault object on response');
|
||||
header('HTTP/1.1 500 Internal Server Error');
|
||||
header('Content-Type: text/html; charset="ISO-8859-1"');
|
||||
echo '<br>500 Internal Server Error <br>';
|
||||
if(is_object($errorObject)){
|
||||
$error = $errorObject->number . ': ' . $errorObject->name . '<br>' . $errorObject->description;
|
||||
$GLOBALS['log']->error($error);
|
||||
echo $error;
|
||||
}else{
|
||||
$GLOBALS['log']->error(var_export($errorObject, true));
|
||||
print_r($errorObject);
|
||||
} // else
|
||||
}
|
||||
|
||||
} // clazz
|
||||
103
service/core/REST/SugarRestJSON.php
Normal file
103
service/core/REST/SugarRestJSON.php
Normal file
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry'))define('sugarEntry', true);
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
require_once('service/core/REST/SugarRestSerialize.php');
|
||||
|
||||
/**
|
||||
* This class is a JSON implementation of REST protocol
|
||||
*
|
||||
*/
|
||||
class SugarRestJSON extends SugarRestSerialize{
|
||||
|
||||
/**
|
||||
* It will json encode the input object and echo's it
|
||||
*
|
||||
* @param array $input - assoc array of input values: key = param name, value = param type
|
||||
* @return String - echos json encoded string of $input
|
||||
*/
|
||||
function generateResponse($input){
|
||||
$json = getJSONObj();
|
||||
ob_clean();
|
||||
if (isset($this->faultObject)) {
|
||||
$this->generateFaultResponse($this->faultObject);
|
||||
} else {
|
||||
echo $json->encode($input);
|
||||
}
|
||||
} // fn
|
||||
|
||||
/**
|
||||
* This method calls functions on the implementation class and returns the output or Fault object in case of error to client
|
||||
*
|
||||
* @return unknown
|
||||
*/
|
||||
function serve(){
|
||||
$GLOBALS['log']->info('Begin: SugarRestJSON->serve');
|
||||
$json_data = !empty($_REQUEST['rest_data'])? $_REQUEST['rest_data']: '';
|
||||
if(empty($_REQUEST['method']) || !method_exists($this->implementation, $_REQUEST['method'])){
|
||||
$er = new SoapError();
|
||||
$er->set_error('invalid_call');
|
||||
$this->fault($er);
|
||||
}else{
|
||||
$method = $_REQUEST['method'];
|
||||
$json = getJSONObj();
|
||||
$data = $json->decode(from_html($json_data));
|
||||
if(!is_array($data))$data = array($data);
|
||||
$GLOBALS['log']->info('End: SugarRestJSON->serve');
|
||||
return call_user_func_array(array( $this->implementation, $method),$data);
|
||||
} // else
|
||||
} // fn
|
||||
|
||||
/**
|
||||
* This function sends response to client containing error object
|
||||
*
|
||||
* @param SoapError $errorObject - This is an object of type SoapError
|
||||
* @access public
|
||||
*/
|
||||
function fault($errorObject){
|
||||
$this->faultServer->faultObject = $errorObject;
|
||||
} // fn
|
||||
|
||||
function generateFaultResponse($errorObject){
|
||||
$error = $errorObject->number . ': ' . $errorObject->name . '<br>' . $errorObject->description;
|
||||
$GLOBALS['log']->error($error);
|
||||
$json = getJSONObj();
|
||||
ob_clean();
|
||||
echo $json->encode($errorObject);
|
||||
} // fn
|
||||
|
||||
|
||||
} // class
|
||||
138
service/core/REST/SugarRestRSS.php
Normal file
138
service/core/REST/SugarRestRSS.php
Normal file
@@ -0,0 +1,138 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry'))define('sugarEntry', true);
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
require_once('service/core/REST/SugarRest.php');
|
||||
|
||||
/**
|
||||
* This class is a serialize implementation of REST protocol
|
||||
*
|
||||
*/
|
||||
class SugarRestRSS extends SugarRest{
|
||||
|
||||
/**
|
||||
* It will serialize the input object and echo's it
|
||||
*
|
||||
* @param array $input - assoc array of input values: key = param name, value = param type
|
||||
* @return String - echos serialize string of $input
|
||||
*/
|
||||
function generateResponse($input){
|
||||
$method = !empty($_REQUEST['method'])? $_REQUEST['method']: '';
|
||||
if($method != 'get_entry_list')$this->fault('RSS currently only supports the get_entry_list method');
|
||||
ob_clean();
|
||||
$this->generateResponseHeader($input['result_count']);
|
||||
$this->generateItems($input);
|
||||
$this->generateResponseFooter();
|
||||
} // fn
|
||||
|
||||
function generateResponseHeader($count){
|
||||
$date = gmdate("D, d M Y H:i:s") . " GMT";
|
||||
echo'<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<rss version="2.0">
|
||||
<channel>
|
||||
<title>SugarCRM RSS Feed</title>
|
||||
<link>http://cnn.com</link>
|
||||
<description>' . $count. ' records found</description>
|
||||
<pubDate>' . $date . '</pubDate>
|
||||
<generator>SugarCRM</generator>
|
||||
<ttl>' . $count . '</ttl>
|
||||
';
|
||||
}
|
||||
|
||||
function generateItems($input){
|
||||
if(!empty($input['entry_list'])){
|
||||
foreach($input['entry_list'] as $item){
|
||||
$this->generateItem($item);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function generateItem($item){
|
||||
echo "<item>\n";
|
||||
$name = !empty($item['name_value_list']['name'])?htmlentities( $item['name_value_list']['name']): '';
|
||||
echo "<title>$name</title>\n";
|
||||
echo "<link>". $GLOBALS['sugar_config']['site_url'] . htmlentities('/index.php?module=' . $item['module_name']. '&record=' . $item['id']) . "</link>\n";
|
||||
echo "<description><![CDATA[";
|
||||
$displayFieldNames = true;
|
||||
if(count($item['name_value_list']) == 2 &&isset($item['name_value_list']['name']))$displayFieldNames = false;
|
||||
foreach($item['name_value_list'] as $k=>$v){
|
||||
if($k =='name')continue;
|
||||
if($k == 'date_modified')continue;
|
||||
if($displayFieldNames) echo '<b>' .htmlentities( $k) . ':<b> ';
|
||||
echo htmlentities( $v) . "\n<br>";
|
||||
}
|
||||
echo "]]></description>\n";
|
||||
if(!empty($item['name_value_list']['date_modified'])){
|
||||
$date = date("D, d M Y H:i:s", strtotime($item['name_value_list']['date_modified'])) . " GMT";
|
||||
echo "<pubDate>$date</pubDate>";
|
||||
}
|
||||
|
||||
echo "<guid>" . $item['id']. "</guid>\n";
|
||||
echo "</item>\n";
|
||||
}
|
||||
function generateResponseFooter(){
|
||||
echo'</channel></rss>';
|
||||
}
|
||||
|
||||
/**
|
||||
* This method calls functions on the implementation class and returns the output or Fault object in case of error to client
|
||||
*
|
||||
* @return unknown
|
||||
*/
|
||||
function serve(){
|
||||
$this->fault('RSS is not a valid input_type');
|
||||
} // fn
|
||||
|
||||
function fault($faultObject){
|
||||
ob_clean();
|
||||
$this->generateResponseHeader();
|
||||
echo '<item><name>';
|
||||
if(is_object($errorObject)){
|
||||
$error = $errorObject->number . ': ' . $errorObject->name . '<br>' . $errorObject->description;
|
||||
$GLOBALS['log']->error($error);
|
||||
}else{
|
||||
$GLOBALS['log']->error(var_export($errorObject, true));
|
||||
$error = var_export($errorObject, true);
|
||||
} // else
|
||||
echo $error;
|
||||
echo '</name></item>';
|
||||
$this->generateResponseFooter();
|
||||
|
||||
}
|
||||
|
||||
|
||||
} // clazz
|
||||
99
service/core/REST/SugarRestSerialize.php
Normal file
99
service/core/REST/SugarRestSerialize.php
Normal file
@@ -0,0 +1,99 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry'))define('sugarEntry', true);
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
require_once('service/core/REST/SugarRest.php');
|
||||
|
||||
/**
|
||||
* This class is a serialize implementation of REST protocol
|
||||
*
|
||||
*/
|
||||
class SugarRestSerialize extends SugarRest{
|
||||
|
||||
/**
|
||||
* It will serialize the input object and echo's it
|
||||
*
|
||||
* @param array $input - assoc array of input values: key = param name, value = param type
|
||||
* @return String - echos serialize string of $input
|
||||
*/
|
||||
function generateResponse($input){
|
||||
ob_clean();
|
||||
if (isset($this->faultObject)) {
|
||||
$this->generateFaultResponse($this->faultObject);
|
||||
} else {
|
||||
echo serialize($input);
|
||||
}
|
||||
} // fn
|
||||
|
||||
/**
|
||||
* This method calls functions on the implementation class and returns the output or Fault object in case of error to client
|
||||
*
|
||||
* @return unknown
|
||||
*/
|
||||
function serve(){
|
||||
$GLOBALS['log']->info('Begin: SugarRestSerialize->serve');
|
||||
$data = !empty($_REQUEST['rest_data'])? $_REQUEST['rest_data']: '';
|
||||
if(empty($_REQUEST['method']) || !method_exists($this->implementation, $_REQUEST['method'])){
|
||||
$er = new SoapError();
|
||||
$er->set_error('invalid_call');
|
||||
$this->fault($er);
|
||||
}else{
|
||||
$method = $_REQUEST['method'];
|
||||
$data = unserialize(from_html($data));
|
||||
if(!is_array($data))$data = array($data);
|
||||
$GLOBALS['log']->info('End: SugarRestSerialize->serve');
|
||||
return call_user_func_array(array( $this->implementation, $method),$data);
|
||||
} // else
|
||||
} // fn
|
||||
|
||||
/**
|
||||
* This function sends response to client containing error object
|
||||
*
|
||||
* @param SoapError $errorObject - This is an object of type SoapError
|
||||
* @access public
|
||||
*/
|
||||
function fault($errorObject){
|
||||
$this->faultServer->faultObject = $errorObject;
|
||||
} // fn
|
||||
|
||||
function generateFaultResponse($errorObject){
|
||||
$error = $errorObject->number . ': ' . $errorObject->name . '<br>' . $errorObject->description;
|
||||
$GLOBALS['log']->error($error);
|
||||
ob_clean();
|
||||
echo serialize($errorObject);
|
||||
} // fn
|
||||
|
||||
} // clazz
|
||||
1123
service/core/SoapHelperWebService.php
Normal file
1123
service/core/SoapHelperWebService.php
Normal file
File diff suppressed because it is too large
Load Diff
195
service/core/SugarRestService.php
Normal file
195
service/core/SugarRestService.php
Normal file
@@ -0,0 +1,195 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry'))define('sugarEntry', true);
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
require_once('service/core/SugarWebService.php');
|
||||
require_once('service/core/SugarRestServiceImpl.php');
|
||||
|
||||
/**
|
||||
* Base class for rest services
|
||||
*
|
||||
*/
|
||||
class SugarRestService extends SugarWebService{
|
||||
protected $implementationClass = 'SugarRestServiceImpl';
|
||||
protected $restURL = "";
|
||||
protected $registeredFunc = array();
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param String $url - REST url
|
||||
*/
|
||||
function __construct($url){
|
||||
$GLOBALS['log']->info('Begin: SugarRestService->__construct');
|
||||
$this->restURL = $url;
|
||||
$responseTypeString = 'SugarRest';
|
||||
if(!empty($_REQUEST['response_type'])) {
|
||||
$responseTypeString = clean_string($_REQUEST['response_type'], 'ALPHANUM');
|
||||
if (strcasecmp($responseTypeString, 'JSON') === 0) {
|
||||
$responseTypeString = 'SugarRest'. 'JSON';
|
||||
} elseif (strcasecmp($responseTypeString, 'RSS') === 0) {
|
||||
$responseTypeString = 'SugarRest'. 'RSS';
|
||||
} elseif(strcasecmp($responseTypeString, 'Serialize') === 0) {
|
||||
$responseTypeString = 'SugarRest'. 'Serialize';
|
||||
}
|
||||
} // if
|
||||
$this->responseClass = $responseTypeString;
|
||||
//$this->responseClass = (!empty($_REQUEST['response_type']))?'SugarRest'.clean_string($_REQUEST['response_type'], 'ALPHANUM'): 'SugarRest';
|
||||
|
||||
if(!file_exists('service/core/REST/' . $this->responseClass. '.php'))$this->responseClass = 'SugarRest';
|
||||
$this->serverClass = (!empty($_REQUEST['input_type']))?'SugarRest'.clean_string($_REQUEST['input_type'], 'ALPHANUM'): 'SugarRest';
|
||||
$GLOBALS['log']->info('SugarRestService->__construct serverclass = ' . $this->serverClass);
|
||||
if(!file_exists('service/core/REST/' . $this->serverClass . '.php'))$this->serverClass = 'SugarRest';
|
||||
require_once('service/core/REST/'. $this->serverClass . '.php');
|
||||
$GLOBALS['log']->info('End: SugarRestService->__construct');
|
||||
} // ctor
|
||||
|
||||
/**
|
||||
* Its a no op method
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public function registerType($name, $typeClass, $phpType, $compositor, $restrictionBase, $elements, $attrs, $arrayType){
|
||||
} // fn
|
||||
|
||||
/**
|
||||
* This method registers all the functions you want to expose as services with REST
|
||||
*
|
||||
* @param String $function - name of the function
|
||||
* @param Array $input - assoc array of input values: key = param name, value = param type
|
||||
* @param Array $output - assoc array of output values: key = param name, value = param type
|
||||
* @access public
|
||||
*/
|
||||
function registerFunction($function, $input, $output){
|
||||
if(in_array($function, $this->excludeFunctions))return;
|
||||
$this->registeredFunc[$function] = array('input'=> $input, 'output'=>$output);
|
||||
} // fn
|
||||
|
||||
/**
|
||||
* It passes request data to REST server and sends response back to client
|
||||
* @access public
|
||||
*/
|
||||
function serve(){
|
||||
$GLOBALS['log']->info('Begin: SugarRestService->serve');
|
||||
require_once('service/core/REST/'. $this->responseClass . '.php');
|
||||
$response = $this->responseClass;
|
||||
|
||||
$responseServer = new $response($this->implementation);
|
||||
$this->server->faultServer = $responseServer;
|
||||
$this->responseServer->faultServer = $responseServer;
|
||||
$responseServer->generateResponse($this->server->serve());
|
||||
$GLOBALS['log']->info('End: SugarRestService->serve');
|
||||
} // fn
|
||||
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
* @param Array $excludeFunctions - All the functions you don't want to register
|
||||
*/
|
||||
function register($excludeFunctions = array()){
|
||||
|
||||
} // fn
|
||||
|
||||
/**
|
||||
* This mehtod returns registered implementation class
|
||||
*
|
||||
* @return String - implementationClass
|
||||
* @access public
|
||||
*/
|
||||
public function getRegisteredImplClass() {
|
||||
return $this->implementationClass;
|
||||
} // fn
|
||||
|
||||
/**
|
||||
* This mehtod returns registry class
|
||||
*
|
||||
* @return String - registryClass
|
||||
* @access public
|
||||
*/
|
||||
public function getRegisteredClass() {
|
||||
return $this->registryClass;
|
||||
} // fn
|
||||
|
||||
/**
|
||||
* Sets the name of the registry class
|
||||
*
|
||||
* @param String $registryClass
|
||||
* @access public
|
||||
*/
|
||||
function registerClass($registryClass){
|
||||
$this->registryClass = $registryClass;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function registers implementation class name and creates an instance of rest implementation class
|
||||
* it will be made on this class object
|
||||
*
|
||||
* @param String $implementationClass
|
||||
* @access public
|
||||
*/
|
||||
function registerImplClass($className){
|
||||
$GLOBALS['log']->info('Begin: SugarRestService->registerImplClass');
|
||||
$this->implementationClass = $className;
|
||||
$this->implementation = new $this->implementationClass();
|
||||
$this->server = new $this->serverClass($this->implementation);
|
||||
$this->server->registerd = $this->registeredFunc;
|
||||
$GLOBALS['log']->info('End: SugarRestService->registerImplClass');
|
||||
} // fn
|
||||
|
||||
/**
|
||||
* This function sets the fault object on the REST
|
||||
*
|
||||
* @param SoapError $errorObject - This is an object of type SoapError
|
||||
* @access public
|
||||
*/
|
||||
function error($errorObject){
|
||||
$GLOBALS['log']->info('Begin: SugarRestService->error');
|
||||
$this->server->fault($errorObject);
|
||||
$GLOBALS['log']->info('Begin: SugarRestService->error');
|
||||
} // fn
|
||||
|
||||
/**
|
||||
* This mehtod returns server
|
||||
*
|
||||
* @return String - server
|
||||
* @access public
|
||||
*/
|
||||
function getServer(){
|
||||
return $this->server;
|
||||
} // fn
|
||||
|
||||
|
||||
}
|
||||
49
service/core/SugarRestServiceImpl.php
Normal file
49
service/core/SugarRestServiceImpl.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry'))define('sugarEntry', true);
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
/**
|
||||
* This class is an implemenatation class for all the rest services
|
||||
*/
|
||||
require_once('service/core/SugarWebServiceImpl.php');
|
||||
class SugarRestServiceImpl extends SugarWebServiceImpl {
|
||||
|
||||
function md5($string){
|
||||
return md5($string);
|
||||
}
|
||||
}
|
||||
require_once('service/core/SugarRestUtils.php');
|
||||
SugarRestServiceImpl::$helperObject = new SugarRestUtils();
|
||||
39
service/core/SugarRestUtils.php
Normal file
39
service/core/SugarRestUtils.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
require_once('service/core/SoapHelperWebService.php');
|
||||
class SugarRestUtils extends SoapHelperWebServices {
|
||||
|
||||
}
|
||||
155
service/core/SugarSoapService.php
Normal file
155
service/core/SugarSoapService.php
Normal file
@@ -0,0 +1,155 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry'))define('sugarEntry', true);
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
require_once('service/core/SugarWebService.php');
|
||||
require_once('service/core/SugarWebServiceImpl.php');
|
||||
|
||||
/**
|
||||
* This ia an abstract class for the soapservice. All the global fun
|
||||
*
|
||||
*/
|
||||
abstract class SugarSoapService extends SugarWebService{
|
||||
protected $soap_version = '1.1';
|
||||
protected $namespace = 'http://www.sugarcrm.com/sugarcrm';
|
||||
protected $implementationClass = 'SugarWebServiceImpl';
|
||||
protected $registryClass = "";
|
||||
protected $soapURL = "";
|
||||
|
||||
/**
|
||||
* This is an abstract method. The implementation method should registers all the functions you want to expose as services.
|
||||
*
|
||||
* @param String $function - name of the function
|
||||
* @param Array $input - assoc array of input values: key = param name, value = param type
|
||||
* @param Array $output - assoc array of output values: key = param name, value = param type
|
||||
* @access public
|
||||
*/
|
||||
abstract function registerFunction($function, $input, $output);
|
||||
|
||||
/**
|
||||
* This is an abstract method. This implementation method should register all the complex type
|
||||
*
|
||||
* @param String $name - name of complex type
|
||||
* @param String $typeClass - (complexType|simpleType|attribute)
|
||||
* @param String $phpType - array or struct
|
||||
* @param String $compositor - (all|sequence|choice)
|
||||
* @param String $restrictionBase - SOAP-ENC:Array or empty
|
||||
* @param Array $elements - array ( name => array(name=>'',type=>'') )
|
||||
* @param Array $attrs - array(array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'xsd:string[]'))
|
||||
* @param String $arrayType - arrayType: namespace:name (xsd:string)
|
||||
* @access public
|
||||
*/
|
||||
abstract function registerType($name, $typeClass, $phpType, $compositor, $restrictionBase, $elements, $attrs=array(), $arrayType='');
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
*/
|
||||
protected function __construct(){
|
||||
$this->setObservers();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method sets the soap server object on all the observers
|
||||
* @access public
|
||||
*/
|
||||
public function setObservers() {
|
||||
global $observers;
|
||||
if(!empty($observers)){
|
||||
foreach($observers as $observer) {
|
||||
if(method_exists($observer, 'set_soap_server')) {
|
||||
$observer->set_soap_server($this->server);
|
||||
}
|
||||
}
|
||||
}
|
||||
} // fn
|
||||
|
||||
/**
|
||||
* This method returns the soapURL
|
||||
*
|
||||
* @return String - soapURL
|
||||
* @access public
|
||||
*/
|
||||
public function getSoapURL(){
|
||||
return $this->soapURL;
|
||||
}
|
||||
|
||||
public function getSoapVersion(){
|
||||
return $this->soap_version;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns the namespace
|
||||
*
|
||||
* @return String - namespace
|
||||
* @access public
|
||||
*/
|
||||
public function getNameSpace(){
|
||||
return $this->namespace;
|
||||
}
|
||||
|
||||
/**
|
||||
* This mehtod returns registered implementation class
|
||||
*
|
||||
* @return String - implementationClass
|
||||
* @access public
|
||||
*/
|
||||
public function getRegisteredImplClass() {
|
||||
return $this->implementationClass;
|
||||
}
|
||||
|
||||
/**
|
||||
* This mehtod returns registry class
|
||||
*
|
||||
* @return String - registryClass
|
||||
* @access public
|
||||
*/
|
||||
public function getRegisteredClass() {
|
||||
return $this->registryClass;
|
||||
}
|
||||
|
||||
/**
|
||||
* This mehtod returns server
|
||||
*
|
||||
* @return String -server
|
||||
* @access public
|
||||
*/
|
||||
public function getServer() {
|
||||
return $this->server;
|
||||
} // fn
|
||||
|
||||
|
||||
} // class
|
||||
52
service/core/SugarWebService.php
Normal file
52
service/core/SugarWebService.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry'))define('sugarEntry', true);
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
/**
|
||||
* This is an abstract class for all the web services.
|
||||
* All type of web services should provide proper implementation of all the abstract methods
|
||||
*/
|
||||
abstract class SugarWebService{
|
||||
protected $server = null;
|
||||
protected $excludeFunctions = array();
|
||||
abstract function register($excludeFunctions = array());
|
||||
abstract function registerImplClass($class);
|
||||
abstract function getRegisteredImplClass();
|
||||
abstract function registerClass($class);
|
||||
abstract function getRegisteredClass();
|
||||
abstract function serve();
|
||||
abstract function error($errorObject);
|
||||
}
|
||||
1142
service/core/SugarWebServiceImpl.php
Normal file
1142
service/core/SugarWebServiceImpl.php
Normal file
File diff suppressed because it is too large
Load Diff
0
service/core/WSDL.tpl
Normal file
0
service/core/WSDL.tpl
Normal file
62
service/core/webservice.php
Normal file
62
service/core/webservice.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry'))define('sugarEntry', true);
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
/**
|
||||
* This file intialize the service class and does all the setters based on the values provided in soap/rest entry point
|
||||
* and calls serve method which takes the request and send response back to the client
|
||||
*/
|
||||
ob_start();
|
||||
require('include/entryPoint.php');
|
||||
require_once('soap/SoapError.php');
|
||||
require_once('SoapHelperWebService.php');
|
||||
require_once('SugarRestUtils.php');
|
||||
require_once($webservice_path);
|
||||
require_once($registry_path);
|
||||
$url = $GLOBALS['sugar_config']['site_url'].$location;
|
||||
$service = new $webservice_class($url);
|
||||
$service->registerClass($registry_class);
|
||||
$service->register();
|
||||
$service->registerImplClass($webservice_impl_class);
|
||||
|
||||
// set the service object in the global scope so that any error, if happens, can be set on this object
|
||||
global $service_object;
|
||||
$service_object = $service;
|
||||
|
||||
$service->serve();
|
||||
|
||||
|
||||
|
||||
101
service/example/Rest_Proxy.php
Normal file
101
service/example/Rest_Proxy.php
Normal file
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
ob_start();
|
||||
$fp = fopen('proxy.log', 'a');
|
||||
define('PROXY_SERVER', 'http://localhost/service/v2/rest.php');
|
||||
$headers = (function_exists('getallheaders'))?getallheaders(): array();
|
||||
$_headers = array();
|
||||
foreach($headers as $k=>$v){
|
||||
$_headers[strtolower($k)] = $v;
|
||||
}
|
||||
$url = parse_url(PROXY_SERVER);
|
||||
if(!empty($_headers['referer']))$curl_headers['referer'] = 'Referer: ' . $_headers['referer'];
|
||||
if(!empty($_headers['user-agent']))$curl_headers['user-agent'] = 'User-Agent: ' . $_headers['user-agent'];
|
||||
if(!empty($_headers['accept']))$curl_headers['accept'] = 'Accept: ' . $_headers['accept'];
|
||||
if(!empty($_headers['accept-language']))$curl_headers['accept-Language'] = 'Accept-Language: ' . $_headers['accept-language'];
|
||||
if(!empty($_headers['accept-encoding']))$curl_headers['accept-encoding:'] = 'Accept-Encoding: ' .$_headers['accept-encoding'];
|
||||
if(!empty($_headers['accept-charset']))$curl_headers['accept-charset:'] = 'Accept-Charset: ' .$_headers['accept-charset'];
|
||||
|
||||
// create a new cURL resource
|
||||
$ch = curl_init();
|
||||
// set URL and other appropriate options
|
||||
curl_setopt($ch, CURLOPT_URL, PROXY_SERVER);
|
||||
curl_setopt ($ch, CURLOPT_POST, 1);
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, $curl_headers);
|
||||
curl_setopt($ch, CURLOPT_HEADER, 1);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
|
||||
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0 );
|
||||
$post_data = '';
|
||||
if(!empty($_POST)){
|
||||
foreach($_POST as $k=>$v){
|
||||
if(get_magic_quotes_gpc())$v = stripslashes($v);
|
||||
if(!empty($post_data))$post_data .= '&';
|
||||
$post_data .= "$k=" . $v;
|
||||
}
|
||||
}
|
||||
curl_setopt ($ch, CURLOPT_POSTFIELDS, $post_data);
|
||||
// grab URL and pass it to the browser
|
||||
fwrite($fp, 'client headers:' . var_export($headers, true) . "\n");
|
||||
fwrite($fp, 'starting curl request' . "\n");
|
||||
fwrite($fp, $post_data . "\n");
|
||||
$result = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
fwrite($fp, 'finished curl request' . "\n");
|
||||
fwrite($fp, 'response:' . var_export($result, true) . "\n");
|
||||
//we only handle 1 response no redirects
|
||||
$result = explode("\r\n\r\n", $result, 2);
|
||||
//we neeed to split up the ehaders
|
||||
$result_headers = explode("\r\n", $result[0]);
|
||||
//now echo out the same headers the server passed to us
|
||||
fwrite($fp, "setting headers\n");
|
||||
foreach($result_headers as &$header){
|
||||
if(substr_count($header, 'Set-Cookie:') ==0)
|
||||
header($header);
|
||||
}
|
||||
header('Content-Length: ' . strlen($result[1]));
|
||||
header('Connection: close');
|
||||
// now echo out the body
|
||||
fwrite($fp, "sending body\n");
|
||||
echo $result[1];
|
||||
ob_end_flush();
|
||||
fwrite($fp, "done\n");
|
||||
die();
|
||||
// close cURL resource, and free up system resources
|
||||
|
||||
?>
|
||||
337
service/example/example.html
Normal file
337
service/example/example.html
Normal file
@@ -0,0 +1,337 @@
|
||||
<!--
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
-->
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<title>Sugar Rest Example</title>
|
||||
<!-- Dependency -->
|
||||
|
||||
<!--CSS file (default YUI Sam Skin) -->
|
||||
<link type="text/css" rel="stylesheet" href="http://yui.yahooapis.com/2.6.0/build/datatable/assets/skins/sam/datatable.css">
|
||||
|
||||
<!-- Dependencies -->
|
||||
|
||||
<script src="http://yui.yahooapis.com/2.6.0/build/yahoo/yahoo-min.js"></script>
|
||||
|
||||
<!-- Used for Custom Events and event listener bindings -->
|
||||
<script src="http://yui.yahooapis.com/2.6.0/build/event/event-min.js"></script>
|
||||
|
||||
<script type="text/javascript" src="http://yui.yahooapis.com/2.6.0/build/yahoo-dom-event/yahoo-dom-event.js"></script>
|
||||
<script type="text/javascript" src="http://yui.yahooapis.com/2.6.0/build/element/element-beta-min.js"></script>
|
||||
<script type="text/javascript" src="http://yui.yahooapis.com/2.6.0/build/datasource/datasource-min.js"></script>
|
||||
|
||||
<!-- OPTIONAL: JSON Utility (for DataSource) -->
|
||||
<script type="text/javascript" src="http://yui.yahooapis.com/2.6.0/build/json/json-min.js"></script>
|
||||
|
||||
<!-- OPTIONAL: Connection Manager (enables XHR for DataSource) -->
|
||||
<script type="text/javascript" src="http://yui.yahooapis.com/2.6.0/build/connection/connection-min.js"></script>
|
||||
|
||||
<!-- OPTIONAL: Get Utility (enables dynamic script nodes for DataSource) -->
|
||||
<script type="text/javascript" src="http://yui.yahooapis.com/2.6.0/build/get/get-min.js"></script>
|
||||
|
||||
<!-- OPTIONAL: Drag Drop (enables resizeable or reorderable columns) -->
|
||||
<script type="text/javascript" src="http://yui.yahooapis.com/2.6.0/build/dragdrop/dragdrop-min.js"></script>
|
||||
|
||||
<!-- OPTIONAL: Calendar (enables calendar editors) -->
|
||||
<script type="text/javascript" src="http://yui.yahooapis.com/2.6.0/build/calendar/calendar-min.js"></script>
|
||||
|
||||
<!-- Source files -->
|
||||
<script type="text/javascript" src="http://yui.yahooapis.com/2.6.0/build/datatable/datatable-min.js"></script>
|
||||
|
||||
<script>
|
||||
|
||||
var SugarRest = function(){}
|
||||
SugarRest.proxy_url = 'Rest_Proxy.php';
|
||||
SugarRest.server_url = 'http://localhost/[Sugar Path]/service/v2/rest.php'
|
||||
SugarRest.leadFields = [ 'id','do_not_call', 'first_name', 'last_name', 'status', 'phone_work', 'lead_source', 'salutation', 'primary_address_country', 'primary_address_city','primary_address_state', 'primary_address_postalcode', 'department', 'title', 'account_name'];
|
||||
SugarRest.moduleFields = {};
|
||||
SugarRest.logResponse = function(o){
|
||||
data = YAHOO.lang.JSON.parse(o.responseText);
|
||||
//console.log(data);
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
SugarRest.call = function(fun, args, callback, params){
|
||||
//console.log(args);
|
||||
query = SugarRest.getQuery(fun, args);
|
||||
YAHOO.util.Connect.asyncRequest('POST', SugarRest.proxy_url , {success:callback, failure:callback, argument:params}, query);
|
||||
}
|
||||
|
||||
SugarRest.getQuery = function(fun, args){
|
||||
query = 'method=' + fun + '&input_type=json&response_type=json';
|
||||
if(args != null){
|
||||
m = YAHOO.lang.JSON.stringify(args);
|
||||
query += '&rest_data=' + m;
|
||||
}
|
||||
return query;
|
||||
}
|
||||
|
||||
SugarRest.getServerInfo = function(){
|
||||
//console.log('Getting Server Info');
|
||||
SugarRest.call('get_server_info', '', SugarRest.test);
|
||||
}
|
||||
|
||||
SugarRest.login = function(name, password, application){
|
||||
//console.log(name);
|
||||
SugarRest.call('md5', password, SugarRest.performLogin, {name:name ,application:application});
|
||||
|
||||
}
|
||||
|
||||
SugarRest.performLogin = function(o){
|
||||
|
||||
//console.log('Logging In');
|
||||
var loginData = [{
|
||||
user_name: o.argument.name,
|
||||
password:YAHOO.lang.JSON.parse(o.responseText)
|
||||
},o.argument.application];
|
||||
SugarRest.call('login', loginData, SugarRest.getUserId);
|
||||
}
|
||||
|
||||
SugarRest.getUserId = function(o){
|
||||
data = YAHOO.lang.JSON.parse(o.responseText);
|
||||
SugarRest.session = data.id;
|
||||
SugarRest.call('get_user_id', SugarRest.session, SugarRest.setUserId);
|
||||
}
|
||||
|
||||
SugarRest.setUserId = function(o){
|
||||
SugarRest.user_id =YAHOO.lang.JSON.parse(o.responseText);
|
||||
SugarRest.getModuleFields('Leads', SugarRest.leadFields);
|
||||
}
|
||||
SugarRest.getModuleFields = function(module, fields){
|
||||
SugarRest.call('get_module_fields', [SugarRest.session, module, fields], SugarRest.setModuleFields);
|
||||
}
|
||||
|
||||
SugarRest.setModuleFields = function(o){
|
||||
data = SugarRest.logResponse(o);
|
||||
console.log(data.module_fields);
|
||||
SugarRest.moduleFields[data.module_name] = data.module_fields;
|
||||
SugarRest.InlineCellEditing();
|
||||
}
|
||||
SugarRest.getLeadsQuery = function(){
|
||||
var data = [SugarRest.session, 'Leads', " leads.do_not_call = 0 AND leads.status != 'Converted' AND leads.status != 'Dead' AND leads.assigned_user_id = '" + SugarRest.user_id + "' ", '', 0, SugarRest.leadFields, [{
|
||||
'name': 'email_addresses',
|
||||
'value': ['id', 'email_address', 'opt_out', 'primary_address',]
|
||||
}], 500, 0];
|
||||
q = SugarRest.getQuery('get_entry_list', data, SugarRest.test);
|
||||
console.log(q);
|
||||
return q;
|
||||
}
|
||||
|
||||
SugarRest.getFeeds = function(){
|
||||
var data = [SugarRest.session, 'SugarFeed', "", '', 0, ['id', 'name', 'description', 'link_url', 'link_type', 'created_by', 'date_entered', 'related_id', 'related_module'], [], 500, 0];
|
||||
SugarRest.call('get_entry_list', data, SugarRest.test);
|
||||
|
||||
}
|
||||
|
||||
|
||||
SugarRest.getLeads = function(){
|
||||
q = SugarRest.getLeadsQuery();
|
||||
var myCallback = function() {
|
||||
this.set("sortedBy", null);
|
||||
this.onDataReturnAppendRows.apply(this,arguments);
|
||||
};
|
||||
SugarRest.myDataSource.sendRequest(q,
|
||||
{
|
||||
success : myCallback,
|
||||
failure : myCallback,
|
||||
scope : SugarRest.myDataTable
|
||||
});
|
||||
}
|
||||
|
||||
SugarRest.saveChange = function(callback, newValue){
|
||||
var r = this.getRecord();
|
||||
var column = this.getColumn();
|
||||
var id = r._oData['name_value_list.id'];
|
||||
name = column.key.replace('name_value_list.', '');
|
||||
name = name.replace('.value','');
|
||||
|
||||
if(name == 'do_not_call'){
|
||||
newValue = (newValue == 'Do Not Call')? 1: 0;
|
||||
}
|
||||
//console.log("New Value:" + newValue);
|
||||
if(name == 'status' && newValue == 'Converted'){
|
||||
SugarRest.window = window.open('');
|
||||
callback();
|
||||
SugarRest.seamless_login_url = 'module=Leads&action=ConvertLead&record=' + id;
|
||||
SugarRest.call('seamless_login', SugarRest.session, SugarRest.seamless, 'module=Leads&action=ConvertLead&record=' + id );
|
||||
return;
|
||||
}
|
||||
fields = {};
|
||||
fields['id'] = id;
|
||||
fields[name] = newValue;
|
||||
|
||||
data = [SugarRest.session, 'Leads',fields ];
|
||||
SugarRest.call('set_entry', data, SugarRest.savedChanges, {
|
||||
callback: callback,
|
||||
newValue: newValue
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
SugarRest.savedChanges = function(o){
|
||||
//console.log(o);
|
||||
callback = o.argument.callback;
|
||||
var r = YAHOO.lang.JSON.parse(o.responseText);
|
||||
if (r.id) {
|
||||
callback(true, o.argument.newValue);
|
||||
} else {
|
||||
//console.log('save failed');
|
||||
callback();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
SugarRest.editRecord = function(module, id){
|
||||
query = 'module=' + module +'&record=' + id + '&action=EditView';
|
||||
SugarRest.seamless_login_url = query;
|
||||
SugarRest.call('seamless_login', SugarRest.session, SugarRest.seamless, query);
|
||||
|
||||
}
|
||||
|
||||
SugarRest.seamless = function(o){
|
||||
if (o.responseText == 1) {
|
||||
surl = SugarRest.server_url +'/index.php?' + SugarRest.seamless_login_url + '&MSID=' +SugarRest.session;
|
||||
//console.log('opening:' + surl);
|
||||
SugarRest.window.location.href = surl;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
SugarRest.buildColumnDefs = function(){
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
SugarRest.InlineCellEditing = function(){
|
||||
var statusOptions = [];
|
||||
for(i in SugarRest.moduleFields.Leads.status.options){
|
||||
statusOptions[statusOptions.length] = {'label': SugarRest.moduleFields.Leads.status.options[i].name, 'value':SugarRest.moduleFields.Leads.status.options[i].value};
|
||||
}
|
||||
var salutationOptions = [];
|
||||
for(i in SugarRest.moduleFields.Leads.salutation.options){
|
||||
salutationOptions[salutationOptions.length] = {'label': SugarRest.moduleFields.Leads.salutation.options[i].name, 'value':SugarRest.moduleFields.Leads.salutation.options[i].value};
|
||||
}
|
||||
SugarRest.myColumnDefs = [
|
||||
{key:"name_value_list.id",formatter:SugarRest.editLink, label:'Edit'},
|
||||
// {key:"name_value_list.salutation.value",sortable:true, label:SugarRest.moduleFields.Leads.salutation.label, editor: new YAHOO.widget.DropdownCellEditor({asyncSubmitter:SugarRest.saveChange, dropdownOptions:salutationOptions})},
|
||||
{key:"name_value_list.first_name.value",sortable:true, label:SugarRest.moduleFields.Leads.first_name.label, editor: new YAHOO.widget.TextboxCellEditor({asyncSubmitter:SugarRest.saveChange})},
|
||||
{key:"name_value_list.last_name.value",sortable:true, label:SugarRest.moduleFields.Leads.last_name.label ,editor: new YAHOO.widget.TextboxCellEditor({asyncSubmitter:SugarRest.saveChange})},
|
||||
{key:"name_value_list.phone_work.value", formatter:SugarRest.callLink, label:SugarRest.moduleFields.Leads.phone_work.label},
|
||||
{key:"name_value_list.status.value",sortable:true, label:SugarRest.moduleFields.Leads.status.label, editor: new YAHOO.widget.DropdownCellEditor({asyncSubmitter:SugarRest.saveChange, dropdownOptions:statusOptions})},
|
||||
{key:"name_value_list.account_name.value",sortable:true, label:SugarRest.moduleFields.Leads.account_name.label, editor: new YAHOO.widget.TextboxCellEditor({asyncSubmitter:SugarRest.saveChange})},
|
||||
//{key:"name_value_list.department.value",sortable:true, label:SugarRest.moduleFields.Leads.department.label, editor: new YAHOO.widget.TextboxCellEditor({asyncSubmitter:SugarRest.saveChange})},
|
||||
{key:"name_value_list.title.value",sortable:true, label:SugarRest.moduleFields.Leads.title.label, editor: new YAHOO.widget.TextboxCellEditor({asyncSubmitter:SugarRest.saveChange})},
|
||||
{key:"name_value_list.primary_address_city.value",sortable:true, label:'City', editor: new YAHOO.widget.TextboxCellEditor({asyncSubmitter:SugarRest.saveChange})},
|
||||
{key:"name_value_list.primary_address_state.value",sortable:true, label:'State', editor: new YAHOO.widget.TextboxCellEditor({asyncSubmitter:SugarRest.saveChange})},
|
||||
//{key:"name_value_list.primary_address_country.value",sortable:true, label:'Country', editor: new YAHOO.widget.TextboxCellEditor({asyncSubmitter:SugarRest.saveChange})},
|
||||
{key:"name_value_list.primary_address_postalcode.value",sortable:true, label:'Postal', editor: new YAHOO.widget.TextboxCellEditor({asyncSubmitter:SugarRest.saveChange})},
|
||||
//{key:"name_value_list.lead_source.value", label:SugarRest.moduleFields.Leads.lead_source.label},
|
||||
{key:"name_value_list.do_not_call.value",formatter:SugarRest.checkboxField, label:SugarRest.moduleFields.Leads.do_not_call.label, editor: new YAHOO.widget.DropdownCellEditor({asyncSubmitter:SugarRest.saveChange, dropdownOptions:['Call', 'Do Not Call']})},
|
||||
];
|
||||
|
||||
SugarRest.myDataSource = new YAHOO.util.DataSource(SugarRest.proxy_url );
|
||||
SugarRest.myDataSource.connMethodPost = true;
|
||||
SugarRest.myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
|
||||
SugarRest.myDataSource.connXhrMode = "queueRequests";
|
||||
|
||||
SugarRest.myDataSource.responseSchema = {
|
||||
resultsList : "entry_list", // String pointer to result data
|
||||
};
|
||||
SugarRest.myDataSource.responseSchema['fields'] = SugarRest.myColumnDefs;
|
||||
|
||||
|
||||
|
||||
SugarRest.myDataTable = new YAHOO.widget.DataTable("cellediting", SugarRest.myColumnDefs,
|
||||
|
||||
SugarRest.myDataSource, {initialRequest:SugarRest.getLeadsQuery()});
|
||||
// Set up editing flow
|
||||
var highlightEditableCell = function(oArgs) {
|
||||
var elCell = oArgs.target;
|
||||
if(YAHOO.util.Dom.hasClass(elCell, "yui-dt-editable")) {
|
||||
this.highlightCell(elCell);
|
||||
}
|
||||
};
|
||||
SugarRest.myDataTable.subscribe("cellMouseoverEvent", highlightEditableCell);
|
||||
SugarRest.myDataTable.subscribe("cellMouseoutEvent", SugarRest.myDataTable.onEventUnhighlightCell);
|
||||
SugarRest.myDataTable.subscribe("cellClickEvent", SugarRest.myDataTable.onEventShowCellEditor);
|
||||
|
||||
}
|
||||
// Custom formatter for "address" column to preserve line breaks
|
||||
SugarRest.formatAddress = function(elCell, oRecord, oColumn, oData) {
|
||||
elCell.innerHTML = "<pre class=\"address\">" + oData + "</pre>";
|
||||
};
|
||||
|
||||
SugarRest.editLink = function(elCell, oRecord, oColumn, oData) {
|
||||
elCell.innerHTML = "<input type='button' onclick='SugarRest.window = window.open(); SugarRest.editRecord(\"Leads\", \"" + oData + "\");' value='Edit'>";
|
||||
};
|
||||
|
||||
SugarRest.callLink = function(elCell, oRecord, oColumn, oData) {
|
||||
elCell.innerHTML = "<a href='callto://" + oData+ "'>"+ oData+ "</a>";
|
||||
};
|
||||
|
||||
SugarRest.checkboxField = function(elCell, oRecord, oColumn, oData) {
|
||||
checked = (oData == '1')? ' CHECKED ': '';
|
||||
elCell.innerHTML = "<input type='checkbox' " + checked + ">";
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body class="yui-skin-sam">
|
||||
<div id="dialog1">
|
||||
<div class="hd">Please Login <span id="error"></span></div>
|
||||
<div class="bd">
|
||||
<label for="username">User Name:</label><input id='username' type="text" name="username" value="will"/>
|
||||
<label for="password">Password:</label><input id='password' type="password" name="password" value="will"/>
|
||||
<input type="button" value="Login" onclick='SugarRest.login(document.getElementById("username").value,document.getElementById("password").value , "Sugar Rest Demo")'>
|
||||
</div></div>
|
||||
|
||||
|
||||
<div id="cellediting"></div>
|
||||
</body>
|
||||
</html>
|
||||
323
service/example/test.html
Normal file
323
service/example/test.html
Normal file
@@ -0,0 +1,323 @@
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
<!-- Dependency -->
|
||||
<script src="http://yui.yahooapis.com/2.6.0/build/yahoo/yahoo-min.js"></script>
|
||||
<!-- Used for Custom Events and event listener bindings -->
|
||||
<script src="http://yui.yahooapis.com/2.6.0/build/event/event-min.js"></script>
|
||||
<!-- Source file -->
|
||||
<script src="http://yui.yahooapis.com/2.6.0/build/connection/connection-min.js"></script>
|
||||
<script src="http://yui.yahooapis.com/2.6.0/build/json/json-min.js"></script>
|
||||
<script>
|
||||
var SugarRest = function(){}
|
||||
|
||||
SugarRest.callCount = -1;
|
||||
SugarRest.startTest = function(name, password){
|
||||
SugarRest.callCount = 1;
|
||||
SugarRest.login(name, password, 'JAVASCRIPT TEST');
|
||||
}
|
||||
SugarRest.test = function(o){
|
||||
data = SugarRest.logResponse(o);
|
||||
switch(SugarRest.callCount){
|
||||
case 1:
|
||||
SugarRest.callCount++;
|
||||
SugarRest.getServerInfo();
|
||||
SugarRest.session = data['id'];
|
||||
break;
|
||||
case 2:
|
||||
SugarRest.callCount++;
|
||||
SugarRest.getUserId();
|
||||
break;
|
||||
case 3:
|
||||
SugarRest.callCount++;
|
||||
SugarRest.getEntry('Contacts', '17700cb1-9da0-f511-f9d7-490b635b9ead');
|
||||
break;
|
||||
case 4:
|
||||
SugarRest.callCount++;
|
||||
SugarRest.getEntryList('Contacts');
|
||||
break;
|
||||
case 5:
|
||||
SugarRest.callCount++;
|
||||
SugarRest.getModuleFields('Contacts', []);
|
||||
break;
|
||||
case 6:
|
||||
SugarRest.callCount++;
|
||||
SugarRest.getEntries('Contacts', ['17700cb1-9da0-f511-f9d7-490b635b9ead', '177cf935-e488-04c3-7af3-490b632b4ab0']);
|
||||
break;
|
||||
case 7:
|
||||
SugarRest.callCount++;
|
||||
SugarRest.setRelationship('Accounts', 'mastd368-c7er-cof8-16pu-47d57b16pets', 'contacts', ['2f043319-7cb0-6bfa-75d3-490b63fa6c08', 'c57d7598-42e6-cca8-a302-490b63118b48']);
|
||||
break;
|
||||
case 8:
|
||||
SugarRest.callCount++;
|
||||
SugarRest.setRelationships(['Accounts', 'Contacts'], ['mastd368-c7er-cof8-16pu-47d57b16pets', '2f043319-7cb0-6bfa-75d3-490b63fa6c08'], ['contacts', 'opportunities'], [['2f043319-7cb0-6bfa-75d3-490b63fa6c08'], ['52acdc25-6a6e-a574-6936-490b63fbc1df']]);
|
||||
break;
|
||||
case 9:
|
||||
SugarRest.callCount++;
|
||||
SugarRest.getRelationships('Accounts', 'mastd368-c7er-cof8-16pu-47d57b16pets', 'contacts', '', ['first_name', 'last_name', 'primary_address_city'], [{'name' : 'opportunities', 'value' : ['name', 'type', 'lead_source']}, {'name' : 'email_addresses', 'value' : ['id', 'email_address', 'opt_out', 'primary_address']}], 0);
|
||||
break;
|
||||
case 10:
|
||||
SugarRest.callCount++;
|
||||
SugarRest.setEntry('Accounts', [{'name' : 'city', 'value' : 'SFO'},
|
||||
{'name' : 'name', 'value' : 'DCE Puppet Master111'}]);
|
||||
break;
|
||||
case 11:
|
||||
SugarRest.callCount++;
|
||||
SugarRest.setEntries('Accounts', [[{'name' : 'city', 'value' : 'SFO'},
|
||||
{'name' : 'name', 'value' : 'Acc1'}], [{'name' : 'city', 'value' : 'SFO'},
|
||||
{'name' : 'name', 'value' : 'Acc2'}]]);
|
||||
break;
|
||||
case 12:
|
||||
SugarRest.callCount++;
|
||||
SugarRest.seamlessLogin();
|
||||
break;
|
||||
case 13:
|
||||
SugarRest.callCount++;
|
||||
SugarRest.setNoteAttachment({'id' : 'bb79c0f3-78e1-c6fc-2c41-490b636653c0', 'related_module_id' : '3d921d14-047f-cc7d-1988-490b63592ae8', 'related_module_name' : 'Accounts'});
|
||||
break;
|
||||
case 14:
|
||||
SugarRest.callCount++;
|
||||
SugarRest.getNoteAttachment('bb79c0f3-78e1-c6fc-2c41-490b636653c0');
|
||||
break;
|
||||
case 15:
|
||||
SugarRest.callCount++;
|
||||
SugarRest.getDocumentRevision('ab18578e-17f5-5fc0-96ba-4925a9baaa20');
|
||||
break;
|
||||
case 16:
|
||||
SugarRest.callCount++;
|
||||
SugarRest.search('admin', '21232f297a57a5a743894a0e4a801fc3', 'a', ['Accounts', 'Contacts'], 0, 5);
|
||||
break;
|
||||
/*
|
||||
case 17:
|
||||
SugarRest.callCount++;
|
||||
SugarRest.setDocumentRevision({'id' : '8d7f0917-19d3-9f88-80d7-49121ddb62e2','document_name' : 'test doc',
|
||||
'revision' : 'D',
|
||||
'filename' : 'code1.txt',
|
||||
'file' : 'JHFzID0gJyc7DQppZiAoaXNzZXQoJF9TRVJWRVJbJ1FVRVJZX1NUUklORyddKSkgew0KCSRxcyA9ICRfU0VSVkVSWydRVUVSWV9TVFJJTkcnXTsNCn0gZWxzZWlmIChpc3NldCgkSFRUUF9TRVJWRVJfVkFSU1snUVVFUllfU1RSSU5HJ10pKSB7DQoJJHFzID0gJEhUVFBfU0VSVkVSX1ZBUlNbJ1FVRVJZX1NUUklORyddOw0KfSBlbHNlIHsNCgkkcXMgPSAnJzsNCn0NCg0KJHQxID0gc3RydG90aW1lKCJub3ciKTsNCg0KaWYgKGVyZWcoJ3dzZGwnLCAkcXMpICl7DQoJZ2xvYmFsICRzdWdhcl9jb25maWc7DQoJJHVwbG9hZERpciA9ICRzdWdhcl9jb25maWdbJ3VwbG9hZF9kaXInXTsNCgkkd3NkbFVSTCA9ICRzdWdhcl9jb25maWdbJ3NpdGVfdXJsJ10uJy9zb2FwLnBocD93c2RsJzsNCgkkd3NkbENhY2hlRmlsZSA9ICR1cGxvYWREaXIuJy93c2RsY2FjaGUtJyAuIG1kNSgkd3NkbFVSTCk7DQoJaWYoZmlsZV9leGlzdHMoJHdzZGxDYWNoZUZpbGUpKSB7CQ0KCSAgICBpZigkZmggPSBAc3VnYXJfZm9wZW4oJHdzZGxDYWNoZUZpbGUsICJyIikpIHsNCgkgICAgCSRjb250ZW50cyA9IGZyZWFkKCRmaCwgZmlsZXNpemUoJHdzZGxDYWNoZUZpbGUpKTsNCgkgICAgCWZjbG9zZSgkZmgpOw0KCQkJaGVhZGVyKCJDb250ZW50LVR5cGU6IHRleHQveG1sOyBjaGFyc2V0PUlTTy04ODU5LTFcclxuIik7DQoJCQlwcmludCAkY29udGVudHM7CSAgICAJDQoJICAgIH0gLy8gaWYJCQ0KCX0gZWxzZSB7DQoJCSRzZXJ2ZXItPnNlcnZpY2UoJEhUVFBfUkFXX1BPU1RfREFUQSk7DQoJICAgIGlmKCRmaCA9IEBzdWdhcl9mb3Blbigkd3NkbENhY2hlRmlsZSwgInciKSkgew0KCSAgICAJZnB1dHMoJGZoLCBvYl9nZXRfY29udGVudHMoKSk7DQoJICAgIAlmY2xvc2UoJGZoKTsNCgkgICAgfSAvLyBpZg0KCX0NCn0gZWxzZSB7DQoJJEdMT0JBTFNbJ2xvZyddLT5kZWJ1ZygiZGF0YSA9ICIgLiAkSFRUUF9SQVdfUE9TVF9EQVRBKTsNCgkkc2VydmVyLT5zZXJ2aWNlKCRIVFRQX1JBV19QT1NUX0RBVEEpOw0KfQ0KDQoNCg0KDQoJCQlpZiAoaXNzZXQoJHRoaXMtPm1ldGhvZHBhcmFtcykgJiYgaXNzZXQoJHRoaXMtPm1ldGhvZHBhcmFtc1snc2Vzc2lvbiddKSkgew0KCQkJCSRHTE9CQUxTWydsb2cnXS0+ZGVidWcoIkluIHNlcnZpY2UsIGRhdGEgPSAiIC4gJHRoaXMtPm1ldGhvZHBhcmFtc1snc2Vzc2lvbiddKTsNCgkJCX0NCg=='});
|
||||
break;
|
||||
*/
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
console = false;
|
||||
if(!console){
|
||||
console = {};
|
||||
console.log = function(){
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
SugarRest.getRequestData = function(method_name, data) {
|
||||
var returndata = 'method=' + method_name + '&input_type=json&response_type=json';
|
||||
if (data != '') {
|
||||
returndata = returndata + '&rest_data=' + data;
|
||||
}
|
||||
return returndata
|
||||
}
|
||||
SugarRest.logResponse = function(o){
|
||||
|
||||
data = YAHOO.lang.JSON.parse(o.responseText);
|
||||
console.log(data);
|
||||
return data;
|
||||
}
|
||||
|
||||
SugarRest.getServerInfo = function(){
|
||||
console.log('Getting Server Info');
|
||||
YAHOO.util.Connect.asyncRequest('POST', 'v2/rest.php' , {success:SugarRest.test, failure:SugarRest.test}, SugarRest.getRequestData('get_server_info'));
|
||||
}
|
||||
|
||||
SugarRest.getModuleFields = function(module, fields){
|
||||
console.log('Getting Server Info');
|
||||
var data = [SugarRest.session, module, fields];
|
||||
m = YAHOO.lang.JSON.stringify(data);
|
||||
YAHOO.util.Connect.asyncRequest('POST', 'v2/rest.php' , {success:SugarRest.test, failure:SugarRest.test}, SugarRest.getRequestData('get_module_fields', m));
|
||||
}
|
||||
|
||||
SugarRest.login = function(name, password, application){
|
||||
console.log('Logging In');
|
||||
var loginData = [{
|
||||
user_name: 'admin',
|
||||
password: '21232f297a57a5a743894a0e4a801fc3'
|
||||
},'javascriptTest'];
|
||||
m = YAHOO.lang.JSON.stringify(loginData);
|
||||
YAHOO.util.Connect.asyncRequest('POST', 'v2/rest.php' , {success:SugarRest.test, failure:SugarRest.test}, SugarRest.getRequestData('login', m));
|
||||
}
|
||||
|
||||
SugarRest.getUserId = function(){
|
||||
console.log('Getting User Id ');
|
||||
m = YAHOO.lang.JSON.stringify(SugarRest.session);
|
||||
YAHOO.util.Connect.asyncRequest('POST', 'v2/rest.php' , {success:SugarRest.test, failure:SugarRest.test}, SugarRest.getRequestData('get_user_id', m));
|
||||
}
|
||||
|
||||
|
||||
SugarRest.getEntryList = function(module){
|
||||
var data = [SugarRest.session, module, "", '', 0, [], [{
|
||||
'name': 'email_addresses',
|
||||
'value': ['id', 'email_address', 'opt_out', 'primary_address',]
|
||||
}], 10, 0];
|
||||
m = YAHOO.lang.JSON.stringify(data);
|
||||
YAHOO.util.Connect.asyncRequest('POST', 'v2/rest.php', {
|
||||
success: SugarRest.test,
|
||||
failure: SugarRest.test
|
||||
}, SugarRest.getRequestData('get_entry_list', m));
|
||||
}
|
||||
|
||||
|
||||
SugarRest.getEntry = function(module, id){
|
||||
var data = [SugarRest.session, module, id, ['last_name', 'email1', 'date_modified','description'], [{
|
||||
'name': 'email_addresses',
|
||||
'value': ['id', 'email_address', 'opt_out', 'primary_address',]
|
||||
}]];
|
||||
m = YAHOO.lang.JSON.stringify(data);
|
||||
YAHOO.util.Connect.asyncRequest('POST', 'v2/rest.php', {
|
||||
success: SugarRest.test,
|
||||
failure: SugarRest.test
|
||||
}, SugarRest.getRequestData('get_entry', m));
|
||||
}
|
||||
|
||||
SugarRest.getEntries = function(module, ids){
|
||||
var data = [SugarRest.session, module, ids, ['last_name', 'email1', 'date_modified','description'], [{
|
||||
'name': 'email_addresses',
|
||||
'value': ['id', 'email_address', 'opt_out', 'primary_address',]
|
||||
}]];
|
||||
m = YAHOO.lang.JSON.stringify(data);
|
||||
YAHOO.util.Connect.asyncRequest('POST', 'v2/rest.php', {
|
||||
success: SugarRest.test,
|
||||
failure: SugarRest.test
|
||||
}, SugarRest.getRequestData('get_entries', m));
|
||||
}
|
||||
|
||||
SugarRest.setRelationship = function(module, module_id, link_field_name, related_ids){
|
||||
var data = [SugarRest.session, module, module_id, link_field_name, related_ids];
|
||||
m = YAHOO.lang.JSON.stringify(data);
|
||||
YAHOO.util.Connect.asyncRequest('POST', 'v2/rest.php', {
|
||||
success: SugarRest.test,
|
||||
failure: SugarRest.test
|
||||
}, SugarRest.getRequestData('set_relationship', m));
|
||||
}
|
||||
|
||||
SugarRest.setRelationships = function(modules, module_ids, link_field_names, related_ids){
|
||||
var data = [SugarRest.session, modules, module_ids, link_field_names, related_ids];
|
||||
m = YAHOO.lang.JSON.stringify(data);
|
||||
YAHOO.util.Connect.asyncRequest('POST', 'v2/rest.php', {
|
||||
success: SugarRest.test,
|
||||
failure: SugarRest.test
|
||||
}, SugarRest.getRequestData('set_relationships', m));
|
||||
}
|
||||
|
||||
SugarRest.getRelationships = function(module, module_id, link_field_name, related_module_query, related_fields, related_module_link_name_to_fields_array, deleted){
|
||||
var data = [SugarRest.session, module, module_id, link_field_name, related_module_query, related_fields, related_module_link_name_to_fields_array, deleted];
|
||||
m = YAHOO.lang.JSON.stringify(data);
|
||||
YAHOO.util.Connect.asyncRequest('POST', 'v2/rest.php', {
|
||||
success: SugarRest.test,
|
||||
failure: SugarRest.test
|
||||
}, SugarRest.getRequestData('get_relationships', m));
|
||||
}
|
||||
|
||||
SugarRest.setEntry = function(module, name_value_list){
|
||||
var data = [SugarRest.session, module, name_value_list];
|
||||
m = YAHOO.lang.JSON.stringify(data);
|
||||
YAHOO.util.Connect.asyncRequest('POST', 'v2/rest.php', {
|
||||
success: SugarRest.test,
|
||||
failure: SugarRest.test
|
||||
}, SugarRest.getRequestData('set_entry', m));
|
||||
}
|
||||
|
||||
SugarRest.setEntries = function(module, name_value_lists){
|
||||
var data = [SugarRest.session, module, name_value_lists];
|
||||
m = YAHOO.lang.JSON.stringify(data);
|
||||
YAHOO.util.Connect.asyncRequest('POST', 'v2/rest.php', {
|
||||
success: SugarRest.test,
|
||||
failure: SugarRest.test
|
||||
}, SugarRest.getRequestData('set_entries', m));
|
||||
}
|
||||
|
||||
SugarRest.seamlessLogin = function(){
|
||||
var data = [SugarRest.session];
|
||||
m = YAHOO.lang.JSON.stringify(data);
|
||||
YAHOO.util.Connect.asyncRequest('POST', 'v2/rest.php', {
|
||||
success: SugarRest.test,
|
||||
failure: SugarRest.test
|
||||
}, SugarRest.getRequestData('seamless_login', m));
|
||||
}
|
||||
|
||||
SugarRest.setNoteAttachment = function(noteObject){
|
||||
var data = [SugarRest.session, noteObject];
|
||||
m = YAHOO.lang.JSON.stringify(data);
|
||||
YAHOO.util.Connect.asyncRequest('POST', 'v2/rest.php', {
|
||||
success: SugarRest.test,
|
||||
failure: SugarRest.test
|
||||
}, SugarRest.getRequestData('set_note_attachment', m));
|
||||
}
|
||||
|
||||
SugarRest.getNoteAttachment = function(noteId){
|
||||
var data = [SugarRest.session, noteId];
|
||||
m = YAHOO.lang.JSON.stringify(data);
|
||||
YAHOO.util.Connect.asyncRequest('POST', 'v2/rest.php', {
|
||||
success: SugarRest.test,
|
||||
failure: SugarRest.test
|
||||
}, SugarRest.getRequestData('get_note_attachment', m));
|
||||
}
|
||||
|
||||
SugarRest.setDocumentRevision = function(revisionObject){
|
||||
var data = [SugarRest.session, revisionObject];
|
||||
m = YAHOO.lang.JSON.stringify(data);
|
||||
YAHOO.util.Connect.asyncRequest('POST', 'v2/rest.php', {
|
||||
success: SugarRest.test,
|
||||
failure: SugarRest.test
|
||||
}, SugarRest.getRequestData('set_document_revision', m));
|
||||
}
|
||||
|
||||
SugarRest.getDocumentRevision = function(docRevId){
|
||||
var data = [SugarRest.session, docRevId];
|
||||
m = YAHOO.lang.JSON.stringify(data);
|
||||
YAHOO.util.Connect.asyncRequest('POST', 'v2/rest.php', {
|
||||
success: SugarRest.test,
|
||||
failure: SugarRest.test
|
||||
}, SugarRest.getRequestData('get_document_revision', m));
|
||||
}
|
||||
|
||||
SugarRest.search = function(username, password, search_string, modules_to_search, offset, maxresults){
|
||||
var data = [username, password, search_string, modules_to_search, offset, maxresults];
|
||||
m = YAHOO.lang.JSON.stringify(data);
|
||||
YAHOO.util.Connect.asyncRequest('POST', 'v2/rest.php', {
|
||||
success: SugarRest.test,
|
||||
failure: SugarRest.test
|
||||
}, SugarRest.getRequestData('search_by_module', m));
|
||||
}
|
||||
SugarRest.startTest();
|
||||
</script>
|
||||
|
||||
|
||||
58
service/utils/SugarRest.js
Normal file
58
service/utils/SugarRest.js
Normal file
@@ -0,0 +1,58 @@
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
if(typeof(SugarRest)=='undefined'){SugarRest=function(proxy_url,server_url,application_name){this.proxy_url=proxy_url;this.server_url=server_url;this.session_id=false;this.user_id=false;this.application_name=application_name;}
|
||||
SugarRest.prototype.call=function(method,args,callback,params,response_type){if(!callback)callback=this.log;console.log(callback);query=this.getQuery(method,args,response_type);YAHOO.util.Connect.asyncRequest('POST',this.proxy_url,{success:callback,failure:callback,scope:this,argument:params},query);}
|
||||
SugarRest.prototype.getQuery=function(method,args,response_type){if(!response_type)response_type='JSON';query='method='+method+'&input_type=JSON&response_type='+response_type;if(args!=null){m=YAHOO.lang.JSON.stringify(args);query+='&rest_data='+m;}
|
||||
return query;}
|
||||
SugarRest.prototype.get_server_info=function(callback){this.call('get_server_info','',callback);}
|
||||
SugarRest.prototype.login=function(user_name,password){encryption='PLAIN';if(typeof(hex_md5)!='undefined'){password=hex_md5(password);encryption='MD5';}
|
||||
var loginData=[{user_name:user_name,password:password,encryption:encryption,},this.application_name];console.log('Encryption:'+encryption);this.call('login',loginData,this._login);}
|
||||
SugarRest.prototype._login=function(o){data=YAHOO.lang.JSON.parse(o.responseText);console.log(data);this.session_id=data['id'];this.user_id=data['name_value_list']['user_id'];}
|
||||
SugarRest.prototype.logout=function(callback){this.call('logout',this.session_id,callback);}
|
||||
SugarRest.prototype.get_entry=function(module_name,id,select_fields,link_names_to_related_fields,callback){this.call('get_entry',[this.session_id,module_name,id,select_fields,link_names_to_related_fields],callback);}
|
||||
SugarRest.prototype.get_entries=function(module_name,ids,select_fields,link_names_to_related_fields,callback){this.call('get_entries',[this.session_id,module_name,ids,select_fields,link_names_to_related_fields],callback);}
|
||||
SugarRest.prototype.seamless_login=function(){this.call('seamless_login',this.session_id,this._seamless_login);}
|
||||
SugarRest.prototype._seamless_login=function(o){window.open('GET',this.server_url);}
|
||||
SugarRest.prototype.get_entry_list=function(module_name,query,order_by,select_fields,offset,max_results,link_names_to_related_fields,callback){var data=[this.session_id,module_name,query,order_by,offset,select_fields,link_names_to_related_fields,max_results,0];this.call('get_entry_list',data,callback);}
|
||||
SugarRest.prototype.rss_get_entry_list=function(module_name,query,order_by,select_fields,offset,max_results,link_names_to_related_fields,callback){var data=[this.session_id,module_name,query,order_by,offset,select_fields,link_names_to_related_fields,max_results,0];this.call('get_entry_list',data,callback,null,'RSS');}
|
||||
SugarRest.prototype.rss_popup_get_entry_list=function(module_name,query,order_by,select_fields,offset,max_results,link_names_to_related_fields,callback){var data=[this.session_id,module_name,query,order_by,offset,select_fields,link_names_to_related_fields,max_results,0];query=this.getQuery('get_entry_list',data,'RSS');window.open(this.proxy_url+'?'+query);}
|
||||
SugarRest.prototype.set_relationship=function(module_name,module_id,link_name,related_ids){var data=[this.session_id,module_name,module_id,link_name,related_ids];this.call('set_relationship',data,callback);}
|
||||
SugarRest.prototype.set_relationships=function(module_name,module_ids,link_names,related_ids){var data=[this.session_id,module_name,module_ids,link_names,related_ids];this.call('set_relationship',data,callback);}
|
||||
SugarRest.prototype.get_relationships=function(module_name,module_id,link_name,link_query,link_fields,link_related_fields){var data=[this.session_id,module_name,module_id,link_name,link_query,link_fields,link_related_fields];this.call('get_relationships',data,callback);}
|
||||
SugarRest.prototype.set_note_attachment=function(note_id,filename,base64file,related_module,related_module_id,callback){var data=[this.session_id,[note_id,filename,base64file,related_module,related_module_id]];this.call('set_note_attachment',data,callback);}
|
||||
SugarRest.prototype.get_note_attachment=function(note_id){this.call('get_note_attachment',[this.session_id,note_id]);}
|
||||
SugarRest.prototype.set_document_revision=function(document_id,revision,filename,base64file,callback){var data=[this.session_id,[document_id,revision,filename,base64file]];this.call('set_document_revision',data,callback);}
|
||||
SugarRest.prototype.set_document_revision=function(revision_id){this.call('get_document_revision',[this.session_id,revision_id]);}
|
||||
SugarRest.prototype.log=function(o){data=YAHOO.lang.JSON.parse(o.responseText);if(typeof(console)!='undefined')console.log(data);return data;}}
|
||||
59
service/v2/SugarSoapService2.php
Normal file
59
service/v2/SugarSoapService2.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry'))define('sugarEntry', true);
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
/**
|
||||
* This is a service class for version 2
|
||||
*/
|
||||
require_once('service/core/NusoapSoap.php');
|
||||
class SugarSoapService2 extends NusoapSoap{
|
||||
|
||||
/**
|
||||
* This method registers all the functions which you want to be available for SOAP.
|
||||
*
|
||||
* @param array $excludeFunctions - All the functions you don't want to register
|
||||
*/
|
||||
public function register($excludeFunctions = array()){
|
||||
$GLOBALS['log']->info('Begin: SugarSoapService2->register');
|
||||
$this->excludeFunctions = $excludeFunctions;
|
||||
$registryObject = new $this->registryClass($this);
|
||||
$registryObject->register();
|
||||
$this->excludeFunctions = array();
|
||||
$GLOBALS['log']->info('End: SugarSoapService2->register');
|
||||
} // fn
|
||||
|
||||
} // clazz
|
||||
?>
|
||||
652
service/v2/registry.php
Normal file
652
service/v2/registry.php
Normal file
@@ -0,0 +1,652 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry'))define('sugarEntry', true);
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
/**
|
||||
* This class is responsible for providing all the registration of all the functions and complex types
|
||||
*
|
||||
*/
|
||||
class registry {
|
||||
|
||||
protected $serviceClass = null;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param Class - $serviceClass
|
||||
*/
|
||||
public function __construct($serviceClass) {
|
||||
$this->serviceClass = $serviceClass;
|
||||
} // fn
|
||||
|
||||
/**
|
||||
* It registers all the functions and types by doign a call back method on service object
|
||||
*
|
||||
*/
|
||||
public function register() {
|
||||
$this->registerFunction();
|
||||
$this->registerTypes();
|
||||
}
|
||||
|
||||
/**
|
||||
* This mehtod registers all the functions on the service class
|
||||
*
|
||||
*/
|
||||
protected function registerFunction() {
|
||||
// START OF REGISTER FUNCTIONS
|
||||
|
||||
$GLOBALS['log']->info('Begin: registry->registerFunction');
|
||||
|
||||
$this->serviceClass->registerFunction(
|
||||
'login',
|
||||
array('user_auth'=>'tns:user_auth', 'application_name'=>'xsd:string', 'name_value_list'=>'tns:name_value_list'),
|
||||
array('return'=>'tns:entry_value')
|
||||
);
|
||||
|
||||
$this->serviceClass->registerFunction(
|
||||
'logout',
|
||||
array('session'=>'xsd:string'),
|
||||
array());
|
||||
|
||||
$this->serviceClass->registerFunction(
|
||||
'get_entry',
|
||||
array('session'=>'xsd:string', 'module_name'=>'xsd:string', 'id'=>'xsd:string', 'select_fields'=>'tns:select_fields','link_name_to_fields_array'=>'tns:link_names_to_fields_array'),
|
||||
array('return'=>'tns:get_entry_result_version2'));
|
||||
|
||||
$this->serviceClass->registerFunction(
|
||||
'get_entries',
|
||||
array('session'=>'xsd:string', 'module_name'=>'xsd:string', 'ids'=>'tns:select_fields', 'select_fields'=>'tns:select_fields', 'link_name_to_fields_array'=>'tns:link_names_to_fields_array'),
|
||||
array('return'=>'tns:get_entry_result_version2'));
|
||||
|
||||
$this->serviceClass->registerFunction(
|
||||
'get_entry_list',
|
||||
array('session'=>'xsd:string', 'module_name'=>'xsd:string', 'query'=>'xsd:string', 'order_by'=>'xsd:string','offset'=>'xsd:int', 'select_fields'=>'tns:select_fields', 'link_name_to_fields_array'=>'tns:link_names_to_fields_array', 'max_results'=>'xsd:int', 'deleted'=>'xsd:int'),
|
||||
array('return'=>'tns:get_entry_list_result_version2'));
|
||||
|
||||
$this->serviceClass->registerFunction(
|
||||
'set_relationship',
|
||||
array('session'=>'xsd:string','module_name'=>'xsd:string','module_id'=>'xsd:string','link_field_name'=>'xsd:string', 'related_ids'=>'tns:select_fields', 'name_value_list'=>'tns:name_value_list', 'delete'=>'xsd:int'),
|
||||
array('return'=>'tns:new_set_relationship_list_result'));
|
||||
|
||||
$this->serviceClass->registerFunction(
|
||||
'set_relationships',
|
||||
array('session'=>'xsd:string','module_names'=>'tns:select_fields','module_ids'=>'tns:select_fields','link_field_names'=>'tns:select_fields','related_ids'=>'tns:new_set_relationhip_ids', 'name_value_lists'=>'tns:name_value_lists', 'delete_array' => 'tns:deleted_array'),
|
||||
array('return'=>'tns:new_set_relationship_list_result'));
|
||||
|
||||
$this->serviceClass->registerFunction(
|
||||
'get_relationships',
|
||||
array('session'=>'xsd:string', 'module_name'=>'xsd:string', 'module_id'=>'xsd:string', 'link_field_name'=>'xsd:string', 'related_module_query'=>'xsd:string', 'related_fields'=>'tns:select_fields', 'related_module_link_name_to_fields_array'=>'tns:link_names_to_fields_array', 'deleted'=>'xsd:int'),
|
||||
array('return'=>'tns:get_entry_result_version2'));
|
||||
|
||||
$this->serviceClass->registerFunction(
|
||||
'set_entry',
|
||||
array('session'=>'xsd:string', 'module_name'=>'xsd:string', 'name_value_list'=>'tns:name_value_list'),
|
||||
array('return'=>'tns:new_set_entry_result'));
|
||||
|
||||
$this->serviceClass->registerFunction(
|
||||
'set_entries',
|
||||
array('session'=>'xsd:string', 'module_name'=>'xsd:string', 'name_value_lists'=>'tns:name_value_lists'),
|
||||
array('return'=>'tns:new_set_entries_result'));
|
||||
|
||||
$this->serviceClass->registerFunction(
|
||||
'get_server_info',
|
||||
array(),
|
||||
array('return'=>'tns:get_server_info_result'));
|
||||
|
||||
$this->serviceClass->registerFunction(
|
||||
'get_user_id',
|
||||
array('session'=>'xsd:string'),
|
||||
array('return'=>'xsd:string'));
|
||||
|
||||
$this->serviceClass->registerFunction(
|
||||
'get_module_fields',
|
||||
array('session'=>'xsd:string', 'module_name'=>'xsd:string', 'fields'=>'tns:select_fields'),
|
||||
array('return'=>'tns:new_module_fields'));
|
||||
|
||||
$this->serviceClass->registerFunction(
|
||||
'seamless_login',
|
||||
array('session'=>'xsd:string'),
|
||||
array('return'=>'xsd:int'));
|
||||
|
||||
$this->serviceClass->registerFunction(
|
||||
'set_note_attachment',
|
||||
array('session'=>'xsd:string','note'=>'tns:new_note_attachment'),
|
||||
array('return'=>'tns:new_set_entry_result'));
|
||||
|
||||
$this->serviceClass->registerFunction(
|
||||
'get_note_attachment',
|
||||
array('session'=>'xsd:string', 'id'=>'xsd:string'),
|
||||
array('return'=>'tns:new_return_note_attachment'));
|
||||
|
||||
$this->serviceClass->registerFunction(
|
||||
'set_document_revision',
|
||||
array('session'=>'xsd:string','note'=>'tns:document_revision'),
|
||||
array('return'=>'tns:new_set_entry_result'));
|
||||
|
||||
$this->serviceClass->registerFunction(
|
||||
'get_document_revision',
|
||||
array('session'=>'xsd:string','i'=>'xsd:string'),
|
||||
array('return'=>'tns:new_return_document_revision'));
|
||||
|
||||
$this->serviceClass->registerFunction(
|
||||
'search_by_module',
|
||||
array('session'=>'xsd:string','search_string'=>'xsd:string', 'modules'=>'tns:select_fields', 'offset'=>'xsd:int', 'max_results'=>'xsd:int'),
|
||||
array('return'=>'tns:return_search_result'));
|
||||
|
||||
$this->serviceClass->registerFunction(
|
||||
'get_available_modules',
|
||||
array('session'=>'xsd:string'),
|
||||
array('return'=>'tns:module_list'));
|
||||
|
||||
$this->serviceClass->registerFunction(
|
||||
'get_user_team_id',
|
||||
array('session'=>'xsd:string'),
|
||||
array('return'=>'xsd:string'));
|
||||
$this->serviceClass->registerFunction(
|
||||
'set_campaign_merge',
|
||||
array('session'=>'xsd:string', 'targets'=>'tns:select_fields', 'campaign_id'=>'xsd:string'),
|
||||
array());
|
||||
$this->serviceClass->registerFunction(
|
||||
'get_entries_count',
|
||||
array('session'=>'xsd:string', 'module_name'=>'xsd:string', 'query'=>'xsd:string', 'deleted' => 'xsd:int'),
|
||||
array('return'=>'tns:get_entries_count_result'));
|
||||
|
||||
|
||||
$GLOBALS['log']->info('END: registry->registerFunction');
|
||||
|
||||
// END OF REGISTER FUNCTIONS
|
||||
} // fn
|
||||
|
||||
/**
|
||||
* This method registers all the complex types
|
||||
*
|
||||
*/
|
||||
protected function registerTypes() {
|
||||
|
||||
// START OF REGISTER COMPLEX TYPES
|
||||
|
||||
$GLOBALS['log']->info('Begin: registry->registerTypes');
|
||||
|
||||
$this->serviceClass->registerType(
|
||||
'new_note_attachment',
|
||||
'complexType',
|
||||
'struct',
|
||||
'all',
|
||||
'',
|
||||
array(
|
||||
"id" => array('name'=>"id",'type'=>'xsd:string'),
|
||||
"filename" => array('name'=>"filename",'type'=>'xsd:string'),
|
||||
"file" => array('name'=>"file",'type'=>'xsd:string'),
|
||||
"related_module_id" => array('name'=>"related_module_id",'type'=>'xsd:string'),
|
||||
"related_module_name" => array('name'=>"related_module_name",'type'=>'xsd:string'),
|
||||
)
|
||||
);
|
||||
|
||||
$this->serviceClass->registerType(
|
||||
'new_return_note_attachment',
|
||||
'complexType',
|
||||
'struct',
|
||||
'all',
|
||||
'',
|
||||
array(
|
||||
"note_attachment"=>array('name'=>'note_attachment', 'type'=>'tns:new_note_attachment'),
|
||||
)
|
||||
);
|
||||
|
||||
$this->serviceClass->registerType(
|
||||
'user_auth',
|
||||
'complexType',
|
||||
'struct',
|
||||
'all',
|
||||
'',
|
||||
array(
|
||||
'user_name'=>array('name'=>'user_name', 'type'=>'xsd:string'),
|
||||
'password' => array('name'=>'password', 'type'=>'xsd:string'),
|
||||
)
|
||||
);
|
||||
|
||||
$this->serviceClass->registerType(
|
||||
'field',
|
||||
'complexType',
|
||||
'struct',
|
||||
'all',
|
||||
'',
|
||||
array(
|
||||
'name'=>array('name'=>'name', 'type'=>'xsd:string'),
|
||||
'type'=>array('name'=>'type', 'type'=>'xsd:string'),
|
||||
'label'=>array('name'=>'label', 'type'=>'xsd:string'),
|
||||
'required'=>array('name'=>'required', 'type'=>'xsd:int'),
|
||||
'options'=>array('name'=>'options', 'type'=>'tns:name_value_list'),
|
||||
'default_value'=>array('name'=>'name', 'type'=>'xsd:string'),
|
||||
)
|
||||
);
|
||||
|
||||
$this->serviceClass->registerType(
|
||||
'field_list',
|
||||
'complexType',
|
||||
'array',
|
||||
'',
|
||||
'SOAP-ENC:Array',
|
||||
array(),
|
||||
array(
|
||||
array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'tns:field[]')
|
||||
),
|
||||
'tns:field'
|
||||
);
|
||||
|
||||
$this->serviceClass->registerType(
|
||||
'link_field',
|
||||
'complexType',
|
||||
'struct',
|
||||
'all',
|
||||
'',
|
||||
array(
|
||||
'name'=>array('name'=>'name', 'type'=>'xsd:string'),
|
||||
'type'=>array('name'=>'type', 'type'=>'xsd:string'),
|
||||
'relationship'=>array('name'=>'relationship', 'type'=>'xsd:string'),
|
||||
'module'=>array('name'=>'module', 'type'=>'xsd:string'),
|
||||
'bean_name'=>array('name'=>'bean_name', 'type'=>'xsd:string'),
|
||||
)
|
||||
);
|
||||
|
||||
$this->serviceClass->registerType(
|
||||
'link_field_list',
|
||||
'complexType',
|
||||
'array',
|
||||
'',
|
||||
'SOAP-ENC:Array',
|
||||
array(),
|
||||
array(
|
||||
array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'tns:link_field[]')
|
||||
),
|
||||
'tns:link_field'
|
||||
);
|
||||
|
||||
$this->serviceClass->registerType(
|
||||
'name_value',
|
||||
'complexType',
|
||||
'struct',
|
||||
'all',
|
||||
'',
|
||||
array(
|
||||
'name'=>array('name'=>'name', 'type'=>'xsd:string'),
|
||||
'value'=>array('name'=>'value', 'type'=>'xsd:string'),
|
||||
)
|
||||
);
|
||||
|
||||
$this->serviceClass->registerType(
|
||||
'name_value_list',
|
||||
'complexType',
|
||||
'array',
|
||||
'',
|
||||
'SOAP-ENC:Array',
|
||||
array(),
|
||||
array(
|
||||
array('ref'=>'SOAP-ENC:arrayType', 'wsdl:arrayType'=>'tns:name_value[]')
|
||||
),
|
||||
'tns:name_value'
|
||||
);
|
||||
|
||||
$this->serviceClass->registerType(
|
||||
'name_value_lists',
|
||||
'complexType',
|
||||
'array',
|
||||
'',
|
||||
'SOAP-ENC:Array',
|
||||
array(),
|
||||
array(
|
||||
array('ref'=>'SOAP-ENC:arrayType', 'wsdl:arrayType'=>'tns:name_value_list[]')
|
||||
),
|
||||
'tns:name_value_list'
|
||||
);
|
||||
|
||||
$this->serviceClass->registerType(
|
||||
'select_fields',
|
||||
'complexType',
|
||||
'array',
|
||||
'',
|
||||
'SOAP-ENC:Array',
|
||||
array(),
|
||||
array(
|
||||
array('ref'=>'SOAP-ENC:arrayType', 'wsdl:arrayType'=>'xsd:string[]')
|
||||
),
|
||||
'xsd:string'
|
||||
);
|
||||
|
||||
$this->serviceClass->registerType(
|
||||
'deleted_array',
|
||||
'complexType',
|
||||
'array',
|
||||
'',
|
||||
'SOAP-ENC:Array',
|
||||
array(),
|
||||
array(
|
||||
array('ref'=>'SOAP-ENC:arrayType', 'wsdl:arrayType'=>'xsd:int[]')
|
||||
),
|
||||
'xsd:string'
|
||||
);
|
||||
|
||||
$this->serviceClass->registerType(
|
||||
'new_module_fields',
|
||||
'complexType',
|
||||
'struct',
|
||||
'all',
|
||||
'',
|
||||
array(
|
||||
'module_name'=>array('name'=>'module_name', 'type'=>'xsd:string'),
|
||||
'module_fields'=>array('name'=>'module_fields', 'type'=>'tns:field_list'),
|
||||
'link_fields'=>array('name'=>'link_fields', 'type'=>'tns:link_field_list'),
|
||||
)
|
||||
);
|
||||
|
||||
$this->serviceClass->registerType(
|
||||
'entry_value',
|
||||
'complexType',
|
||||
'struct',
|
||||
'all',
|
||||
'',
|
||||
array(
|
||||
'id'=>array('name'=>'id', 'type'=>'xsd:string'),
|
||||
'module_name'=>array('name'=>'module_name', 'type'=>'xsd:string'),
|
||||
'name_value_list'=>array('name'=>'name_value_list', 'type'=>'tns:name_value_list'),
|
||||
)
|
||||
);
|
||||
|
||||
$this->serviceClass->registerType(
|
||||
'entry_list',
|
||||
'complexType',
|
||||
'array',
|
||||
'',
|
||||
'SOAP-ENC:Array',
|
||||
array(),
|
||||
array(
|
||||
array('ref'=>'SOAP-ENC:arrayType', 'wsdl:arrayType'=>'tns:entry_value[]')
|
||||
),
|
||||
'tns:entry_value'
|
||||
);
|
||||
|
||||
$this->serviceClass->registerType(
|
||||
'set_entries_detail_result',
|
||||
'complexType',
|
||||
'struct',
|
||||
'all',
|
||||
'',
|
||||
array(
|
||||
'name_value_lists' => array('name'=>'name_value_lists', 'type'=>'tns:name_value_lists'),
|
||||
)
|
||||
);
|
||||
$this->serviceClass->registerType(
|
||||
'link_names_to_fields_array',
|
||||
'complexType',
|
||||
'array',
|
||||
'',
|
||||
'SOAP-ENC:Array',
|
||||
array(),
|
||||
array(
|
||||
array('ref'=>'SOAP-ENC:arrayType', 'wsdl:arrayType'=>'tns:link_name_to_fields_array[]')
|
||||
),
|
||||
'tns:link_name_to_fields_array'
|
||||
);
|
||||
|
||||
$this->serviceClass->registerType(
|
||||
'link_name_to_fields_array',
|
||||
'complexType',
|
||||
'struct',
|
||||
'all',
|
||||
'',
|
||||
array(
|
||||
'name'=>array('name'=>'name', 'type'=>'xsd:string'),
|
||||
'value'=>array('name'=>'value', 'type'=>'tns:select_fields'),
|
||||
)
|
||||
);
|
||||
|
||||
$this->serviceClass->registerType(
|
||||
'link_value',
|
||||
'complexType',
|
||||
'array',
|
||||
'',
|
||||
'SOAP-ENC:Array',
|
||||
array(),
|
||||
array(
|
||||
array('ref'=>'SOAP-ENC:arrayType', 'wsdl:arrayType'=>'tns:name_value[]')
|
||||
),
|
||||
'tns:name_value'
|
||||
);
|
||||
|
||||
$this->serviceClass->registerType(
|
||||
'link_array_list',
|
||||
'complexType',
|
||||
'array',
|
||||
'',
|
||||
'SOAP-ENC:Array',
|
||||
array(),
|
||||
array(
|
||||
array('ref'=>'SOAP-ENC:arrayType', 'wsdl:arrayType'=>'tns:link_value[]')
|
||||
),
|
||||
'tns:link_value'
|
||||
);
|
||||
|
||||
$this->serviceClass->registerType(
|
||||
'link_name_value',
|
||||
'complexType',
|
||||
'struct',
|
||||
'all',
|
||||
'',
|
||||
array(
|
||||
'name'=>array('name'=>'name', 'type'=>'xsd:string'),
|
||||
'records'=>array('name'=>'records', 'type'=>'tns:link_array_list'),
|
||||
)
|
||||
);
|
||||
|
||||
$this->serviceClass->registerType(
|
||||
'link_list',
|
||||
'complexType',
|
||||
'array',
|
||||
'',
|
||||
'SOAP-ENC:Array',
|
||||
array(),
|
||||
array(
|
||||
array('ref'=>'SOAP-ENC:arrayType', 'wsdl:arrayType'=>'tns:link_name_value[]')
|
||||
),
|
||||
'tns:link_name_value'
|
||||
);
|
||||
|
||||
$this->serviceClass->registerType(
|
||||
'link_lists',
|
||||
'complexType',
|
||||
'array',
|
||||
'',
|
||||
'SOAP-ENC:Array',
|
||||
array(),
|
||||
array(
|
||||
array('ref'=>'SOAP-ENC:arrayType', 'wsdl:arrayType'=>'tns:link_list[]')
|
||||
),
|
||||
'tns:link_list'
|
||||
);
|
||||
|
||||
$this->serviceClass->registerType(
|
||||
'get_entry_result_version2',
|
||||
'complexType',
|
||||
'struct',
|
||||
'all',
|
||||
'',
|
||||
array(
|
||||
'entry_list' => array('name' =>'entry_list', 'type'=>'tns:entry_list'),
|
||||
'relationship_list' => array('name' =>'relationship_list', 'type'=>'tns:link_lists'),
|
||||
)
|
||||
);
|
||||
|
||||
$this->serviceClass->registerType(
|
||||
'return_search_result',
|
||||
'complexType',
|
||||
'struct',
|
||||
'all',
|
||||
'',
|
||||
array(
|
||||
'entry_list' => array('name' =>'entry_list', 'type'=>'tns:link_list'),
|
||||
)
|
||||
);
|
||||
|
||||
$this->serviceClass->registerType(
|
||||
'get_entry_list_result_version2',
|
||||
'complexType',
|
||||
'struct',
|
||||
'all',
|
||||
'',
|
||||
array(
|
||||
'result_count' => array('name'=>'result_count', 'type'=>'xsd:int'),
|
||||
'next_offset' => array('name'=>'next_offset', 'type'=>'xsd:int'),
|
||||
'entry_list' => array('name' =>'entry_list', 'type'=>'tns:entry_list'),
|
||||
'relationship_list' => array('name' =>'relationship_list', 'type'=>'tns:link_lists'),
|
||||
)
|
||||
);
|
||||
|
||||
$this->serviceClass->registerType(
|
||||
'get_server_info_result',
|
||||
'complexType',
|
||||
'struct',
|
||||
'all',
|
||||
'',
|
||||
array(
|
||||
'flavor' => array('name'=>'id', 'type'=>'xsd:string'),
|
||||
'version' => array('name'=>'id', 'type'=>'xsd:string'),
|
||||
'gmt_time' => array('name'=>'id', 'type'=>'xsd:string'),
|
||||
)
|
||||
);
|
||||
|
||||
$this->serviceClass->registerType(
|
||||
'new_set_entry_result',
|
||||
'complexType',
|
||||
'struct',
|
||||
'all',
|
||||
'',
|
||||
array(
|
||||
'id' => array('name'=>'id', 'type'=>'xsd:string'),
|
||||
)
|
||||
);
|
||||
|
||||
$this->serviceClass->registerType(
|
||||
'new_set_entries_result',
|
||||
'complexType',
|
||||
'struct',
|
||||
'all',
|
||||
'',
|
||||
array(
|
||||
'ids' => array('name'=>'ids', 'type'=>'tns:select_fields'),
|
||||
)
|
||||
);
|
||||
|
||||
$this->serviceClass->registerType(
|
||||
'new_set_relationhip_ids',
|
||||
'complexType',
|
||||
'array',
|
||||
'',
|
||||
'SOAP-ENC:Array',
|
||||
array(),
|
||||
array(
|
||||
array('ref'=>'SOAP-ENC:arrayType', 'wsdl:arrayType'=>'tns:select_fields[]')
|
||||
),
|
||||
'tns:select_fields'
|
||||
);
|
||||
|
||||
$this->serviceClass->registerType(
|
||||
'new_set_relationship_list_result',
|
||||
'complexType',
|
||||
'struct',
|
||||
'all',
|
||||
'',
|
||||
array(
|
||||
'created' => array('name'=>'created', 'type'=>'xsd:int'),
|
||||
'failed' => array('name'=>'failed', 'type'=>'xsd:int'),
|
||||
'deleted' => array('name'=>'deleted', 'type'=>'xsd:int'),
|
||||
)
|
||||
);
|
||||
|
||||
$this->serviceClass->registerType(
|
||||
'document_revision',
|
||||
'complexType',
|
||||
'struct',
|
||||
'all',
|
||||
'',
|
||||
array(
|
||||
"id" => array('name'=>"id",'type'=>'xsd:string'),
|
||||
"document_name" => array('name'=>"document_name",'type'=>'xsd:string'),
|
||||
"revision" => array('name' => "revision", 'type'=>'xsd:string'),
|
||||
"filename" => array('name' => "filename", 'type'=>'xsd:string'),
|
||||
"file" => array('name'=>"file",'type'=>'xsd:string'),
|
||||
)
|
||||
);
|
||||
|
||||
$this->serviceClass->registerType(
|
||||
'new_return_document_revision',
|
||||
'complexType',
|
||||
'struct',
|
||||
'all',
|
||||
'',
|
||||
array(
|
||||
"document_revision"=>array('name'=>'document_revision', 'type'=>'tns:document_revision'),
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
$this->serviceClass->registerType(
|
||||
'module_list',
|
||||
'complexType',
|
||||
'struct',
|
||||
'all',
|
||||
'',
|
||||
array(
|
||||
'modules'=>array('name'=>'modules', 'type'=>'tns:select_fields'),
|
||||
)
|
||||
);
|
||||
|
||||
$this->serviceClass->registerType(
|
||||
'get_entries_count_result',
|
||||
'complexType',
|
||||
'struct',
|
||||
'all',
|
||||
'',
|
||||
array(
|
||||
'result_count'=>array('name'=>'result_count', 'type'=>'xsd:int'),
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
$GLOBALS['log']->info('End: registry->registerTypes');
|
||||
|
||||
// END OF REGISTER COMPLEX TYPES
|
||||
} // fn
|
||||
} // clazz
|
||||
48
service/v2/rest.php
Normal file
48
service/v2/rest.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry'))define('sugarEntry', true);
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
/**
|
||||
* This is a rest entry point for rest version 2
|
||||
*/
|
||||
chdir('../..');
|
||||
$webservice_class = 'SugarRestService';
|
||||
$webservice_path = 'service/core/SugarRestService.php';
|
||||
$webservice_impl_class = 'SugarRestServiceImpl';
|
||||
$registry_class = 'registry';
|
||||
$location = '/service/v2/rest.php';
|
||||
$registry_path = 'service/v2/registry.php';
|
||||
require_once('service/core/webservice.php');
|
||||
53
service/v2/soap.php
Normal file
53
service/v2/soap.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry'))define('sugarEntry', true);
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
/**
|
||||
* This is a soap entry point for soap version 2
|
||||
*/
|
||||
chdir('../..');
|
||||
$webservice_class = 'SugarSoapService2';
|
||||
$webservice_path = 'service/v2/SugarSoapService2.php';
|
||||
$registry_class = 'registry';
|
||||
$registry_path = 'service/v2/registry.php';
|
||||
$webservice_impl_class = 'SugarWebServiceImpl';
|
||||
$location = '/service/v2/soap.php';
|
||||
require_once('service/core/webservice.php');
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
86
service/v2_1/SugarWebServiceImplv2_1.php
Normal file
86
service/v2_1/SugarWebServiceImplv2_1.php
Normal file
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry'))define('sugarEntry', true);
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
/**
|
||||
* This class is an implemenatation class for all the rest services
|
||||
*/
|
||||
require_once('service/core/SugarWebServiceImpl.php');
|
||||
|
||||
class SugarWebServiceImplv2_1 extends SugarWebServiceImpl {
|
||||
|
||||
public function __construct(){
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retrieve a list of beans. This is the primary method for getting list of SugarBeans from Sugar using the SOAP API.
|
||||
*
|
||||
* @param String $session -- Session ID returned by a previous call to login.
|
||||
* @param String $module_name -- The name of the module to return records from. This name should be the name the module was developed under (changing a tab name is studio does not affect the name that should be passed into this method)..
|
||||
* @param String $query -- SQL where clause without the word 'where'
|
||||
* @param String $order_by -- SQL order by clause without the phrase 'order by'
|
||||
* @param integer $offset -- The record offset to start from.
|
||||
* @param Array $select_fields -- A list of the fields to be included in the results. This optional parameter allows for only needed fields to be retrieved.
|
||||
* @param Array $link_name_to_fields_array -- A list of link_names and for each link_name, what fields value to be returned. For ex.'link_name_to_fields_array' => array(array('name' => 'email_addresses', 'value' => array('id', 'email_address', 'opt_out', 'primary_address')))
|
||||
* @param integer $max_results -- The maximum number of records to return. The default is the sugar configuration value for 'list_max_entries_per_page'
|
||||
* @param integer $deleted -- false if deleted records should not be include, true if deleted records should be included.
|
||||
* @return Array 'result_count' -- integer - The number of records returned
|
||||
* 'next_offset' -- integer - The start of the next page (This will always be the previous offset plus the number of rows returned. It does not indicate if there is additional data unless you calculate that the next_offset happens to be closer than it should be.
|
||||
* 'entry_list' -- Array - The records that were retrieved
|
||||
* 'relationship_list' -- Array - The records link field data. The example is if asked about accounts email address then return data would look like Array ( [0] => Array ( [name] => email_addresses [records] => Array ( [0] => Array ( [0] => Array ( [name] => id [value] => 3fb16797-8d90-0a94-ac12-490b63a6be67 ) [1] => Array ( [name] => email_address [value] => hr.kid.qa@example.com ) [2] => Array ( [name] => opt_out [value] => 0 ) [3] => Array ( [name] => primary_address [value] => 1 ) ) [1] => Array ( [0] => Array ( [name] => id [value] => 403f8da1-214b-6a88-9cef-490b63d43566 ) [1] => Array ( [name] => email_address [value] => kid.hr@example.name ) [2] => Array ( [name] => opt_out [value] => 0 ) [3] => Array ( [name] => primary_address [value] => 0 ) ) ) ) )
|
||||
* @exception 'SoapFault' -- The SOAP error, if any
|
||||
*/
|
||||
function get_entry_list($session, $module_name, $query, $order_by,$offset, $select_fields, $link_name_to_fields_array, $max_results, $deleted ){
|
||||
$result = parent::get_entry_list($session, $module_name, $query, $order_by,$offset, $select_fields, $link_name_to_fields_array, $max_results, $deleted );
|
||||
$relationshipList = $result['relationship_list'];
|
||||
$returnRelationshipList = array();
|
||||
foreach($relationshipList as $rel){
|
||||
$link_output = array();
|
||||
foreach($rel as $row){
|
||||
$rowArray = array();
|
||||
foreach($row['records'] as $record){
|
||||
$rowArray[]['link_value'] = $record;
|
||||
}
|
||||
$link_output[] = array('name' => $row['name'], 'records' => $rowArray);
|
||||
}
|
||||
$returnRelationshipList[]['link_list'] = $link_output;
|
||||
}
|
||||
$result['relationship_list'] = $returnRelationshipList;
|
||||
return $result;
|
||||
} // fn
|
||||
}
|
||||
132
service/v2_1/registry.php
Normal file
132
service/v2_1/registry.php
Normal file
@@ -0,0 +1,132 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry'))define('sugarEntry', true);
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
require_once('service/v2/registry.php'); //Extend off of v2 registry
|
||||
|
||||
class registry_v2_1 extends registry {
|
||||
|
||||
/**
|
||||
* This method registers all the functions on the service class
|
||||
*
|
||||
*/
|
||||
protected function registerFunction() {
|
||||
|
||||
$GLOBALS['log']->info('Begin: registry->registerFunction');
|
||||
parent::registerFunction();
|
||||
|
||||
$GLOBALS['log']->info('END: registry->registerFunction');
|
||||
|
||||
// END OF REGISTER FUNCTIONS
|
||||
}
|
||||
|
||||
/**
|
||||
* This method registers all the complex types
|
||||
*
|
||||
*/
|
||||
protected function registerTypes() {
|
||||
|
||||
parent::registerTypes();
|
||||
|
||||
$this->serviceClass->registerType(
|
||||
'link_list2',
|
||||
'complexType',
|
||||
'struct',
|
||||
'all',
|
||||
'',
|
||||
array(
|
||||
'link_list'=>array('name'=>'link_list', 'type'=>'tns:link_list'),
|
||||
)
|
||||
);
|
||||
|
||||
$this->serviceClass->registerType(
|
||||
'link_lists',
|
||||
'complexType',
|
||||
'array',
|
||||
'',
|
||||
'SOAP-ENC:Array',
|
||||
array(),
|
||||
array(
|
||||
array('ref'=>'SOAP-ENC:arrayType', 'wsdl:arrayType'=>'tns:link_list2[]')
|
||||
),
|
||||
'tns:link_list2'
|
||||
);
|
||||
|
||||
$this->serviceClass->registerType(
|
||||
'link_array_list',
|
||||
'complexType',
|
||||
'array',
|
||||
'',
|
||||
'SOAP-ENC:Array',
|
||||
array(),
|
||||
array(
|
||||
array('ref'=>'SOAP-ENC:arrayType', 'wsdl:arrayType'=>'tns:link_value2[]')
|
||||
),
|
||||
'tns:link_value2'
|
||||
);
|
||||
|
||||
$this->serviceClass->registerType(
|
||||
'link_value2',
|
||||
'complexType',
|
||||
'struct',
|
||||
'all',
|
||||
'',
|
||||
array(
|
||||
'link_value'=>array('name'=>'link_value', 'type'=>'tns:link_value'),
|
||||
)
|
||||
);
|
||||
$this->serviceClass->registerType(
|
||||
'field_list2',
|
||||
'complexType',
|
||||
'struct',
|
||||
'all',
|
||||
'',
|
||||
array(
|
||||
"field_list"=>array('name'=>'field_list', 'type'=>'tns:field_list'),
|
||||
)
|
||||
);
|
||||
$this->serviceClass->registerType(
|
||||
'entry_list2',
|
||||
'complexType',
|
||||
'struct',
|
||||
'all',
|
||||
'',
|
||||
array(
|
||||
"entry_list"=>array('name'=>'entry_list', 'type'=>'tns:entry_list'),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
49
service/v2_1/rest.php
Normal file
49
service/v2_1/rest.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry'))define('sugarEntry', true);
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
/**
|
||||
* This is a rest entry point for rest version 3.1
|
||||
*/
|
||||
chdir('../..');
|
||||
require_once('SugarWebServiceImplv2_1.php');
|
||||
$webservice_class = 'SugarRestService';
|
||||
$webservice_path = 'service/core/SugarRestService.php';
|
||||
$webservice_impl_class = 'SugarWebServiceImplv2_1';
|
||||
$registry_class = 'registry_v2_1';
|
||||
$location = '/service/v2_1/rest.php';
|
||||
$registry_path = 'service/v2_1/registry.php';
|
||||
require_once('service/core/webservice.php');
|
||||
49
service/v2_1/soap.php
Normal file
49
service/v2_1/soap.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
if(!defined('sugarEntry'))define('sugarEntry', true);
|
||||
/*********************************************************************************
|
||||
* SugarCRM is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||
* Free Software Foundation with the addition of the following permission added
|
||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License along with
|
||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA.
|
||||
*
|
||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of this program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU Affero General Public License version 3.
|
||||
*
|
||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||
* technical reasons, the Appropriate Legal Notices must display the words
|
||||
* "Powered by SugarCRM".
|
||||
********************************************************************************/
|
||||
|
||||
/**
|
||||
* This is a soap entry point for soap version 3
|
||||
*/
|
||||
chdir('../..');
|
||||
require_once('SugarWebServiceImplv2_1.php');
|
||||
$webservice_class = 'SugarSoapService2';
|
||||
$webservice_path = 'service/v2/SugarSoapService2.php';
|
||||
$registry_class = 'registry_v2_1';
|
||||
$registry_path = 'service/v2_1/registry.php';
|
||||
$webservice_impl_class = 'SugarWebServiceImplv2_1';
|
||||
$location = '/service/v2_1/soap.php';
|
||||
require_once('service/core/webservice.php');
|
||||
Reference in New Issue
Block a user