Call webservice in magnto is very easy its only 3 step process ,First we create the soap client with hekp of Soap api url then generate session with username and password,Finally we ar ble to call all webservice method From Soap Webservice Api.
- <?php
- /*
- * @created by : Parvez Alam */
- //disables the soap catch .Its also handled from php.ini file.
- ini_set(“soap.wsdl_cache_enabled”, “0″);
- //creating the soap client with help of Api URL
- $client = new SoapClient(“http://localhost/magento/index.php/api/?wsdl”);
- //login with webservice username and password
- $session = $client->login(“username”, “password”);
- try{
- //call the webservice method
- $result1=$client->call($session, ‘sales_order.getTicketPrice’, array());
- //Note:sales_order is resource name which is define in api.xml
- }catch (Exception $e)
- {
- echo $e->getMessage();
- }
- //echo $result1;
- //var_dump($client->call($session, ’category.tree’));
- echo “<pre>”;
- //print_r($result);
- if(isset($result1))
- {
- print_r($result1);
- }
- echo “<pre>”;
- ?>
/*
* @created by : Parvez Alam */
//disables the soap catch .Its also handled from php.ini file.
ini_set(“soap.wsdl_cache_enabled”, “0″);
//creating the soap client with help of Api URL
$client = new SoapClient(“http://localhost/magento/index.php/api/?wsdl”);
//login with webservice username and password
$session = $client->login(“username”, “password”);
try{
//call the webservice method
$result1=$client->call($session, ‘sales_order.getTicketPrice’, array());
//Note:sales_order is resource name which is define in api.xml
}catch (Exception $e)
{
echo $e->getMessage();
}
//echo $result1;
//var_dump($client->call($session, ‘category.tree’));
echo “<pre>”;
//print_r($result);
if(isset($result1))
{
print_r($result1);
}
echo “<pre>”;
?>