1.9.3.0 güncellemesinden sonra SOAP bağlantı sorunları


12

Magento Mağazamı 1.9.2.4'ten 1.9.3.0'a güncelledim

Bir SOAP / XML-RPC kullanıcısı üzerinden bağlanan nakliye yazılımını (Shipworks) kullanıyoruz.

Güncelleme sonra shipworks günlük kaydı günlüklerde bu yanıtı gösterir:

<?xml version="1.0" encoding="UTF-8"?>
-<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
-<SOAP-ENV:Body>
-<SOAP-ENV:Fault>
<faultcode>1</faultcode>
<faultstring>Internal Error. Please see log for details.</faultstring>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Bu yüzden gittim ve Magento'da istisna günlüğünü açtım ve aşağıdaki hatayı aldım:

2016-10-13T18:24:14+00:00 ERR (3): 
SoapFault exception: [1] Internal Error. Please see log for details. in /public_html/app/code/core/Mage/Api/Model/Server/Adapter/Soap.php:196
Stack trace:
#0 /public_html/app/code/core/Mage/Api/Model/Server/Handler/Abstract.php(140): Mage_Api_Model_Server_Adapter_Soap->fault('1', 'Internal Error....')
#1 /public_html/app/code/core/Mage/Api/Model/Server/Handler/Abstract.php(48): Mage_Api_Model_Server_Handler_Abstract->_fault('internal')
#2 /public_html/app/code/core/Mage/Api/Model/Server/Handler/Abstract.php(559): Mage_Api_Model_Server_Handler_Abstract->handlePhpError(4096, 'Argument 1 pass...', '/home/deepsix/p...', 559, Array)
#3 /public_html/app/code/core/Mage/Api/Model/Server/Handler/Abstract.php(299): Mage_Api_Model_Server_Handler_Abstract->processingMethodResult('<?xml version="...')
#4 [internal function]: Mage_Api_Model_Server_Handler_Abstract->call('ca4d34d100c92c8...', 'shipWorksApi.ge...', Array)
#5 /public_html/lib/Zend/Soap/Server.php(889): SoapServer->handle('<?xml version="...')
#6 /public_html/app/code/core/Mage/Api/Model/Server/Adapter/Soap.php(174): Zend_Soap_Server->handle()
#7 /public_html/app/code/core/Mage/Api/Model/Server.php(138): Mage_Api_Model_Server_Adapter_Soap->run()
#8 /public_html/app/code/core/Mage/Api/controllers/SoapController.php(40): Mage_Api_Model_Server->run()
#9 /public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Api_SoapController->indexAction()
#10 /public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('index')
#11 /public_html/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#12 /public_html/app/code/core/Mage/Core/Model/App.php(365): Mage_Core_Controller_Varien_Front->dispatch()
#13 /public_html/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#14 /public_html/index.php(83): Mage::run('', 'store')
#15 {main}

Bu yüzden 1.9.2.4 ve 1.9.3.0'dan Abstract.php arasında bir fark yarattım ve aşağıdakileri elde ettim:

