This tutorial is the second part of a serie of 2 articles describing how to build an iPhone Application using Sybase Unwired Platform in order to communicate with SAP backend.
You can have access to the first part here : http://weblogs.sdn.sap.com/pub/wlg/21378
What does the application?
For this tutorial, I provide you a zip file containing an empty XCode project which is the application we are going to make. The following screenshots describe the application. The goal here is not to focus on how to create an iPhone application but how to integrate SUP’s calls inside iPhone Application.
Result after Submit
After de-zipping the archive, launch your Xcode and import the project.
Integrate Sybase’s calls to the application
To communicate with SUP sever we need to do some actions:
- Create a CallbackHandler specific to our MBO
- Connect to SUP server
- Retrieve data
- Showing up data
Create a specific MBO’s CallbackHandler
This file is used by SUP to catch the event from the server.
- in the Groups & Files view, right click on the Resource sub-folder
- Select Add and New File…
- Select Objective-C class and call it MyFlightsCallbackHandler
- Then press Add button. Check the box for Copy items into destination group’s folder (if needed), then click Add button
In the definition file please copy and paste the following code:
Then go to the implementation file and copy & paste the following code:
Connect to SUP server
- Go to the MyFlightsAppDelegate.h definition and add the following code to generate a new method:
- Go to the MyFlightsAppDelegate.m implementation then add the following code in order to connect the iPhone to SUP server:
The application is ready to communicate with SUP server. Now we will make code into the button event to call the MBO.
Because we need to pass the flight date and the aiprorts we have to use the SynchronizationParameters to do it.
- Open the SubscribeController.m and add:
Registered into SUP Server
To be able to connect and retrieve data from SUP server with the iPhone, we need to be registered into it.
- Open your browser and access to the following URL (SUP Server side): https://localhost:8283/scc/
- User : supAdmin
- Password : s3pAdmin
- In the Control Center go to View > Select > Unwired Server Cluster Management View
- Click on Device Users node
- Press the Register… button
- In the form type down the following information and press Ok button
Note: There is one user for one application and one device (iPhone).
At this point, you have a fully iPhone application which is be able to connect to SUP server and to retrieve data from SAP backend.