2012-05-25 36 views
1

我打电话Magento的1.5.1.0 API以http:// * */API/SOAP/WSDL(1版)Magento的1.5.1.0 API - customer_address.list返回错误

我可以登录?到web服务,我可以得到customer.info,customer_address.info等 但我无法让customer_address.list工作。

我使用以下代码:

$proxy = new SoapClient('http://***/api/soap/?wsdl'); 
$sessionId = $proxy->login('apiuser', 'apipass'); 
$newCustomerId = 178475; 
// This works fine 
var_dump($proxy->call($sessionId, 'customer.info', $newCustomerId)); 
// This should work according to the API doc. But doesn't? 
var_dump($proxy->call($sessionId, 'customer_address.list', $newCustomerId)); 

在第二的var_dump的错误信息是:

呼叫一个成员函数的getId()非对象上

有什么想法可能是错的?

问候,

拉斯

回答

1

这可能是你有得到一个/一些错误的getId()函数的自定义模块。

我的例子正在工作。

try {//customer.info 
     $result = $cli->call($session_id,'customer.info',$_customerId); 
     print_r($result); 
    } catch (Exception $e) { 
     print_r($e->faultstring."\n"); 
    } 

    try {//customer_address.list 
     $result = $cli->call($session_id,'customer_address.list',$_customerId); 
     print_r($result); 
    } catch (Exception $e) { 
     print_r($e->faultstring."\n"); 
    } 

或者它可能是您的$ newCustomerId不存在于您的customer_entity表;

执行尝试用于调试错误。

纠正我,如果我错了

^^