如何从zend framework2调用函数到magento

时间:2014-03-10 13:40:22

标签: php magento zend-framework soap

我正在尝试让soap客户端连接到magento服务器..我是新手...我正在学习this link 现在我可以在此代码中获得会话ID:

   <?php
namespace Album\Controller;
use Zend\Soap\Client;
 class AlbumController extends AbstractActionController
 {
     public function indexAction()
     {
         $client = new Client("http://localhost/loyal/api/?wsdl");
         $sessionId = $client->login('xxxxxx', '********');


return($client->call($sessionId,'imsales.test'));
     }}
?>

但是当我调用imsales.test时,它说函数$ sessionId不是这个服务的有效方法 在这次电话会议后我得到了同样的答复:

return($client->call('imsales.test'));

我不知道如何调用这些函数

提前

thanx

2 个答案:

答案 0 :(得分:0)

Rramii,首先,首先从

创建一个soap用户

然后从

添加用户
System -> Web Services-> Users

让用户使用soapclient

然后从

开始扮演角色
System -> Web Services -> Roles

如果您想这样做,请附加所有资源。 然后尝试从链接编码

http://stackoverflow.com/questions/8139128/connecting-to-magento-api-with-soap or 
http://www.magentocommerce.com/api/soap/introduction.html

答案 1 :(得分:0)

如果有人来到这个页面,就会解决这个问题:而不是调用

$client->call($sessionId,'imsales.test');

新来电是

$client->getSoapClient()->call($sessionId,'imsales.test');

它对我有用:)