Do you have WS-I compliance turned on or off? Calls are somewhat stricter when WS-I Compliance mode is enabled.
Also it is worth checking if WSDL cache is enabled or not. Generally speaking wsdl caches on linux/unix based systems store a cached version of the WSDL here: -
cd /tmp/
You can use the following command to clear them out
sudo rm -rf /tmp/wsdl*
I also assume you are intending to use SOAP V1 not V2 if so you should use the following URL: -
http://www.domain.com/index.php/api/v2_soap?wsdl
If this does not help then it would be best if you could provide more detail here. The SoapClient in php allows you to pass params in the constructor, so if you pass something like the following, you can see some more information.
try {
$client = new SoapClient('http://www.domain.com/index.php/api/v2_soap/?wsdl', array('trace' => 1, 'connection_timeout' => 120));
$session = $client->login(array(
'username' => 'user',
'apiKey' => 'pass')
);
}
catch (Exception $e) {
var_dump($e);
}
header('Content-type: application/xml');
echo $client->__getLastResponse();
// or echo $client->__getLastRequest();
If you could echo out 1 then the other and copy back here so can have a look may be able to help you further. For more info on SoapClient check the php website.
/app/code/local/Your/Customattribute/sql/your_customattribute_setup/install-0.1.0.php
<?php
$installer = $this;
$installer->startSetup();
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$entityTypeId = $setup->getEntityTypeId('customer');
$attributeSetId = $setup->getDefaultAttributeSetId($entityTypeId);
$attributeGroupId = $setup->getDefaultAttributeGroupId($entityTypeId, $attributeSetId);
$setup->addAttribute("customer", "customattribute", array(
"type" => "varchar",
"backend" => "",
"label" => "Custom Attribute",
"input" => "text",
"source" => "",
"visible" => true,
"required" => false,
"default" => "",
"frontend" => "",
"unique" => false,
"note" => "Custom Attribute"
));
$attribute = Mage::getSingleton("eav/config")->getAttribute("customer", "customattribute");
$setup->addAttributeToGroup(
$entityTypeId,
$attributeSetId,
$attributeGroupId,
'customattribute',
'999' //sort_order
);
$used_in_forms=array();
$used_in_forms[]="adminhtml_customer";
//$used_in_forms[]="checkout_register";
//$used_in_forms[]="customer_account_create";
//$used_in_forms[]="customer_account_edit";
//$used_in_forms[]="adminhtml_checkout";
$attribute->setData("used_in_forms", $used_in_forms)
->setData("is_used_for_customer_segment", true)
->setData("is_system", 0)
->setData("is_user_defined", 1)
->setData("is_visible", 1)
->setData("sort_order", 100)
;
$attribute->save();
$installer->endSetup();
/app/code/local/Your/Customattribute/etc/config.xml
<?xml version="1.0"?>
<config>
<modules>
<Your_Customattribute>
<version>0.1.0</version>
</Your_Customattribute>
</modules>
<global>
<resources>
<Your_Customattribute_setup>
<setup>
<module>Your_Customattribute</module>
<class>Mage_Customer_Model_Entity_Setup</class>
</setup>
<connection>
<use>core_setup</use>
</connection>
</Your_Customattribute_setup>
<Your_Customattribute_write>
<connection>
<use>core_write</use>
</connection>
</Your_Customattribute_write>
<Your_Customattribute_read>
<connection>
<use>core_read</use>
</connection>
</Your_Customattribute_read>
</resources>
</global>
</config>
app/etc/modules/Your_Customattribute.xml
<?xml version="1.0"?>
<config>
<modules>
<Your_Customattribute>
<active>true</active>
<codePool>local</codePool>
<version>0.1.0</version>
</Your_Customattribute>
</modules>
</config>
Then to retrieve or edit you use:
$customer = Mage::getModel('customer/customer')->load($custid);
$customer->getCustomattribute();
$customer->setCustomattribute($yourjson);
You will have to create event observers for the login event, answered here: How can i get customer data from observer after successful login?
and also likely observers for the customer_save_after in case they alter their address in account mgmt, and one for the quote, which could be in different places depending on what you are going for.
Best Answer
Magento SOAP Api has no method to authenticate customers.
What you can do is, get the customer info and then check the password. The problem is, doing this client side is a really bad idea.
The alternative is to implement your own method to just pass email and password to check it.