简体   繁体   English

Magento SOAP API:createCreateCustomer返回false,没有错误

[英]Magento SOAP API: createCreateCustomer returns false, no error

I'm trying to register a new user on a distant Magento install (which I do not own, so I can't access the code or anything) but it does not work. 我正在尝试在遥远的Magento安装上注册新用户(我不拥有该安装,因此我无法访问代码或任何内容),但是它不起作用。

I log in successfully, but when I call customerCustomerCreate() method, it just returns false without any complementary info. 我成功登录,但是当我调用customerCustomerCreate()方法时,它只返回false而没有任何补充信息。 The user doesn't exists, but even if he did I'd be glad to have an error message! 该用户不存在,但是即使他确实存在,我也很高兴收到错误消息!

Here is a sample code: 这是一个示例代码:

$soapClient = new SoapClient('URL TO THE WSDL');
$session = $soapClient->login('APIUSER','APIPASSWORD'); // Login ok
$newUser = array('ALL THE INFOS ABOUT USER, AND MORE!');
$distantUserId = $soapClient->customerCustomerCreate($session, $newUser);
// $distantUserId = false...

For the $newUser , I have more info than what Magento asks; 对于$newUser ,我的信息比Magento要求的更多。 since I already have a user on my side, I just pass all the infos I have, even if it's a field Magento doesn't have, could that be the problem? 因为我已经有一个用户在身边,所以我只是传递我拥有的所有信息,即使这是Magento所没有的字段,也可能是问题所在吗?

Is there a way to have more info on the error on my side? 有没有办法让我了解有关该错误的更多信息? Or do I have to ask the Magento owner? 还是我必须问Magento所有者?

If you pass extra fields, they will be filtered out by SOAP server, so this cannot be a problem. 如果传递额外的字段,则它们将被SOAP服务器过滤掉,因此这不会成为问题。

The only way to get more info is to ask for logs or to enable developer mode on Magento side if this is not live site (can be done via .htaccess on the server). 获取更多信息的唯一方法是询问日志,或者如果这不是实时站点,则在Magento端启用开发人员模式(可以通过服务器上的.htaccess进行操作)。 When developer mode is on, all exceptions are output directly to the client. 当开发人员模式打开时,所有异常都直接输出到客户端。

Also you may share with us customer data. 您也可以与我们共享客户数据。 The following format works for me: 以下格式对我有用:

$client = new SoapClient('http://your.host/index.php/api/v2_soap/?wsdl');
$sessionId = $client->login('apiUser', 'apiKey');
$result = $client->customerCustomerCreate(
    $sessionId,
    array(
        'email' => 'customer-mail@example.org',
        'firstname' => 'Dough',
        'lastname' => 'Deeks',
        'password' => 'password',
        'website_id' => 1,
        'store_id' => 1,
        'group_id' => 1
    )
);
print_r($result); // Output ID of created customer

When I try to perform the same request once again, I get SoapFault as expected: This customer email already exists (developer mode is off). 当我再次尝试执行相同的请求时,按预期方式出现SoapFault: This customer email already exists (开发人员模式已关闭)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM