SOAP Magento Error on Customer.Create



我正在尝试从Magja项目创建一个客户,我得到的AxisFault是100"客户电子邮件是必需的。我正在传递 1.7 文档中正确的最小要求参数。长话短说,我的错误代码说我没有包括我的电子邮件,但它显然在那里(没有将敏感信息放在 SO...所以你只需要相信我:))。有什么想法吗?

Stack
org.eclipse.debug.core.DebugException: com.sun.jdi.ClassNotLoadedException: Type has not been loaded occurred while retrieving component type of array.
//soapclient line 208
result = sender.sendReceive(method)  -> method variable
<mag:call xmlns:mag="urn:Magento" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-XML="http://xml.apache.org/xml-soap" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <sessionId>9be685563680f52c1ab5375bec545dfe</sessionId>
    <resourcePath>customer.create</resourcePath>
    <args SOAP-ENC:arrayType="xsd:ur-type[1]" xsi:type="SOAP-ENC:Array">
        <item SOAP-ENC:arrayType="xsd:ur-type[1]" xsi:type="SOAP-ENC:Array">
            <item xsi:type="SOAP-XML:Map">
                <item>
                    <key xsi:type="xsd:string">email</key>
                    <value xsi:type="xsd:string">MY EMAIL</value>
                </item>
                <item>
                    <key xsi:type="xsd:string">password_hash</key>
                    <value xsi:type="xsd:string">4cb9c8a8048fd02294477fcb1a41191a</value>
                </item>
                <item>
                    <key xsi:type="xsd:string">group_id</key>
                    <value xsi:type="xsd:int">1</value>
                </item>
                <item>
                    <key xsi:type="xsd:string">store_id</key>
                    <value xsi:type="xsd:int">1</value>
                </item>
                <item>
                    <key xsi:type="xsd:string">lastname</key>
                    <value xsi:type="xsd:string">LName</value>
                </item>
                <item>
                    <key xsi:type="xsd:string">firstname</key>
                    <value xsi:type="xsd:string">Fname</value>
                </item>
                <item>
                    <key xsi:type="xsd:string">website_id</key>
                    <value xsi:type="xsd:int">1</value>
                </item>
            </item>
        </item>
    </args>
</mag:call>
//magentosoapclient line 215
throw axisFault (axisfault -> message)
<?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>100</faultcode>
            <faultstring>Customer email is required</faultstring>
        </SOAP-ENV:Fault>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

您需要在Magento端跟踪/记录数据。 不知何故,电子邮件在此过程中丢失和/或被破坏。 为客户创建而调用的 PHP 代码位于

#File: app/code/core/Mage/Customer/Model/Customer/Api.php
public function create($customerData)
{
    $customerData = $this->_prepareData($customerData);
    try {
        $customer = Mage::getModel('customer/customer')
            ->setData($customerData)
            ->save();
    } catch (Mage_Core_Exception $e) {
        $this->_fault('data_invalid', $e->getMessage());
    }
    return $customer->getId();
}

并且发送回 SOAP 客户端的特定异常位于

#File: app/code/core/Mage/Customer/Model/Resource/Customer.php
protected function _beforeSave(Varien_Object $customer)
{
    parent::_beforeSave($customer);
    if (!$customer->getEmail()) {
        throw Mage::exception('Mage_Customer', Mage::helper('customer')->__('Customer email is required'));
    }

您的客户电话和/或您正在使用的特定Magento系统的某些内容使Magento认为没有设置客户电子邮件。 给Mage::Log打几个电话应该会让你走上正确的道路。

最新更新