phpmagentomagento-soap-api

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.

I log in successfully, but when I call customerCustomerCreate() method, it just returns false without any complementary info. 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; 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?

Is there a way to have more info on the error on my side? Or do I have to ask the Magento owner?


Solution

  • If you pass extra fields, they will be filtered out by SOAP server, so this cannot be a problem.

    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). 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).