Skip to Content

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.

* * * * * *

Settings

Properties

Splash Screen

Form

Date Picker

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:

  1. Create a CallbackHandler specific to our MBO
  2. Connect to SUP server
  3. Retrieve data
  4. Showing up data

Create a specific MBO’s CallbackHandler

This file is used by SUP to catch the event from the server.

  1. in the Groups & Files view, right click on the Resource sub-folder
  2. Select Add and New File…
  3. Select Objective-C class and call it MyFlightsCallbackHandler
  4. 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.

  1. Open your browser and access to the following URL (SUP Server side): https://localhost:8283/scc/
    1. User : supAdmin
    2. Password : s3pAdmin
  2. In the Control Center go to View > Select > Unwired Server Cluster Management View
  3. Click on Device Users node
  4. Press the Register… button
  5. In the form type down the following information and press Ok button

Note: There is one user for one application and one device (iPhone).

Conclusion

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.

To report this post you need to login first.

2 Comments

You must be Logged on to comment or reply to a post.

  1. chigri khalida
    Hi,

    When I execute the application, the user interface does not display because  of a problem at this level:
    while([databaseCH importSuccessCount]<1) {
                   [NSThread sleepForTimeInterval:0.2];}

    the importSuccessCount is always 0 ,can you have any idea about the cause?

    Thanks for advance

    (0) 

Leave a Reply