/** * Is service request? * * @param string $calling_component_filename Filename * * @return bool */ public function isServiceRequest($calling_component_filename) { SCA_Helper::checkSoapExtensionLoaded(); if (isset($_SERVER['HTTP_HOST'])) { if ($_SERVER['REQUEST_METHOD'] == 'POST') { if (isset($_SERVER['PATH_INFO']) && $_SERVER['PATH_INFO'] == '/RPC2') { return false; // looks like it is XmlRpc, not SOAP } $p1 = realpath($calling_component_filename); $p2 = realpath($_SERVER['SCRIPT_FILENAME']); if ($p1 == $p2 && (strpos($_SERVER['CONTENT_TYPE'], 'text/xml') !== false || strpos($_SERVER['CONTENT_TYPE'], 'soap') !== false)) { return true; } } } return false; }
/** * 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; }