Magento 1.7.0.1覆盖Mage_Api_Model_Server_WSI_Handler

时间:2012-06-26 04:22:42

标签: php magento

当我尝试使用API​​(SoapUI 4.5)登录时出现此错误:


致命错误:SoapFault :: SoapFault()[< a href ='soapfault.soapfault'> soapfault.soapfault< / a>]:参数无效。无效的故障代码。在 /home/profi506/public_html/magento/v1701/app/code/core/Mage/Api/Model/Server/Adapter/Soap.php 172

因为我试图在“ Mage_Api_Model_Server_WSI_Handler ”类中覆盖“ __ call ”功能。

这些是我的文件:

应用的/ etc /模块/ MyCompany_Api.xml

<?xml version="1.0"?>
<config>
    <modules>
        <MyCompany_Api>
            <active>true</active>
            <codePool>local</codePool>
        </MyCompany_Api>
    </modules>
</config>

应用/代码/本地/ MyCompany的/原料药的/ etc / config.xml中

<config>
    <modules>
        <MyCompany_Api>
            <version>0.0.1</version>
        </MyCompany_Api>
    </modules>
    <global>
        <models>
            <api>
                <rewrite>
          <server_wsi_handler>MyCompany_Api_Model_Server_WSI_Handler</server_wsi_handler>
                </rewrite>
            </api>
        </models>
    </global>
</config>

应用/代码/本地/ MyCompany的/原料药/型号/服务器/ WSI / Handler.php

<?php
/**
 * Webservices server handler WSI
 *
 * @category   MyCompany
 * @package    MyCompany_Api
 * @author     MyCompany <***>
 */
class MyCompany_Api_Model_Server_WSI_Handler extends Mage_Api_Model_Server_WSI_Handler
{
    protected $_resourceSuffix = '_v2';

    /**
     * Interceptor for all interfaces
     *
     * @param string $function
     * @param array $args
     */

    public function __call ($function, $args)
    {
       // my custom code is here, before the original code of the function
       ...
       // end of my custom code
       ...
    }
}
?>

0 个答案:

没有答案