Consuming Netweaver Gateway Service From Titanium Appcelerator
SAP has recently joined forces with some third party tools for building mobile applications. Titanium Appcelerator is one of them!
More information on the partnerships:
Just thought of sharing my short journey with “SAP”PCelerator through this blog.
What is Titanium Appcelerator?
It is basically not a write once, run anywhere framework. It’s more aptly referred to as a “write once, adapt everywhere” framework. The user interfaces on iOS and Android differ so significantly that in most cases you’ll have to do at least a little platform specific coding.
My First impression – Titanium makes the iOS development process a whole lot easier its like a cake walk. Setting up the Android environment and testing the app is a bit tricky and it took a while for me to get going with Android, Mobile web is good so far. On the whole at the end there is a feeling of WOW!!!
In short – we can support iOS , Android and Mobile Web with a Single Titanium Code base.
Lets look at the development Strategy
The development is based on eclipse –based IDE called Titanium Studio. And it requires Native SDKs from Android and IOS in order to develop and deploy apps.
Appcelerator team has provided a wonderful startup guide for setting up the complete environment. A simple Hello World App can really help you to get started.
On the top you will find solutions to all the initial issues which you might face from the above guides – in the appcelerator’s QA section.
Lets jump on now to consume a Gateway service through a Simple Titanium Mobile App.
I believe Appcelerator team is releasing SAP ODATA module specifically to consume the SAP ODATA which will make the SAP Gateway integration much more easier I hope. So far no official information on the release of this module.
Before that tried a simple app which uses the Titanium.Network.HTTPClient object from the Titanium 2.0 SDK. as its name implies it allows us to make client calls to HTTP web services , and get the sample code from the Titanium SDK’s Kitchen Sink.
Our simple app will fetch the CRM Contacts via SAP Netweaver Gateway from the following Gateway service available from the SAP Netweaver Gateway Demo system.
http://gw.esworkplace.sap.com/sap/opu/sdata/iwcnt/contact/ContactCollection?sap-client=800&$format=xml&$filter=SearchTerm eq ‘Gateway’
The server will respond with XML in SData atom feed format. Each contact is contained in an “entry” element.
Now lets look at how we can consume this atom pub feed in the Appcelerator app. The current project uses a standard template from the Titanium Studio called Tabbed Application. Below screenshot has the details.
Titanium Studio will create the following project structure as shown below.
Details about the project file system
- Resources Folder – your project’s code files and graphics are stored in this folder
- app.js – your project’s bootstrap file. Every project has one; it’s the file loaded first when your app is launched
- tiapp.xml – the details you enter in the new project wizard are used to populate the tiapp.xml file
- UI folder – Platform specific files.
UI/handheld/ApplicationWindow.js has our code to consume the sdata feed recieved from the Gateway. pasted the code here.
Due to the CORS (Cross Origin Resource Sharing) restriction testing the app for mobile web is out of scope. but this can be achievable as per this answer.
and we are done now!!!! below videos will show us the result 😉 .
any sample code ?
How to get appcelerator Odata SDK ?
I am afraid you need to contact appcelerator team to get this ....