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
 /**
  * Assert service node is present in xml.
  *
  * @return DOMElement
  */
 protected function _assertServiceNode()
 {
     /** @var DOMElement $service */
     $service = $this->_dom->getElementsByTagNameNS(Wsdl::WSDL_NS_URI, 'service')->item(0);
     $this->assertNotNull($service, 'service node not found in WSDL.');
     $this->assertTrue($service->hasAttribute('name'));
     $this->assertEquals($this->_autoDiscover->getServiceName($this->_resourceName), $service->getAttribute('name'));
     $this->_assertPortNode($service, $this->_resourceName);
 }
Example #3
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');
 }