Well, if you are having Magento ecommerce store and looking for direction to on creating a mobile application for android and IOS which is tightly coupled with your Magento store, you should be lucky to have found this article. This article will give you background on Magento api and which library can be used from android and IOS to connect to Magento.
Business case – To create online ecommerce mobile app for android and IOS where customer can browse through products, add to cart and checkout to purchase required product and customers profile functionality like register, login, order history, edit user information etc. This mobile app should perform CRUD operation from Magento site or Magento backend database. Basically connect ios and andriod app to magento store.
If you would have done some research you would already know that Magento has provided API to work with Magento’s resources like products, categories, customers, sales and order etc. This API can be used by any external application developer who would like to operate Magento store from outside of native Magento application.
Magento provides SOAP and REST API to connect with Magento backend database. More details on this can be found on below links (Magento Official)
Magento REST api is missing some of features which we have in SOAP api, we would choose SOAP api because it provides almost all the functionality which is required for creating a external application for your magento store. Please note I have marked “almost” word as bold this is to highlight Magento SOAP api also is missing some feature which would required but more on this later, I am planning to write different article on missing features and how to achieve it with custom api. Read this article on How to enable Magento SOAP API to be consumed by external application
Basic Flow to Call Magento SOAP webservice
Basic steps to call magneto web service from any SOAP client,
To connect to Magento SOAP web services, load the WSDL into your SOAP client from either of these URLs:
- Create new SoapClient object by passing WSDL url of your web service(say proxy/client)
- Authenticate Web service by passing API user key and password with use of login method- this will give us Session Id which will be used in our further calls.
- Call any Magento API method by passing Session object and other required parameters to call this method.
Library to use to consume Magento SOAP api from Android.
We have used Ksoap2 library consume Magento soap api from android platform. This client library provides everything to call Magento SOAP service from android.
Library Name – Ksoap2-android library
Library Home URL – https://code.google.com/p/ksoap2-android/
Direct Library Download URL – http://code.google.com/p/ksoap2-android/source/browse/m2-repo/com/google/code/ksoap2-android/ksoap2-android-assembly/3.3.0/ksoap2-android-assembly-3.3.0-jar-with-dependencies.jar
A follow up article can be found How to use this library on Andriod platform.
Library to use to consume Magento SOAP api from Ios.
We have used LogN Magento library from github to consume Magento soap api from IOS platform, This client library has worked well for our purpose and provides and easy way to call Magento SOAP service methods from IOS.
Library Name – LogN Magento
Library home url – https://github.com/lognllc/LogNMagento
Download URL – https://github.com/lognllc/LogNMagento
Hope this helps!! Happy Coding!!!!