Magento Forum

Creating Custom Web Service Api In magento programmatically
 
pradeep_kumar67
Sr. Member
 
Avatar
Total Posts:  160
Joined:  2010-06-24
Bangalore
 

Hi,
I attached custom Api module and calling file in this post which will show basic structure of custom api

once you install this module clear cache and paste this code in file and execute this file in browser

<?php
$proxy 
= new SoapClient(\'http://yourdomine/index.php/api/soap/?wsdl\');

$sessionId $proxy->login(\'USERNAME\'\'API_Key\');  // you will get this when you create web service user in admin side
   
$filters = array(
    
\'sku\' => array(\'like\'=>\'test%\')
);
 
 
$products $proxy->call($sessionId\'resource_name.methodName\',  $filters);
 
var_dump($products);


?>
File Attachments
custome api.zip  (File Size: 6KB - Downloads: 194)
 
Magento Community Magento Community
Magento Community
Magento Community
 
shameem356
Jr. Member
 
Total Posts:  2
Joined:  2012-06-08
 

Hi,

I tried this in magento 1.7 version as per your suggestion. But I am getting an error like

“ Fatal error: Uncaught SoapFault exception: [3] Invalid api path. in /opt/lampp/htdocs/API_new/test.php:10 Stack trace: #0 /opt/lampp/htdocs/API_new/test.php(10): SoapClient->__call(’call’, Array) #1 /opt/lampp/htdocs/API_new/test.php(10): SoapClient->call(’0eb109c595a0dc9...’, ‘resource_name.m...’, Array) #2 {main} thrown in /opt/lampp/htdocs/API_new/test.php on line 10”.

Please help me to solve this problem.Even I refreshed the cache also.

Thanks in advance
Shameem356

 
Magento Community Magento Community
Magento Community
Magento Community
 
pradeep_kumar67
Sr. Member
 
Avatar
Total Posts:  160
Joined:  2010-06-24
Bangalore
 

@shameem356:- Please clear cache and try

 
Magento Community Magento Community
Magento Community
Magento Community
 
yflharidon
Jr. Member
 
Total Posts:  6
Joined:  2007-08-31
Le Mans, France
 

Hi !

I copy/past your code , i clear my cache (rm -rf /tmp/wsdl*)
and i have the same :  Invalid api path.

with SOAP V2 : http://magento/index.php/api/v2_soap/?wsdl=1

coul’d you help me ?

Thanks a lot !

 
Magento Community Magento Community
Magento Community
Magento Community
 
pradeep_kumar67
Sr. Member
 
Avatar
Total Posts:  160
Joined:  2010-06-24
Bangalore
 

@ yflharidon

1.  install attached module

2.  keep webservices.php in root folder

3 clear cache and session of you project

4.  make sure user name and password is correct in webservices.php which you have to create from admin side
to create web service go to System->Webserivce 1st creat user and then create webserivce roles assign to created roles
you use username and api kep in webservices.php save the files and the clear cache

5.  run webservices.php in browser enjoy:- )

Note:- that error will become because of wrong webservice user name or api key or incorrect roles or cache

File Attachments
webservices.zip  (File Size: 5KB - Downloads: 99)
 
Magento Community Magento Community
Magento Community
Magento Community
 
yflharidon
Jr. Member
 
Total Posts:  6
Joined:  2007-08-31
Le Mans, France
 

Thanks for your reply !

Do you test with SOAP V2 ?

 
Magento Community Magento Community
Magento Community
Magento Community
 
vnthkmr42
Jr. Member
 
Total Posts:  1
Joined:  2013-03-06
 

CONNECT ERROR: Package file is invalid
Invalid package name, allowed: [a-zA-Z0-9_-] chars
Invalid version, should be like: x.x.x
Invalid stability
Invalid date, should be YYYY-DD-MM
Invalid channel URL
Empty authors section
Empty package contents section

I\’m getting the above error.

Any one plz help me.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Bee Commerce
Jr. Member
 
Avatar
Total Posts:  7
Joined:  2009-03-30
Chile
 

Dear your module pradeep_kumar67 not understand that it serves, but it works perfect, but could be a little more explicit please. Look at this wiki and I did clearly explain how to create users but not a module, it would be interesting to join them: http://www.magentochile.cl/blog/magento-api-wsdl-soapxlm-rpc-web-services/

Saludos,

Boris Durán R.
magentochile.cl

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top