签名无效错误

时间:2015-12-16 10:10:52

标签: magento

$customers  = Mage::getResourceModel('customer/customer_collection')
                 ->addAttributeToSelect('*')
                 ->addAttributeToFilter('firstname', $firstName)

在Rest.php中添加此函数时,它返回签名无效错误。 它是否需要在xml文件中映射?

2 个答案:

答案 0 :(得分:0)

您可以尝试添加 - > load()。

$customers  = Mage::getResourceModel('customer/customer_collection')
             ->addAttributeToSelect('*')
             ->addAttributeToFilter('firstname', $firstName)->load();

原因是Magento在尝试使用它之前不对该对象做任何事情,就像对结果做一个foreach。通过调用load(),您强制它完全加载对象并获得结果。

答案 1 :(得分:0)

此处找到SOAP和REST菜单 enter image description here

我建议先创建角色。然后创建用户。

设置完成后,您的应用程序可以根据您提供的角色进行通信。

我希望这会有所帮助。如果您已经设置了角色和用户,请在您的应用程序中验证您的用户名和API密钥是否正确。

如果您不知道API密钥等同于密码。

设置完毕后,您可以使用与此API调用类似的代码访问您的网站:

$proxy = new SoapClient('http://whatever.com/api/v2_soap/?wsdl');
$sessionId = $proxy->login((object)array('username' => 'myusername', 'apiKey' => 'mypassword'));
$result = $proxy->customerCustomerInfo((object)array('sessionId' => $sessionId->result, 'customerId' => '220769'));
print_r($result)