function NusoapResponse() { // force to set global variable $debug // before calling parent constructor $GLOBALS['debug'] = $this->mDebugMode; parent::soap_server(); $this->configureWsdl(__CLASS__ . 'Service', FALSE, $this->mEndpoint); $this->mrDispatcher = Dispatcher::Instance(); $this->mrSecurity = Security::Instance(); $this->mrSession = Session::Instance(); if (!empty($this->mRegisteredFunctions)) { foreach ($this->mRegisteredFunctions as $func_name => $params) { if (is_array($params) && $params != NULL) { $this->register($func_name, $params['in'], $params['out'], $params['namespace'], $params['soapaction'], $params['style'], $params['use'], $params['documentation'], $params['encodingStyle']); } else { $this->register($func_name); } } } if (!empty($this->mRegisteredTypes)) { foreach ($this->mRegisteredTypes as $type_name => $params) { if (is_array($params) && count($params) > 0) { if ($params['type'] == 'complexType' && $params['phptype'] != 'scalar') { $this->wsdl->addComplexType($type_name, $params['type'], $params['phptype'], $params['compositor'], $params['restrictionBase'], $params['elements'], $params['attrs'], $params['arraytype']); } else { $this->wsdl->addSimpleType($type_name, $params['type'], $params['phptype'], $params['compositor'], $params['restrictionBase'], $params['elements'], $params['attrs'], $params['arraytype']); } } else { $this->register($func_name); } } } $this->wsdl->addComplexType('ListType', 'complexType', 'array'); $this->wsdl->addComplexType('AgmListType', 'complexType', 'array', '', 'SOAP-ENC:Array', array(), array(array('ref' => 'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'xsd:integer[]')), 'xsd:integer'); }
private function __construct() { parent::soap_server(); parent::__construct(); // instantiate wsdl cache manager $this->mUseWsdlCache = (bool) Configuration::Instance()->GetValue('application', 'wsdl_use_cache'); $this->mWsdlCachePath = file_exists(Configuration::Instance()->GetValue('application', 'wsdl_cache_path')) ? Configuration::Instance()->GetValue('application', 'wsdl_cache_path') : Configuration::Instance()->GetTempDir(); $this->mWsdlCacheLifetime = Configuration::Instance()->GetValue('application', 'wsdl_cache_lifetime') != '' ? (int) Configuration::Instance()->GetValue('application', 'wsdl_cache_lifetime') : 60 * 60 * 24; // defaults to 1 day $this->configureWsdl('WsdlPortal', FALSE, Configuration::Instance()->GetValue('application', 'baseaddress') . Configuration::Instance()->GetValue('application', 'basedir') . 'wsdl.php?getlist'); // always registering default service $this->RegisterDefaultService(); }
function __construct() { // force to set global variable $debug // before calling parent constructor $GLOBALS['debug'] = $this->mDebugMode; parent::soap_server($this->mWsdlFile); // to support SoapGatewayBase // -------------------------- if (!$this->mWsdlFile && !empty($this->mRegisteredFunctions)) { foreach ($this->mRegisteredFunctions as $func_name => $params) { if (is_array($params) && $params != NULL) { $this->register($func_name, $params['in'], $params['out'], $params['namespace'], $params['soapaction'], $params['style'], $params['use'], $params['documentation'], $params['encodingStyle']); } else { $this->register($func_name); } } } /////////// if (!$this->mWsdlFile && empty($this->mRegisteredFunctions)) { // doing magic here... avrakedavra! // $mServiceDescriptions is a static property, so it won't be inherited // as the result, we must do some tricks here. first we find what class is // being instantiated (from the dispatcher, of course. mmm.. no, no, use // get_class instead. it's definitly more efficient). then we use that // information to obtain the actual $mServiceDescriptions // see note about $mServiceDescriptions above for another information $class_name = get_class($this); eval('$service_description = ' . $class_name . '::$mServiceDescriptions;'); if (!empty($service_description)) { // get default binding style eval('$default_style = ' . $class_name . '::$mServiceBindingStyle;'); // setting up wsdl $this->configureWSDL($class_name, FALSE, Configuration::Instance()->GetValue('application', 'baseaddress') . Dispatcher::Instance()->GetUrl(Dispatcher::Instance()->mModule, Dispatcher::Instance()->mSubModule, Dispatcher::Instance()->mAction, Dispatcher::Instance()->mType, TRUE), $default_style); // register functions to be exposed as service if (isset($service_description['service']) && is_array($service_description['service'])) { foreach ($service_description['service'] as $func_name => $params) { // skip undeclared fuctions if (!method_exists($this, 'Service' . $func_name)) { continue; } if (is_array($params) && $params != NULL) { $this->register($func_name, $params['in'], $params['out'], $params['namespace'], $params['soapaction'], $params['style'], $params['use'], $params['documentation'], $params['encodingStyle']); } else { $this->register($func_name); } } } // register types used in services if (isset($service_description['type']) && is_array($service_description['type'])) { foreach ($service_description['type'] as $type_name => $params) { if (is_array($params) && $params != NULL) { if ($params['typeClass'] == 'complexType' || $params['typeClass'] == 'attribute') { $this->wsdl->addComplexType($type_name, $params['typeClass'], $params['phpType'], $params['compositor'], $params['restrictionBase'], $params['elements'], $params['attrs'], $params['arrayType']); } else { if ($params['typeClass'] == 'simpleType') { // always scalar $this->wsdl->addSimpleType($type_name, $params['restrictionBase'], $params['typeClass'], 'scalar', $params['enumeration']); } } } } } } } }
/** * Constructor. * The optional parameter is a path to a WSDL file that you'd like to bind the * server instance to. * * @param mixed file path or URL (string), or wsdl instance (object) * * @return void */ function DelegatingSoapServer(&$delegate, $wsdl = FALSE) { parent::soap_server($wsdl); $this->delegate =& $delegate; }