Ejemplo n.º 1
0
 public function testLoadWsdl()
 {
     $url = 'http://test.local';
     $path = $this->manager->getCachedWsdlPath($url);
     $wsdl = 'WSDL';
     $this->assertLoadWsdl($wsdl, $url, $path);
     $this->assertEquals($path, $this->manager->loadWsdl($url));
 }
Ejemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function init(Transport $transportEntity)
 {
     /**
      * Cache WSDL and force transport entity to use it instead of original URL.
      * This should be done before parent::init as settings will be cached there.
      */
     if ($transportEntity instanceof MagentoSoapTransport) {
         $wsdlUrl = $transportEntity->getWsdlUrl();
         // Save auth information to be able to perform requests.
         $urlParts = parse_url($wsdlUrl);
         if (isset($urlParts['user'], $urlParts['pass'])) {
             $this->auth['login'] = $urlParts['user'];
             $this->auth['password'] = $urlParts['pass'];
         }
         // Load WSDL to local cache.
         if (!$this->wsdlManager->isCacheLoaded($wsdlUrl)) {
             $this->wsdlManager->loadWsdl($wsdlUrl);
         }
         // Set cached WSDL path to transport entity.
         $transportEntity->setWsdlCachePath($this->wsdlManager->getCachedWsdlPath($wsdlUrl));
     }
     parent::init($transportEntity);
     $wsiMode = $this->settings->get('wsi_mode', false);
     $apiUser = $this->settings->get('api_user', false);
     $apiKey = $this->settings->get('api_key', false);
     $apiKey = $this->encoder->decryptData($apiKey);
     if (!$apiUser || !$apiKey) {
         throw new InvalidConfigurationException("Magento SOAP transport require 'api_key' and 'api_user' settings to be defined.");
     }
     // revert initial state
     $this->isExtensionInstalled = null;
     $this->adminUrl = null;
     $this->isWsiMode = $wsiMode;
     /** @var string sessionId returned by Magento API login method */
     $this->sessionId = null;
     $this->sessionId = $this->call('login', ['username' => $apiUser, 'apiKey' => $apiKey]);
     $this->checkExtensionFunctions();
 }