/** * Load that WSDL file * * @param $wsdlURL * @return string * @throws \Exception */ protected function loadWSDL($wsdlURL) { // Get a SHA1 hash of the full WSDL url to use as the cache filename $wsdlName = sha1(strtolower($wsdlURL)); // Get the runtime soap cache configuration $soapCache = ini_get('soap.wsdl_cache_enabled'); // Get the passed in cache parameter, if there is one. if (isset($this->options['cache_wsdl'])) { $optCache = $this->options['cache_wsd']; } else { $optCache = null; } // By default defer to the global cache value $cache = $soapCache != '0' ? true : false; // If they specifically pass in a cache value, use it. if ($optCache !== null) { switch ($optCache) { case WSDL_CACHE_MEMORY: throw new \Exception('WSDL_CACHE_MEMORY is not yet supported by SoapPlus'); case WSDL_CACHE_BOTH: throw new \Exception('WSDL_CACHE_BOTH is not yet supported by SoapPlus'); case WSDL_CACHE_DISK: $cache = true; break; case WSDL_CACHE_NONE: $cache = false; break; } } // If cache === true, attempt to load from cache. if ($cache === true) { $path = $this->loadWSDLFromCache($wsdlName); if ($path !== null) { return $path; } } // Otherwise move on! // First, load the wsdl $this->curlPlusClient->setRequestUrl($wsdlURL); $this->curlPlusClient->setCurlOpts($this->curlOptArray); $response = $this->curlPlusClient->execute(true); // Check for error if ($response->getHttpCode() != 200 || $response->getResponse() === false) { throw new \Exception('SoapClientPlus - Error thrown while trying to retrieve WSDL file: "' . $response->getError() . '"'); } // If caching is enabled, go ahead and return the file path value if ($cache === true) { return $this->createWSDLCache($wsdlName, trim((string) $response)); } // Else create a "temp" file and return the file path to it. $path = $this->createWSDLTempFile($wsdlName, trim((string) $response)); return $path; }