/** * Constructor - create a JRON RPC proxy based on the full pathname of * an SMD file * * @param string $target Target URI * @param string $base_path_for_relative_paths Base path * @param string $binding_config Config */ public function __construct($target, $base_path_for_relative_paths, $binding_config) { SCA::$logger->log('Entering'); $this->smd_file_name = SCA_Helper::constructAbsoluteTarget($target, $base_path_for_relative_paths); $this->jsonrpc_client = new SCA_JsonRpcClient($this->smd_file_name); SCA::$logger->log('Exiting'); }
/** * Constructor - create an XML RPC proxy * If a relative path is specified for URL, it will be resolved to an URL relative * to PHP_SELF. The proxy adds /RPC2 as PATH_INFO to the service url. * * @param string $target URL of XMLRPC service * @param string $base_path_for_relative_paths Base path * @param string $binding_config Config */ public function __construct($target, $base_path_for_relative_paths, $binding_config) { $serviceUrl = SCA_Helper::constructAbsoluteTarget($target, $base_path_for_relative_paths); SCA::$logger->log("Proxy serviceUrl {$serviceUrl}"); if (!strstr($serviceUrl, "/RPC2")) { $this->service_url = $serviceUrl . "/RPC2"; } else { $this->service_url = $serviceUrl; } SCA::$logger->log("URL {$this->service_url}"); try { $methodDesc = $this->__call("system.describeMethods", array()); $this->method_list = array(); $methodList = array(); $typeList = array(); foreach ($methodDesc["methodList"] as $method) { $methodList[$method["name"]] = $method; } foreach ($methodDesc["typeList"] as $type) { $typeList[$type["name"]] = $type; } $this->method_list["methodList"] = $methodList; $this->method_list["typeList"] = $typeList; } catch (SCA_RuntimeException $e) { // The server probably does not support system.describeMethods // Ignore the exception, and attempt to make calls using generic types } }
/** * Create the local proxy to the service given as an argument. * * @param string $target Target URI * @param string $base_path_for_relative_paths Path * @param mixed $binding_config Config */ public function __construct($target, $base_path_for_relative_paths, $binding_config) { $absolute_path_to_component = SCA_Helper::constructAbsoluteTarget($target, $base_path_for_relative_paths); $this->component_class_name = SCA_Helper::guessClassName($absolute_path_to_component); if (!class_exists($this->component_class_name, false)) { include_once "{$absolute_path_to_component}"; } $this->instance_of_the_component = SCA::createInstance($this->component_class_name); SCA::fillInReferences($this->instance_of_the_component); }
/** * Constructor */ public function __construct($path_to_msd, $immediate_caller_directory, $binding_config) { SCA::$logger->log('entering'); //check if SAM extensions is loaded if (!in_array('sam', get_loaded_extensions())) { throw new SCA_RuntimeException("The SAM extension must be loaded"); } if ($binding_config === null) { $binding_config = array(); } $binding_config['msd'] = $path_to_msd; /*parse MSD file */ $msd_config = SCA_Bindings_message_ServiceDescriptionGenerator::parseBindingConfig($binding_config); if (isset($msd_config->responseTimeout)) { $this->waitResponseTimeout = $msd_config->responseTimeout; } if (!isset($msd_config->wsdl)) { throw new SCA_RuntimeException("Path to WSDL file is required to the binding configuration,\n or the 'wsdl' property should be stated as 'disabled' explicitly."); } else { /*check if wsdl is disabled, if not the wsdl schema will be loaded */ if ($msd_config->wsdl != 'disabled') { $path_to_wsdl = SCA_Helper::constructAbsoluteTarget($msd_config->wsdl, $immediate_caller_directory); SCA::$logger->log('The proxy will use wsdl file :' . $path_to_wsdl); $this->mapper = new SCA_Bindings_message_Mapper(); try { $this->mapper->setWSDLTypes($path_to_wsdl); //$xmldas = $this->mapper->getXmlDas(); } catch (SCA_RuntimeException $se) { if (substr($path_to_wsdl, 0, 5) == 'http:' && strpos($se->getMessage(), 'SDO_Exception') !== false && strpos($se->getMessage(), 'Unable to parse') !== false && strpos($se->getMessage(), 'Document is empty') !== false) { throw new SCA_RuntimeException('A call to SCA specified a URL: ' . $path_to_wsdl . " The document returned was empty. One explanation for this may be apache bug 39662. See http://issues.apache.org/bugzilla/show_bug.cgi?id=36692. You may need to obtain the WSDL in a browser and save it as a local file."); } throw $se; } } } /*create and config a SAM client*/ $this->ms_client = new SCA_Bindings_message_SAMClient($this); $this->ms_client->config($msd_config); SCA::$logger->log('SAM is ready'); }
/** * Proxy * * @param string $target Target * @param string $base_path_for_relative_paths Base path * @param array $binding_config Config */ public function __construct($target, $base_path_for_relative_paths, $binding_config) { SCA::$logger->log('Entering'); SCA_Helper::checkSoapExtensionLoaded(); $absolute_path_to_target_wsdl = SCA_Helper::constructAbsoluteTarget($target, $base_path_for_relative_paths); // Store the location now see subsequent sets will override it $this->config = $binding_config; if ($this->config !== null && key_exists('location', $this->config)) { $this->__setLocation($this->config['location']); } /* Catch trigger_errors from Mapper */ $this->previousErrorHandler = set_error_handler('errorHandler'); //TODO recast these two lines into a call to the constructor. $this->handler = new $this->sdo_type_handler_class_name("SoapClient"); try { $this->handler->setWSDLTypes($absolute_path_to_target_wsdl); //$xmldas = $this->handler->getXmlDas(); } catch (SCA_RuntimeException $se) { if (substr($absolute_path_to_target_wsdl, 0, 5) == 'http:' && strpos($se->getMessage(), 'SDO_Exception') !== false && strpos($se->getMessage(), 'Unable to parse') !== false && strpos($se->getMessage(), 'Document is empty') !== false) { throw new SCA_RuntimeException('A call to SCA specified a URL: ' . $absolute_path_to_target_wsdl . " The document returned was empty. One explanation for this may be apache bug 39662. See http://issues.apache.org/bugzilla/show_bug.cgi?id=36692. You may need to obtain the WSDL in a browser and save it as a local file."); } throw $se; } try { parent::__construct($absolute_path_to_target_wsdl, array("trace" => 1, "exceptions" => 1, 'typemap' => $this->handler->getTypeMap())); } catch (Exception $e) { throw new SCA_RuntimeException("Creation of Soap Client for target {$absolute_path_to_target_wsdl} failed."); } $this->wsdl_file_name = $absolute_path_to_target_wsdl; }
/** * Proxy constructor * * @param string $target Target URI * @param string $base_path_for_relative_paths Base path * @param string $binding_config Config */ public function __construct($target, $base_path_for_relative_paths, $binding_config) { SCA::$logger->log("Entering constructor"); $this->target_url = SCA_Helper::constructAbsoluteTarget($target, $base_path_for_relative_paths); SCA::$logger->log("Exiting constructor"); }