/** * Generate WSDL file based on requested services (uses cache) * * @param array $requestedServices * @param string $endPointUrl * @return string * @throws \Exception */ public function generate($requestedServices, $endPointUrl) { /** Sort requested services by names to prevent caching of the same wsdl file more than once. */ ksort($requestedServices); $cacheId = self::WSDL_CACHE_ID . hash('md5', serialize($requestedServices)); $cachedWsdlContent = $this->_cache->load($cacheId); if ($cachedWsdlContent !== false) { return $cachedWsdlContent; } $services = array(); foreach ($requestedServices as $serviceName) { $services[$serviceName] = $this->_apiConfig->getServiceMetadata($serviceName); } $wsdlContent = $this->_generate($services, $endPointUrl); $this->_cache->save($wsdlContent, $cacheId, array(\Magento\Webapi\Model\Cache\Type::CACHE_TAG)); return $wsdlContent; }
/** * Generate WSDL file based on requested services (uses cache) * * @param array $requestedServices * @param string $endPointUrl * @return string * @throws \Exception */ public function generate($requestedServices, $endPointUrl) { /** Sort requested services by names to prevent caching of the same wsdl file more than once. */ ksort($requestedServices); $currentStore = $this->storeManager->getStore(); $cacheId = self::WSDL_CACHE_ID . hash('md5', serialize($requestedServices) . $currentStore->getCode()); $cachedWsdlContent = $this->_cache->load($cacheId); if ($cachedWsdlContent !== false) { return $cachedWsdlContent; } $services = []; foreach ($requestedServices as $serviceName) { $services[$serviceName] = $this->_apiConfig->getServiceMetadata($serviceName); } $wsdlContent = $this->_generate($services, $endPointUrl); $this->_cache->save($wsdlContent, $cacheId, [\Magento\Framework\App\Cache\Type\Webapi::CACHE_TAG]); return $wsdlContent; }
public function testGetServiceMetadata() { $expectedResult = ['methods' => ['activate' => ['method' => 'activate', 'inputRequired' => '', 'isSecure' => '', 'resources' => [['Magento_Customer::manage']]]], 'class' => 'Magento\\Customer\\Api\\AccountManagementInterface']; $result = $this->_soapConfig->getServiceMetadata('customerAccountManagementV1'); $this->assertEquals($expectedResult, $result); }