1

I'm trying to make soap client to connect to a magento server .. and I'm new to this .. and I am learning from this link now I can get a session Id in this code:

   <?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'));
     }}
?>

but when I call imsales.test it says function $sessionId is not a valid method for this service and I had same response after this call:

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

I don't know how to call these functions

thanx in advance

rramiii
  • 1,156
  • 6
  • 15
  • 29

2 Answers2

0

Rramii,First of all ,first create an soap user from

Then Add user from

System -> Web Services-> Users

Make a user to use with the soapclient

Then make a role from

System -> Web Services -> Roles

Attach all resources if you want do it this way. then try coding from the links

http://stackoverflow.com/questions/8139128/connecting-to-magento-api-with-soap or 
http://www.magentocommerce.com/api/soap/introduction.html
Amit Bera
  • 7,581
  • 7
  • 31
  • 57
  • thank you for helping :) .. solved in different way: instead of calling $client->call($sessionId,'imsales.test'); .. the new call is $client->getSoapClient()->call($sessionId,'imsales.test'); and it worked for me :) – rramiii Mar 11 '14 at 15:35
0

just if any one came to this page, it solved this way: instead of calling

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

the new call is

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

and it worked for me :)

rramiii
  • 1,156
  • 6
  • 15
  • 29