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