Пример #1
0
 /**
  * Dispatch SOAP request.
  *
  * @param \Magento\Framework\App\RequestInterface $request
  * @return \Magento\Framework\App\ResponseInterface
  */
 public function dispatch(\Magento\Framework\App\RequestInterface $request)
 {
     $path = $this->_pathProcessor->process($request->getPathInfo());
     $this->_request->setPathInfo($path);
     $this->areaList->getArea($this->_appState->getAreaCode())->load(\Magento\Framework\App\Area::PART_TRANSLATE);
     try {
         if (!$this->_appState->isInstalled()) {
             throw new WebapiException(__('Magento is not yet installed'));
         }
         if ($this->_isWsdlRequest()) {
             $responseBody = $this->_wsdlGenerator->generate($this->_request->getRequestedServices(), $this->_soapServer->generateUri());
             $this->_setResponseContentType(self::CONTENT_TYPE_WSDL_REQUEST);
             $this->_setResponseBody($responseBody);
         } else {
             $consumerId = $this->_oauthService->validateAccessToken($this->_getAccessToken());
             $this->_request->setConsumerId($consumerId);
             $this->_soapServer->handle();
         }
     } catch (\Exception $e) {
         $this->_prepareErrorResponse($e);
     }
     return $this->_response;
 }