Example #1
0
 /**
  * Dispatch request to SOAP endpoint.
  *
  * @return Mage_Webapi_Controller_Dispatcher_Soap
  */
 public function dispatch()
 {
     try {
         if ($this->_request->getParam(Mage_Webapi_Model_Soap_Server::REQUEST_PARAM_WSDL) !== null) {
             $responseBody = $this->_autoDiscover->handle($this->_request->getRequestedResources(), $this->_soapServer->generateUri());
             $this->_setResponseContentType('text/xml');
         } else {
             $responseBody = $this->_initSoapServer()->handle();
             $this->_setResponseContentType('application/soap+xml');
         }
         $this->_setResponseBody($responseBody);
     } catch (Exception $e) {
         $maskedException = $this->_errorProcessor->maskException($e);
         $this->_processBadRequest($maskedException->getMessage());
     }
     $this->_response->sendResponse();
     return $this;
 }
Example #2
0
 /**
  * Test handle method with exception.
  */
 public function testHandleWithException()
 {
     /** Mock cache canUse method to return false. */
     $this->_cacheMock->expects($this->once())->method('canUse')->will($this->returnValue(false));
     $requestedResources = array('res1' => 'v1');
     $exception = new LogicException('getResourceDataMerged Exception');
     $this->_resourceConfigMock->expects($this->once())->method('getResourceDataMerged')->will($this->throwException($exception));
     $this->setExpectedException('Mage_Webapi_Exception', 'getResourceDataMerged Exception', Mage_Webapi_Exception::HTTP_BAD_REQUEST);
     $this->_autoDiscover->handle($requestedResources, 'http://magento.host');
 }