TransWikia.com

SoapFault exception: [1] Internal Error after upgrading to magento 1.9.3

Magento Asked by Sid on November 12, 2020

After upgrading to Magento 1.9.3, I am having loads of problem, currently I am having the above error.

After looking at the exception log here is what I find:

SoapFault exception: [1] Internal Error. Please see log for details.

in /home1/mysitename/public_html/mysitefolder/app/code/core/Mage/Api/Model/Server/Adapter/Soap.php:196
Stack trace:

0
/home1/mysitename/public_html/mysitefolder/app/code/core/Mage/Api/Model/Server/Handler/Abstract.php(140):
Mage_Api_Model_Server_Adapter_Soap->fault(‘1’, ‘Internal Error….’)

1
/home1/mysitename/public_html/mysitefolder/app/code/core/Mage/Api/Model/Server/Handler/Abstract.php(48):
Mage_Api_Model_Server_Handler_Abstract->_fault(‘internal’)

2
/home1/mysitename/public_html/mysitefolder/app/code/core/Mage/Api/Model/Server/Handler/Abstract.php(559):
Mage_Api_Model_Server_Handler_Abstract->handlePhpError(4096, ‘Argument
1 pass…’, ‘/home1/mysitename…’, 559, Array)

3
/home1/mysitename/public_html/mysitefolder/app/code/core/Mage/Api/Model/Server/Handler/Abstract.php(299):
Mage_Api_Model_Server_Handler_Abstract->processingMethodResult(‘default’)

4
/home1/mysitename/public_html/mysitefolder/app/code/core/Mage/Api/Model/Server/Wsi/Handler.php(78):
Mage_Api_Model_Server_Handler_Abstract->call(’20dc1668276687a…’,
‘linnLive.getSto…’, Array)

5 [internal function]:
Mage_Api_Model_Server_WSI_Handler->__call(‘linnLiveGetStor…’, Array)

6 [internal function]:
Mage_Api_Model_Server_WSI_Handler->linnLiveGetStoreCode(Object(stdClass))

7
/home1/mysitename/public_html/mysitefolder/lib/Zend/Soap/Server.php(889):
SoapServer->handle(‘xEFxBBxBF

8
/home1/mysitename/public_html/mysitefolder/app/code/core/Mage/Api/Model/Server/Wsi/Adapter/Soap.php(98):
Zend_Soap_Server->handle()

9
/home1/mysitename/public_html/mysitefolder/app/code/core/Mage/Api/Model/Server.php(138):
Mage_Api_Model_Server_WSI_Adapter_Soap->run()

10
/home1/mysitename/public_html/mysitefolder/app/code/core/Mage/Api/controllers/V2/SoapController.php(46):
Mage_Api_Model_Server->run()

11
/home1/mysitename/public_html/mysitefolder/app/code/core/Mage/Core/Controller/Varien/Action.php(418):
Mage_Api_V2_SoapController->indexAction()

12
/home1/mysitename/public_html/mysitefolder/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254):
Mage_Core_Controller_Varien_Action->dispatch(‘index’)

13
/home1/mysitename/public_html/mysitefolder/app/code/core/Mage/Core/Controller/Varien/Front.php(172):
Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))

14
/home1/mysitename/public_html/mysitefolder/app/code/core/Mage/Core/Model/App.php(365):
Mage_Core_Controller_Varien_Front->dispatch()

15 /home1/mysitename/public_html/mysitefolder/app/Mage.php(684):
Mage_Core_Model_App->run(Array)

16 /home1/mysitename/public_html/mysitefolder/index.php(83):
Mage::run(”, ‘store’)

17 {main}

Below is soap.php

class Mage_Api_Model_Server_Adapter_Soap
extends Varien_Object
implements Mage_Api_Model_Server_Adapter_Interface

