everytime i run this

   $proxy = new SoapClient('http://localhost/magento/api/v2_soap/?wsdl');
   $sessionId = $proxy->login((object)array('username' => 'admin', 'apiKey' => 'admin'));
   $result = $proxy->customerCustomerCreate((object)array('sessionId' => $sessionId->result, 'customerData' => ((object)array(
   'email'      => $email,
   'firstname'  => $firstname,
   'lastname'       => $lastname,
   'password'       => $auto_password,
   'website_id'     => '0',
   'group_id'       => '1'

i get this error:

Catchable fatal error: Object of class stdClass could not be converted to string in add-new-customer.php on line 2

I'm running this on the latest MAMP. I also tried running this on the 'native' mac php/apache and it runs without any problems. I appreciate any help.


The error is pretty self explanatory - the second line is not valid, more specifically the login method needs 2 strings, one for username, one for password but you are calling (object) against an array and using the result as the method argument. Try with just:

$sessionId = $proxy->login($username, $password);

Where $usename and $password are strings.

| improve this answer | |
  • No luck, this is what I got: – johnfree Sep 12 '14 at 7:42
  • Fatal error: Uncaught SoapFault exception: [SOAP-ENV:Server] Procedure 'login' not present in add-new-customer.php:2 Stack trace: #0 add-new-customer.php(2): SoapClient->__call('login', Array) #1 add-new-customer.php(2): SoapClient->login('theusername', 'thepassword') #2 {main} thrown in add-new-customer.php on line 2 – johnfree Sep 12 '14 at 7:44
  • You are probably going to be better off looking at something like this to give you a more complete picture on the subject. Be here all day otherwise giving you debugging hints. – Jonathan Hussey Sep 12 '14 at 8:20
  • Thank you! I will definitely take a look at that. I'm pretty new to Magento, SOAP and etc. But I got the above example to work by switching to 'SOAP V2' instead of 'SOAP V2 (WS-I Compliance Mode)' – johnfree Sep 12 '14 at 9:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.