290a291
>                 $result = array();
292c293
<                     return $model->$method((is_array($args) ? $args : array($args)));
---
>                     $result = $model->$method((is_array($args) ? $args : array($args)));
294c295
<                     return $model->$method($args);
---
>                     $result = $model->$method($args);
296c297
<                     return call_user_func_array(array(&$model, $method), $args);
---
>                     $result = call_user_func_array(array(&$model, $method), $args);
297a299
>                 return $this->processingMethodResult($result);
403a406
>                     $callResult = array();
405c408
<                         $result[] = $model->$method((is_array($args) ? $args : array($args)));
---
>                         $callResult = $model->$method((is_array($args) ? $args : array($args)));
407c410
<                         $result[] = $model->$method($args);
---
>                         $callResult = $model->$method($args);
409c412
<                         $result[] = call_user_func_array(array(&$model, $method), $args);
---
>                         $callResult = call_user_func_array(array(&$model, $method), $args);
410a414
>                     $result[] = $this->processingMethodResult($callResult);
544a549,585
>     }
> 
>     /**
>      * Prepare Api data for XML exporting
>      * See allowed characters in XML:
>      * @link http://www.w3.org/TR/2000/REC-xml-20001006#NT-Char
>      *
>      * @param array $result
>      * @return mixed
>      */
>     public function processingMethodResult(array $result)
>     {
>         foreach ($result as &$row) {
>             if (!is_null($row) && !is_bool($row) && !is_numeric($row)) {
>                 $row = $this->processingRow($row);
>             }
>         }
>         return $result;
>     }
> 
>     /**
>      * Prepare Api row data for XML exporting
>      * Convert not allowed symbol to numeric character reference
>      *
>      * @param $row
>      * @return mixed
>      */
>     public function processingRow($row)
>     {
>         $row = preg_replace_callback(
>             '/[^\x{0009}\x{000a}\x{000d}\x{0020}-\x{D7FF}\x{E000}-\x{FFFD}\x{10000}-\x{10FFFF}]/u',
>             function ($matches) {
>                 return '&#' . Mage::helper('core/string')->uniOrd($matches[0]) . ';';
>             },
>             $row
>         );
>         return $row;

Herhangi bir yardım mutluluk duyacağız.

Yanıtlar:


14

Burada başka bir uzantı ile aynı hata. system.log diyor

Mage_Api_Model_Server_Handler_Abstract :: processingMethodResult () öğesine iletilen argüman 1, app / code / core / Mage / Api / Model / Server / Handler / Abstract.php'de çağrılan tür dizesi, dize olmalıdır ...

Bence sorun yeni yöntem

Mage_Api_Model_Server_Handler_Abstract::processingMethodResult(array $result)

sadece dizileri kabul eder. Böylece bir skaler değer döndüren her Api işlevi bu hatayı atar. Bu yine ben kopyalanan gidiyor almak için app/code/core/Mage/Api/Model/Server/Handler/Abstract.phpiçin app/code/local/Mage/Api/Model/Server/Handler/Abstract.phpve yamalı processingMethodResult:

public function processingMethodResult($result)
{
    if (is_array($result)) {
        foreach ($result as &$row) {
            if (!is_null($row) && !is_bool($row) && !is_numeric($row)) {
                if (is_array($row)) {
                    $row = $this->processingMethodResult($row);
                } else {
                    $row = $this->processingRow($row);
                }
            }
        }
    } else {
        if (!is_null($result) && !is_bool($result) && !is_numeric($result)) {
            $result = $this->processingRow($result);
        }
    }
    return $result;
}

hangi magento sürümünü kullanıyorsunuz
— LandonL

Bu sorunu çözer. Neden magento çekirdek dosyası yine de dizeyle vs string arasında değiştirilsin ki?
— LandonL

Mükemmel düzeltme, teşekkür ederim. Bunu Magento ile ilgili bir hata olarak gösteren var mı? Birçok insan bu şekilde ısırılacak.
— BlueC

Değişiklik PHP7 etrafında daha fazla, aşağıdaki cevabım bakın. Ayrıca, stackoverflow.com/a/4103536/158325 bu gerçekten bir hata değil, ancak API PHP7'yi uyumlu hale getiriyor.
— B00MER

1
@LandonL: 1.9.2.4'ten 1.9.3.0'a güncelledim.
— Belgor

1

Büyük olasılıkla ShipStation modülü ve / veya çalıştırdığınız PHP sürümü uyumlu değildir:

Döndürülen kesilmiş PHP hata mesajını tahmin etme:

Argument 1 pass...' büyük olasılıkla Argument 1 passed to methodhere() must be an instance of string, string given

Hangi PHP sürümünü çalıştırıyorsunuz ve en son Magento sürümü / yamalarıyla ilgili daha yeni bir sürüm ve / veya uyumluluk sorunları olup olmadığını görmek için ShipStation ile görüştünüz.

Ayrıca, buraya biraz daha giriş ekleyebilirsiniz: https://github.com/OpenMage/magento-mirror/blob/magento-1.9/lib/Zend/Soap/Server.php#L889 Kesilmiş PHP hatasını daha fazla yakalamak için doğru hatanın döndürüldüğünü doğrulamak için döndürülür.

Bu yardımcı olur umarım.


Daha fazla kesilmiş hatayı nasıl alabilirim? Hattın uzunluğunu nasıl artıracağımdan emin değilim.
— LandonL

Sistem şu anda php 5.6.25 çalıştırıyor, bugün gemi işlerini aradım, ancak 1.9.3.0 magento güncellemesi dün çıktığı için, henüz konuya bakma şansına sahip olduklarına inanmıyorum.
— LandonL

1

Belgors yanıtı gerçekten bana yardımcı oldu, ancak yama nesnelerinin API deposuna eklenmesine izin vermek için yamayı biraz değiştirdim.

Örneğin, artık sipariş bilgileri için Magento XML-RPC çağrısı ile önde gelenWorks depolama kredisi ve / veya hediye kartı nesne dizileri elde edersiniz .

(kod Björn Tantau'nun önerisinden güncellendi - nesneler ve koleksiyonlarla daha iyi çalışmak için)

public function processingMethodResult($result)
{
    if (is_object($result) && is_callable(array($result, 'toArray'))) {
        $result = $result->toArray();
    }
    if (is_array($result)) {
        foreach ($result as &$row) {
            if (is_object($row) && is_callable(array($row, 'toArray'))) {
                $row = $row->toArray();
            }
            if (!is_null($row) && !is_bool($row) && !is_numeric($row)) {
                if (is_array($row)) {
                    $row = $this->processingMethodResult($row);
                } else {
                    $row = $this->processingRow($row);
                }
            }
        }
    } else {
        if (!is_null($result) && !is_bool($result) && !is_numeric($result)) {
            $result = $this->processingRow($result);
        }
    }
    return $result;
}
Sitemizi kullandığınızda şunları okuyup anladığınızı kabul etmiş olursunuz: Çerez Politikası ve Gizlilik Politikası.
Licensed under cc by-sa 3.0 with attribution required.