{
/**
* Wsdl config
*
* @var Varien_Object
*/
protected $wsdlConfig = null;

/**
 * Soap server
 *
 * @var SoapServer
 */
protected $_soap = null;

/**
 * Internal constructor
 */
protected function _construct()
{
    $this->wsdlConfig = $this->_getWsdlConfig();
}

/**
 * Get wsdl config
 *
 * @return Varien_Object
 */
protected function _getWsdlConfig()
{
    $wsdlConfig = new Varien_Object();
    $queryParams = $this->getController()->getRequest()->getQuery();
    if (isset($queryParams['wsdl'])) {
        unset($queryParams['wsdl']);
    }

    $wsdlConfig->setUrl(htmlspecialchars(Mage::getUrl('*/*/*', array('_query'=>$queryParams))));
    $wsdlConfig->setName('Magento');
    $wsdlConfig->setHandler($this->getHandler());
    return $wsdlConfig;
}

/**
 * Set handler class name for webservice
 *
 * @param string $handler
 * @return Mage_Api_Model_Server_Adapter_Soap
 */
public function setHandler($handler)
{
    $this->setData('handler', $handler);
    return $this;
}

/**
 * Retrive handler class name for webservice
 *
 * @return string
 */
public function getHandler()
{
    return $this->getData('handler');
}

/**
 * Set webservice api controller
 *
 * @param Mage_Api_Controller_Action $controller
 * @return Mage_Api_Model_Server_Adapter_Soap
 */
public function setController(Mage_Api_Controller_Action $controller)
{
     $this->setData('controller', $controller);
     return $this;
}

/**
 * Retrive webservice api controller. If no controller have been set - emulate it by the use of Varien_Object
 *
 * @return Mage_Api_Controller_Action|Varien_Object
 */
public function getController()
{
    $controller = $this->getData('controller');

    if (null === $controller) {
        $controller = new Varien_Object(
            array('request' => Mage::app()->getRequest(), 'response' => Mage::app()->getResponse())
        );

        $this->setData('controller', $controller);
    }
    return $controller;
}

/**
 * Run webservice
 *
 * @param Mage_Api_Controller_Action $controller
 * @return Mage_Api_Model_Server_Adapter_Soap
 */
public function run()
{
    $apiConfigCharset = Mage::getStoreConfig("api/config/charset");

    if ($this->getController()->getRequest()->getParam('wsdl') !== null) {
        // Generating wsdl content from template
        $io = new Varien_Io_File();
        $io->open(array('path'=>Mage::getModuleDir('etc', 'Mage_Api')));

        $wsdlContent = $io->read('wsdl.xml');

        $template = Mage::getModel('core/email_template_filter');

        $template->setVariables(array('wsdl' => $this->wsdlConfig));

        $this->getController()->getResponse()
            ->clearHeaders()
            ->setHeader('Content-Type','text/xml; charset='.$apiConfigCharset)
            ->setBody(
                preg_replace(
                    '/<?xml version="([^"]+)"([^>]+)>/i',
                    '<?xml version="$1" encoding="'.$apiConfigCharset.'"?>',
                    $template->filter($wsdlContent)
                )
            );
    } else {
        try {
            $this->_instantiateServer();

            $this->getController()->getResponse()
                ->clearHeaders()
                ->setHeader('Content-Type','text/xml; charset='.$apiConfigCharset)
                ->setBody(
                        preg_replace(
                            '/<?xml version="([^"]+)"([^>]+)>/i',
                            '<?xml version="$1" encoding="'.$apiConfigCharset.'"?>',
                            $this->_soap->handle()
                        )
                );
        } catch( Zend_Soap_Server_Exception $e ) {
            $this->fault( $e->getCode(), $e->getMessage() );
        } catch( Exception $e ) {
            $this->fault( $e->getCode(), $e->getMessage() );
        }
    }

    return $this;
}

/**
 * Dispatch webservice fault
 *
 * @param int $code
 * @param string $message
 */
public function fault($code, $message)
{
    if ($this->_extensionLoaded()) {
        throw new SoapFault($code, $message);
    } else {
        die('<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
            <SOAP-ENV:Body>
            <SOAP-ENV:Fault>
            <faultcode>' . $code . '</faultcode>
            <faultstring>' . $message . '</faultstring>
            </SOAP-ENV:Fault>
            </SOAP-ENV:Body>
            </SOAP-ENV:Envelope>');
    }

}

/**
 * Check whether Soap extension is loaded
 *
 * @return boolean
 */
protected function _extensionLoaded()
{
    return class_exists('SoapServer', false);
}

/**
 * Transform wsdl url if $_SERVER["PHP_AUTH_USER"] is set
 *
 * @param array
 * @return String
 */
protected function getWsdlUrl($params = null, $withAuth = true)
{
    $urlModel = Mage::getModel('core/url')
        ->setUseSession(false);

    $wsdlUrl = $params !== null
        ? $urlModel->getUrl('*/*/*', array('_current' => true, '_query' => $params))
        : $urlModel->getUrl('*/*/*');

    if ( $withAuth ) {
        $phpAuthUser = rawurlencode($this->getController()->getRequest()->getServer('PHP_AUTH_USER', false));
        $phpAuthPw = rawurlencode($this->getController()->getRequest()->getServer('PHP_AUTH_PW', false));
        $scheme = rawurlencode($this->getController()->getRequest()->getScheme());

        if ($phpAuthUser && $phpAuthPw) {
            $wsdlUrl = sprintf("%s://%s:%s@%s", $scheme, $phpAuthUser, $phpAuthPw,
                str_replace($scheme . '://', '', $wsdlUrl));
        }
    }

    return $wsdlUrl;
}

/**
 * Try to instantiate Zend_Soap_Server
 * If schema import error is caught, it will retry in 1 second.
 *
 * @throws Zend_Soap_Server_Exception
 */
protected function _instantiateServer()
{
    $apiConfigCharset = Mage::getStoreConfig('api/config/charset');
    $wsdlCacheEnabled = (bool) Mage::getStoreConfig('api/config/wsdl_cache_enabled');

    if ($wsdlCacheEnabled) {
        ini_set('soap.wsdl_cache_enabled', '1');
    } else {
        ini_set('soap.wsdl_cache_enabled', '0');
    }

    $tries = 0;
    do {
        $retry = false;
        try {
            $this->_soap = new Zend_Soap_Server($this->getWsdlUrl(array("wsdl" => 1)),
                array('encoding' => $apiConfigCharset));
        } catch (SoapFault $e) {
            if (false !== strpos($e->getMessage(),
                "can't import schema from 'http://schemas.xmlsoap.org/soap/encoding/'")
            ) {
                $retry = true;
                sleep(1);
            } else {
                throw $e;
            }
            $tries++;
        }
    } while ($retry && $tries < 5);
    use_soap_error_handler(false);
    $this->_soap
        ->setReturnResponse(true)
        ->setClass($this->getHandler());
}

}

One Answer

All the problem including this will be resolved if you following the following solution.

Magento 1.9.3 All known problems

Answered by Sid on November 12, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP