/** * Set body and status code to response using information extracted from provided exception. * * @param \Exception $exception * @return void */ protected function _prepareErrorResponse($exception) { $maskedException = $this->_errorProcessor->maskException($exception); if ($this->_isWsdlRequest()) { $httpCode = $maskedException->getHttpCode(); $contentType = self::CONTENT_TYPE_WSDL_REQUEST; } else { $httpCode = Response::HTTP_OK; $contentType = self::CONTENT_TYPE_SOAP_CALL; } $this->_setResponseContentType($contentType); $this->_response->setHttpResponseCode($httpCode); $soapFault = new \Magento\Webapi\Model\Soap\Fault($this->_request, $this->_soapServer, $maskedException, $this->_localeResolver, $this->_appState); // TODO: Generate list of available URLs when invalid WSDL URL specified $this->_setResponseBody($soapFault->toXml()); }