You are on page 1of 941

Sybase Unwired Platform 2.

1 Mobile Application Development

Module 0: Course Introduction

Copyright 2012 Sybase, Inc. All rights reserved. Unpublished rights reserved under U.S. copyright laws. Sybase, and Sybase logo, are trademarks of Sybase Inc., or its subsidiaries. indicates registration in the United States of America. SAP, and the SAP logo, are the trademarks or registered trademarks of SAP AG in Germany and in several other countries. All other trademarks are the property of their respective owners.

Student Introductions

Please introduce yourself, including the following information:


Name Company Location Job role and description Purpose for attending this class

0-2

Course Objectives

During this class, you will:


Gain an understanding of mobility terminology and concepts Become familiar with the architecture and components of the Sybase Unwired Platform Learn how to develop and test Mobile Business Applications including the:

Design and deployment of different types of Mobile Business Objects (MBOs) Development of a mobile workflow application Development of a native mobile application

Use the Sybase Control Center to perform administration functions that are related to development and testing

0-3

Course Ideology

The goal is to train developers on how to create mobile applications using Sybase Unwired Platform

This is not a course on BlackBerry, Android or iPhone development p

The course does not show how to make use of all of the various APIs for each device in the market

This is not a mobile application user interface design course user interface design will be treated in a rudimentary fashion

Y will You ill be b shown h h how:


Sybase Unwired Platform interacts with other platform specific development languages through available SUP and device platform APIs To set up projects in external IDEs IDEs, so as to begin your development

0-4

Course Outline and Schedule

Day 1:
Module 0: Course Introduction Module 1: Introduction and Architecture Module 2: Enterprise Developer Edition Installation

Day 2:
Module 3: Introduction to the Unwired WorkSpace Module 4: MBO Design, g , Development p and Deployment p y

Day 3:
Module 5: Introduction to Mobile Workflow Application Development Module 6: Advanced Mobile Workflow Application Development

0-5

Continued

Course Outline and Schedule

Day 4:
Module 7: Introduction to Native Mobile Application Development Module 8: Sybase Unwired Platform Client APIs

Day 5
Module 9: Android Native Application Development Module 10: Data Change Notification (DCN) and Push

Note that you will find an Appendix B covering administration topics for the developer

0-6

Labs

There is no lab in this module

0-7

Module Summary

During the course of this module, you have learned:


General assumptions and expectations for this course The course structure and schedule

0-8

Sybase Unwired Platform 2.1 Mobile Application Development

Module 1: Introduction and Architecture

Copyright 2012 Sybase, Inc. All rights reserved. Unpublished rights reserved under U.S. copyright laws. Sybase, and Sybase logo, are trademarks of Sybase Inc., or its subsidiaries. indicates registration in the United States of America. SAP, and the SAP logo, are the trademarks or registered trademarks of SAP AG in Germany and in several other countries. All other trademarks are the property of their respective owners.

Module Pre-Assessment

There is no pre-assessment in this module

1-2

Module Objectives

Upon completion of this module, you should be able to:


Define the architecture of the Sybase Unwired Platform Gain a better understanding of the Sybase Unwired Platform installation options Understand client and back-end support provided with the platform l tf Determine which Sybase Unwired Platform editions are available il bl and d the th differences diff between b t them th

1-3

Introduction to Sybase S Unwired Platform f

MODU ULE E TO OPIC CS


1-4

Sybase y Unwired Platform Editions Sybase Unwired Platform Architecture

What is Sybase Unwired Platform?

A platform that allows developers to create mobile applications that:


Retrieve/update data from several types of Enterprise Information Systems (EIS) Run on a variety of devices Either Eith push h or pull ll the th iinformation f ti t to/from /f th the d device i Can be quickly developed with minimum work or can be more complex l when h th the b business i need d di dictates t t

1-5

Sybase Unwired Platform Defined

1-6

Mobile Application Makeup

Developers must create two components when building any Sybase Unwired Platform mobile application:

Mobile Business Objects (MBOs)

Define what data (attributes) will be available to display or edit and what operations (CRUD) can be performed on the data Designed using Sybase Unwired WorkSpace and deployed to the Unwired Server Necessary for both Mobile Workflow and Native applications Screens, controls, menus W kfl UIs Workflow UI are created t d using i the th M Mobile bil W Workflow kfl F Forms Edit Editor iin the Sybase Unwired WorkSpace Native UIs are created in IDEs like Xcode, Xcode Eclipse or Visual Studio using device platform SDKs

User Interface

1-7

Types of Sybase Unwired Platform Applications

Developers can create two types of applications:

Workflow

In Sybase Unwired Platform Workflow applications, there are no complex rules-based rules based decisions being performed performed, rather a more simple request-response type environment, such as:

Employee requests vacation, manager approves or denies

Sybase Unwired Platform Workflow applications are not the same pp as SAP Workflow applications Uses Hybrid Web Container technology Gives developer much more control of application development Allows access to more complex features on the device platform Requires more coding, knowledge and time

Native

1-8

Mobile Workflow Development Model


Connects To

1
Sybase Unwired Server
Deploy MBOs and Workflow

2
Assign Workflow

WebMobile Device

SybaseUnwired WorkSpaceisused forbothMBOand WorkflowUI Development l

1-9

Native Application Development Model


Connects C to

Data Source Integration

Device-Specific D i S ifi Development

1
Sybase Unwired Server
Deploy MBO code

2
Generate

MBO API

Sybase b Unwired WorkSpaceisusedfor MBODevelopmentand t Generate to G t Code C d for f useinanexternalIDE likeXcode

Device GUI

1 - 10

Data Synchronization Approaches

One of the challenges of building mobile applications is to keep the data in sync between the back-end EIS and the device

Mobile applications inflate this issue

Sybase Unwired Platform defines two data synchronization approaches h


Replication-based synchronization (RBS) Message-based synchronization (MBS)

1 - 11

Replication-based Synchronization (RBS)

Synchronizes data between a device database and the servers server s cache database
Provided by Sybase Mobilink technology Device D i database d t b is i Sybase S b Ultralite Ult lit

For occasionally-connected devices that need access to data when offline Best for devices that need to store large g amounts of data on the device Requires the device to initiate the synchronization Changes are sent in bulk to the EIS Used on Windows, Windows Windows Mobile, Mobile Android and BlackBerry platforms 1 - 12

Message-based Synchronization (MBS)


Bi-directional data changes are pushed immediately and automatically However, the developer can programmatically withhold transmission of the data by manipulating its status MBS is inherently asynchronous Used by iOS devices and Workflow applications

1 - 13

Introduction to Sybase S Unwired Platform f

MODU ULE E TO OPIC CS


1 - 14

Sybase y Unwired Platform Editions Sybase Unwired Platform Architecture

Platform Environment Options

Sybase Unwired Platform can support one of the following environment types:

Development and testing servers


All d developers l should h ld iinstall t ll th the P Personall D Development l tS Server The Enterprise Development Server can be used by individual developers OR used to set up a testing environment that more closely mirrors a production environment

Single node server Clustered or multi-node servers Multi-tenant M lti t t environments i t whereby h b ah hosted t d solution l ti can b be architected by creating domains for each tenant (owner)

1 - 15

Sybase Unwired Platform Components

Sybase Unwired Platform consists of two installable components:


Unwired Platform Runtime Sybase Mobile SDK Personal Development Server Enterprise p Development p Server Enterprise Server Sybase Unwired WorkSpace Native Object API HTML5 / JS Hybrid App API OData SDK

Sybase Unwired Platform is available in three server editions:


Sybase y Mobile SDK installs:


1 - 16

Personal Development Server

For use in development and testing systems only

Not for production systems

Requires Unwired Server and Sybase Mobile SDK to be i t ll d on th installed the same, single-user i l h t host

Does not support a clustered environment

Allows for a maximum of five registered devices (clients)

1 - 17

Enterprise Development Server

For use in development and testing systems only

Not for production systems

Allows installation and configuration of components on diff different t machines hi

Enterprise Development Server is a good choice for a UAT environment because it can be configured similarly to a production environment

Allows clustered systems Allows a maximum of 20 registered g devices ( (clients) )

1 - 18

Enterprise Server
Intended for use in a production environment Allows installation and configuration of components on different machines Allows clustered systems Number of CPUs and registered devices depends on licenses

1 - 19

Sybase Mobile SDK

Sybase Unwired WorkSpace

Eclipse plug plug-in in for development of mobile business objects and mobile workflow packages For development of native applications that use MBOs and custom code written in C#, Java or Objective-C For development of applications for simple business processes, such as approvals and requests, requests that also use MBOs to facilitate connection to an EIS For development of simple, mostly online applications that leverage OData protocol and RESTful Web Services

Native Object j API

HTML5 / JS Hybrid App API

OData SDK

1 - 20

Continued

Sybase Mobile SDK

Sybase OData SDK is a set of APIs used specifically for building native mobile applications that interact with OData channel models

Consists of a collection of runtime libraries and classes

OData SDK support:


Android BlackBerry iOS

Based on the native device SDKs of the platforms

1 - 21

Online Data Proxy

Online Data Proxy runtime is a light-weight edition of Sybase Unwired Platform


For deployment of OData applications Includes Sybase Control Center for Online Data Proxy

OData SDK applications:


Leverage a proxy connection to SAP EIS such as SAP Business Suite Essentially makes realtime SAP data available to mobile device users Uses RESTful OData p protocol to connect through g Unwired Server and SAP Gateway to SAP EIS

Data is available using a request / response method without synchronization h i ti

1 - 22

Class Labs

Each student will be provided a Virtual Machine on which the class labs are to be performed
The Sybase Unwired Platform Enterprise Development Server is already installed Details of the install will be covered in Module 2

1 - 23

Introduction to Sybase S Unwired Platform f

MODU ULE E TO OPIC CS


1 - 24

Sybase y Unwired Platform Editions Sybase Unwired Platform Architecture

Sybase Unwired Platform Components

The five distinct architectural components are:


1. 1 2. 3. 4. 5. Relay Server (optional) Unwired Server Data Tier Unwired WorkSpace Sybase Control Center (SCC)

1 - 25

Component 1: Relay Server


Acts like a reverse proxy, allowing devices to communicate through the firewall with the platform via commonly opened ports (such as port 80) Relay Server is a set of extensions running on top of a Microsoft IIS or Apache Web server Communications:

Devices send inbound communications through the Relay Server to the Unwired Server(s) Outbound traffic (from the Unwired Server) also flows through the Relay Server

1 - 26

Component 2: Unwired Server

The Unwired Server is:


An application server A container for MBOs

MBO are packaged MBOs k d and dd deployed l d to the h U Unwired i dS Server

A container for Workflow applications

A production scenario may have several Unwired Servers running in a clustered environment

1 - 27

Component 3: Data Tier

The Data Tier is a cache for mobile application data

Sybase Unwired Platform mobile applications do not talk directly to the EIS

In addition I dditi t to th the d data t cache, h th the D Data t Ti Tier manages clustering and monitoring databases A single Data Tier can service multiple Unwired Servers in a clustered environment

Requires running the Data Tier in a Microsoft Failover Cluster

1 - 28

Data Tier Databases

Consolidated Database (CDB)


Used specifically for RBS applications Caches runtime MBO data Must be a new or existing Sybase SQL Anywhere database

Messaging Database
Used specifically for MBS applications Contains a p permanent store of device connection information Is an embedded Sybase Advantage Database Server

1 - 29

Continued

Data Tier Databases

Cluster Database
Contains configuration information about the cluster A Sybase SQL Anywhere database

Monitoring Database
When enabled, used to collect server runtime metrics for analysis or troubleshooting Can be a Sybase SQL Anywhere or a Sybase Adaptive Server database

1 - 30

Sybase Unwired Platform Clusters

When you install Sybase Unwired Platform, a cluster is automatically created

Both the Server and Data tiers can be clustered

A server can b be a member b of f only l one cluster l t Clusters serve two common purposes:

Provide High-Availability / Failover Allow for Load Balancing g

Load balancing is implemented using O/S or third-party hardware and/or software solutions Can achieve primitive (round-robin) load balancing using the Relay Server only

1 - 31

Cluster Strategies

Single machine: a non-redundant environment typically used by a developer

Data and Server Tiers reside on same machine

2-node: 2 d a primitive i iti architecture hit t where h the th Data D t Ti Tier iis on one node, and the Server Tier is on another node

Typically used for Enterprise development and testing

3-node: an architecture with two Server Tier nodes and one Data Tier node N+2 2 nodes: a redundant architecture with multiple Server Tiers supported by a relay server(s) and two Data Tier nodes

1 - 32

Optimal Clustered Production Environment


EIS Relay Server 1 Unwired Data Tier Server 1 Node 1 Shared Data
RSOE

OS/3rd Party Load Balancer

Relay Server 2

RSOE

Unwired S Server 2

Data Tier N d 2 Node

Devices
1 - 33

DMZ

Server and Data Tier

Component 4: Unwired WorkSpace


A group of plug-ins that form an Eclipse perspective known as the Mobile Development perspective Uses of the Unwired WorkSpace include:

Manage Mobile Application Projects Design and deployment of MBOs Design deployment, Design, deployment and customization of Workflow applications Generate code to be used along with the client API to create Native applications Manage connections to EIS sources Explore EIS data

e.g. can drill down into an SAP BAPI to view its operations and then to view the operations p inputs/outputs p p

1 - 34

Unwired WorkSpace

1 - 35

Component 5: Sybase Control Center (SCC)


Unwired Server Administration tool Administrators Ad i i t t will ill use th the SCC t to:

Configure the environment

Users, security, etc.

Manage application components Monitor the health of the server

The e SCC is s an a Adobe dobe Flex e application app ca o that a runs u s in a b browser o se
Internet Explorer 6+ Firefox 3.5+ 3 5+ Requires the Adobe Flash plug-in 10+

1 - 36

The Sybase Control Center (SCC)

URL: https://hostname:8283/scc/

1 - 37

Sybase Control Center Service

A Windows Service that:


Provides runtime services to manage, manage monitor and control distributed Sybase resources Must be running for Sybase Control Center to run Previously called Sybase Unified Agent

1 - 38

Administration Architecture
Node n

Sybase Control Center


Browser
Flash Plug-in
HTTPS

Web Container
Sybase Unwired Platform Flex Web Application

RMI Service
SCC Plugin for Sybase Unwired Platform

Unwired Server
IIOPS IIOP

MB Bean Interfa ace

SNMP Client Custom Admin Java Client

SNMP Service
SNMP
Sybase Unwired Platform SNMP Plugin

RMI

Node 1

1 - 39

Supported Operating Systems

Sybase Mobile SDK:


Windows XP Professional with SP2,SP3 SP2 SP3 Windows Vista Business, Enterprise or Ultimate Edition with SP2* Windows 7 Professional, Professional Enterprise or Ultimate Edition with SP1* SP1

*32-bit as well as 64-bit versions (as WoW64)

Unwired Server Runtime and Data Tier:


Windows XP Professional with SP2, SP3 Windows Vista Business, Enterprise and Ultimate Edition with SP2 SP2* Windows 7 Professional, Enterprise and Ultimate Edition with SP1* Windows Server 2003 and 2008 Standard or Enterprise p Edition with SP2* Windows Server 2008 R2 Standard or Enterprise Edition

*32-bit as well as 64-bit versions

1 - 40

Connection Support

Java Database Connectivity (JDBC)


SQL Anywhere 11 11.x, x 12 12.x x Adaptive Server Enterprise 12.5.x, 15.x Microsoft SQL Server 2005 2005, 2008 Oracle 10g, 11g IBM DB2 UDB 9.1 91

SAP Connectors
SAP Java Connector (SAP JCo) 3.x 3x Web Services (WS-I Basic Profile 1.1)

Web Services Ser ices


WS-I Basic Profile 1.1 RESTful RESTf l services, i XML over HTTP(S)

1 - 41

Supported Client Platforms

Windows (for tablets, laptops)

XP Vista (32 and 64 bit) and Windows 7 (32 and 64 XP, 64-bit) bit)

Windows Mobile 6.0, 6.1 and 6.5 (Standard or Professional) Apple

iPhone 3GS/4 iOS 4.2 and iOS 4.3, iPod Touch 3rd/4th gen g with iOS 4.2 and iOS 4.3, iPad iOS 4.2 and iOS 4.3, iPad2 iOS 4.3

BlackBerry OS 5.0.x, BlackBerry OS 6.0.x Android 3.0, 2.3.3, 2.2

1 - 42

Development Support

Hybrid Web Container development:


Used for Sybase y Mobile Workflow applications pp Can deploy to Windows Mobile Professional, Android, iOS and BlackBerry platforms Windows

N ti application Native li ti d development: l t

C# / Visual Studio 2008 (.NET ( NET 3 3.5) 5) C# / Visual Studio 2008 (.NET CF 3.5) MacOS X 10.6 (Snow Leopard) with XCode 4.0.2 and iOS SDK 4.3 Java Plug-in for Eclipse version 1.3 Java Development Environment (JDE) v5.0/6.0 ADT 16.0.1 with Android SDK

Windows Mobile

Apple iOS

RIM BlackBerry

Android

1 - 43

Continued

Development Support

OData application development:

Android

Android SDK Tools Revision 12 A d id SDK Pl Android Platform tf tools t l Revision R i i 5 MacOS X 10.6 (Snow Leopard) with XCode 4.0.2 and iOS SDK 4.3 Java Plug-in for Eclipse version 1.3 Java Development Environment (JDE) v5.0/6.0

Apple iOS

RIM BlackBerry Bl kB

1 - 44

SAP and Relay Server Support


SAP BAPIs/RFCs can be accessed from the Sybase Unwired Platform Integrates with:

SAP R/3 R/3, 4 4.6 6 and d4 4.7 7 SAP ECC 5.0 and 6.0 Gateway 2.0 to SAP NetWeaver Mobile 7.1 (DOE) SAP Java Connector ( (JCO) ) 3.x

Relay Server:
IIS 6 6.0/7.0 0/7 0 or 7 7.5 5 on Windows (32-bit and 64-bit) Apache 2.2.8 (32-bit) or Apache 2.2.15 (32-bit and 64-bit) on Red Hat R5

1 - 45

Device Management
Sybase Unwired Platform does not perform any kind of device management Another Sybase product called Afaria is used specifically for device management

Does not ship with Sybase Unwired Platform

Device management encompasses:


Provisioning g Daily Management Decommissioning

1 - 46

Afaria and the Device Lifecycle


1. Provision
OTA Delivery of Afaria management client Install initial required applications Forces the device to prompt a user with a power power-on on password Encrypts data on the device Configures device settings

2.Production
3. Decommission Update applications with new versions / patches Back up device Software license usage / tracking Monitor the device Maintain device configuration settings

3. Decommission
Perform a remote kill of the device if it is lost Disable the device, networking applications If the user g gets a new device, , can re-provision/reimage device with existing configuration 1 - 47

Example Architecture
External Firewall BES (MDS) Server BlackBerry Carrier
HTTP 3200

Internal Firewall
HA available for Unwired Servers

Sybase Unwired Platform Domains Common CDB


Authentication via User/Password

HTTP(S) Data Change Notification

HTTPS - 443

CDB
Sybase Unwired Platform Production I
MBOs deployed to the Production Server

JDBC/JCOs/WS

EIS

HTTP/SSL

JDBC/JCOs/WS

Devices
Inbound Traffic Connects through Relay Server

Apple APNS Provider

Relay Server IIS or Apache


HTTPS 2195 gateway.push.apple.com HTTPS 2196 feedback.push.apple.com

HTTP(S) Data Change Notification

Sybase Control Center

Sybase Unwired Platform Production II


Sybase Unwired Platform Servers connect outbound to the Relay Server

LDAP Server

External Network 1 - 48

DMZ

Internal Network

SAP Mobile Gateway and Online Data Proxy

Sybase Unwired Platform interacts with SAP Mobile Gateway OData via the Sybase Online Data Proxy:

1 - 49

iOS Architectural Considerations

Application Deployment
APNS belongs to Apple, Apple Inc Inc. Apple Developer account required to access APNS iOS applications are signed and then deployed by pushing them through APNS to App Store Configure the APNS in the SCC under S Servers Server Configuration Messaging tab

1 - 50

iOS Architecture
External Network DMZ
Unwired Servers connect outbound to the Relay Server

Internal Network

Unwired Server Environment Runtime C Communications i ti


HTTPS - 443

Apple Devices

Device Inbound Traffic Connects through Relay Server Ports are configurable

HTTP:80/HTTP:443

Relay Server IIS or Apache


Get mobile App from App Store Data Channel 2195 gateway.push.apple.com Feedback Channel 2196 feedback.push.apple.com

App Store Apple pp APNS Provider

Wi-Fi Only Devices 5233

Application Deployment Communications

External Firewall

Internal Firewall

1 - 51

BES Architectural Considerations

BlackBerry Enterprise Server (BES) is proprietary middleware (MDS) required for communications with BlackBerry devices

Is not an internal component of Sybase Unwired Platform

Set up of the BES connection profile is performed via the SCC

1 - 52

Labs

There are no labs in this module

1 - 53

Module Summary

During the course of this module, you have learned:


The types of applications you can create with Sybase Unwired Platform Which devices and EISs are supported The architecture and components that make up the Sybase U i d Pl Unwired Platform tf Special considerations for iOS and BES deployment That there are three editions of Sybase Unwired Platform available

1 - 54

Module Post-Assessment
1. What is the Unwired WorkSpace in relation to Eclipse? 2 What is the general purpose of Sybase Control Center? 2. 3. Why would you use a Relay Server with Sybase Unwired Platform? 4. True/False. The Consolidated Database is the same thing as any other enterprise back-end database.

1 - 55

Sybase Unwired Platform 2.1 Mobile Application Development

Module 2: Enterprise Development Edition I t ll ti Installation


Copyright 2012 Sybase, Inc. All rights reserved. Unpublished rights reserved under U.S. copyright laws. Sybase, and Sybase logo, are trademarks of Sybase Inc., or its subsidiaries. indicates registration in the United States of America. SAP, and the SAP logo, are the trademarks or registered trademarks of SAP AG in Germany and in several other countries. All other trademarks are the property of their respective owners.

Module Pre-Assessment
1. Provide a concise description that differentiates Unwired Server and Unwired WorkSpace. WorkSpace 2. True/False. The Consolidated Database exists on the mobile device. device 3. Can a developer use Microsoft Visual Studio to develop an Sybase Unwired Platform mobile application?

2-2

Module Objectives

Upon completion of this module, you should be able to:


Describe installation prerequisites for the Enterprise Development Server Edition of Sybase Unwired Platform Perform an installation of the Enterprise Development Server and Sybase Mobile SDK Perform P f post t installation i t ll ti t tasks k on th the S Sybase b U Unwired i d Platform

2-3

Installation Prerequisites

MODU ULE E TO OPIC CS


2-4

Enterprise p Development p Server Installation Sybase Mobile SDK Installation Post Installation Tasks

Sybase Unwired Platform 2.1 Installation

Sybase Unwired Platform consists of two installable components:


Unwired Platform Runtime Sybase S b Mobile M bil SDK

Sybase Unwired Platform Runtime is available in three server editions:


Personal Development Server Enterprise Development Server Enterprise p Server

Unwired Platform Runtime and Sybase Mobile SDK must be downloaded and installed

2-5

Sybase Product Download Center (SPDC)

Sybase Unwired Platform and Sybase Mobile SDK can be downloaded from the SPDC at this URL:

https://sybase.subscribenet.com

You must Y t have h an account t to t log l into i t this thi web b site it License files required for software installation are also generated and downloaded from this site

License files are necessary y to install the Sybase y Unwired Server Runtime, Sybase Mobile SDK and for each of device client licenses purchased The installer will ask for the location of the license file

2-6

SPDC Listings for Sybase Unwired Platform

Sybase Mobile SDK

Enterprise Development Server


2-7

License Models

Served License:
Generic license Generated and loaded onto a Sybase SySam License Server that you download and install License Server software can be found at:

http://www.sybase.com/sysam

Un-served License:
Tied to the host name and MAC address of the machine Generated and used to install on a single g machine

2-8

Generating Licenses

After the Sybase Unwired Platform products are downloaded, license files must be generated at the SPDC for both the Unwired Server and Sybase Mobile SDK

Select the product from the product list and click License Keys

2-9

Continued

Generating Licenses

Select the appropriate license type for the software and click the Select to Generate button

2 - 10

Continued

Generating Licenses

Enter the Host ID and Host Name of the system where the software is to be installed

Host ID is the MAC or Physical Address

Generate G t the th license li file fil and d download d l d the th license li file fil t to th the system

2 - 11

Product Updates (EBFs)


Emergency Bug Fix (EBF) is a Sybase term for product updates Sybase product updates and EBFs can be found at:

h //d http://downloads.sybase.com l d b If you do not have one, there is a link to register

A different username/password is required to log into this site

Once logged in, choose the Sybase Unwired Platform to view a list of the available EBFs

2 - 12

Sybase Downloads Site

2 - 13

Unwired Platform Runtime Requirements

Operating System
Windows XP Professional with SP2 SP2, SP3 Windows Vista Business, Enterprise or Ultimate Edition with SP2 Windows 7 Professional, Enterprise or Ultimate Edition Windows 2003 and 2008 Standard or Enterprise Edition with SP2 Windows 2008 R2 Standard or Enterprise Edition

Approximately 3GB hard drive space Minimum of 4GB RAM

2 - 14

Sybase Mobile SDK Requirements

Operating System
Windows XP Professional with SP2 SP2, SP3 Windows Vista Business, Enterprise or Ultimate Edition with SP2

32-bit and 64-bit

Windows Wi d 7 Professional, P f i l E Enterprise t i or Ulti Ultimate t Edition Editi with ith SP1

Approximately 1.4 GB hard drive space

2 - 15

Installation Prerequisites

Visual Studio 2008 (with SP1):

Standard Professional or Team System Edition Standard,

.NET Framework 2.0 with SP2 Microsoft Windows Installer 3.1 or later Visual C++ Runtime ( (both 2005 and 2008 with SP1) )

The installer checks for these and installs them if they are not on the machine Required for Sybase Control Center (SCC) Required for Sybase Control Center (SCC)

Adobe Flash Player 11.x (recommended)

Internet Explorer 7.0 or 8.0 or Firefox 3.X

2 - 16

Classroom Virtual Machines

Enterprise Development Server and Sybase Mobile SDK are pre-installed pre installed on class Virtual Machines

Installation process is shown in the next section

All platform components reside on a single machine The Relay Server, Server BES or APNS are not available or necessary for this class

For the class labs labs, deployment and testing will be done on simulators

2 - 17

Installation Prerequisites

MODU ULE E TO OPIC CS


2 - 18

Enterprise p Development p Server Installation Sybase Mobile SDK Installation Post Installation Tasks

Prior to Installation

Before installing Sybase Unwired Platform, perform the following:


Ensure all prerequisites have been met or installed Shut Sh t down d any other th running i S Sybase b products d t or processes Verify that you are logged in with administrative rights

For Windows 7 and Windows Vista, temporarily disable User Access Control (UAC)

Due to a NetBIOS OS limitation, make sure the host name is fewer than 15 characters

2 - 19

Starting Installation

To install the Enterprise Development p Server:

Double-click setup.exe

Install program launches

2 - 20

License Types

Will be prompted to install a Served or Unserved license:

2 - 21

License Edition Selection

Choose the Enterprise Development Edition

Select the Development and Test License

Number of client licenses depends on the product edition to b iinstalled: be t ll d

2 - 22

License File Verification

If you are installing an Unserved license, must browse to the location of the generated license file

If installing a Served license, will be prompted for the address of the license server instead:

2 - 23

Installation Options

Select Unwired Platform Runtime

Online Data Proxy installation only includes functionality for the Online Data Proxy version of Sybase Unwired Platform:

2 - 24

Installation Types

For development and testing purposes, select Single server:

2 - 25

Additional Installation Options


Configure Unwired Platform communication ports allows review or change of default port assignments May set Sybase Unwired Platform services to start automatically

Most developers choose not to have the services auto-start

2 - 26

Default Port Assignments


Different ports can be assigned if the default ports are being used by other applications on the system Default port assignments for Sybase Unwired Platform are:

2 - 27

Set Password
To proceed, you must change the default password for the supAdmin user Must use this password to access the Sybase Control Center admin tool

Password must be at least 8 characters and contain only ASCII alphanumeric l h i characters h t

2 - 28

Installation Summary

Click Install to complete the installation:

2 - 29

Silent Install Option


Automate installation using the silent install batch utility SilentInstall_Win.txt SilentInstall Win txt - specify installation settings SilentInstall_Win.bat batch file to run the silent install Must M t specify if different diff t settings tti in i th the Sil SilentInstall_Win.txt tI t ll Wi t t fil file f for each installation type:

Mobile M bil D Developer l Cluster C Custom

Required silent install files are located at the root directory of the Sybase Unwired Platform install media

2 - 30

Installation Prerequisites

MODU ULE E TO OPIC CS


2 - 31

Enterprise p Development p Server Installation Sybase Mobile SDK Installation Post Installation Tasks

Installing Sybase Mobile SDK

Sybase Mobile SDK is a separate installable component


Can be installed on the same system as the server for development and testing purposes Download the SDK from the SPDC and generate a license key for installation:

2 - 32

Starting Installation

To install Sybase Mobile SDK:

Double-click setup.exe to launch the installer

Install the SDK to the default Unwired Platform directory: y C:\Sybase\UnwiredPl atform

2 - 33

Installation Completion

Installation status is displayed as components are installed:

2 - 34

Sybase Unwired Platform Desktop Icons

Following the installation of the Sybase Mobile SDK, SDK four icons are added to the desktop that can be used to:
Start Sybase Unwired Platform Services Stop Sybase Unwired Platform Services Start S the Sybase S Control C Center C (SCC) Start the Unwired Workspace (Eclipse)

2 - 35

Installation Prerequisites

MODU ULE E TO OPIC CS


2 - 36

Enterprise p Development p Server Installation Sybase Mobile SDK Installation Post Installation Tasks

Installation Directories Unwired Server

Key folders in the UnwiredPlatform directory: y

ClientAPI documentation and binaries for building native applications Eclipse the development IDE I t llL InstallLogs log l fil files created t d each time Unwired Platform is installed Unwired_Workspace all of the Eclipse plug-ins that make up th U the Unwired i dW Workspace k t tooling li IDE

2 - 37

The Servers Directory

Key folders In the Servers directory:

Advantage910 Ad t 910 and d MessagingServer Sybase Advantage Database server and other runtime files necessary for MBS-type applications SQLAnywhere12 Sybase SQL Anywhere database server and utilities necessary for RBStype applications UnwiredServer Runtime files of the platforms application server

2 - 38

Data Tier Databases

The Consolidated Database (CDB):

default db default.db sampledb.db

The Enterprise or EIS database for the lab exercises:

The custerdb, domainlogdb and monitordb databases are used in a clustered environment

2 - 39

Server Log File


Located at UnwiredPlatform\Serv ers\UnwiredServer\ logs The hostnameserver log file will be server.log helpful in debugging and/or troubleshooting:

2 - 40

Windows Services

Several Windows services are created during the installation:


Advantage Database Server Sybase Control Center 3.2 Sybase Unwired CacheDB Sybase Unwired SampleDB Sybase Unwired Server

2 - 41

Sybase Unwired Platform Services

2 - 42

Starting the Platform Services

Click the desktop icon and a command window will launch to indicate that the Unwired Server is starting:

2 - 43

Logging Into Sybase Control Center

User: supAdmin p Pwd: password defined during installation


2 - 44

BlackBerry Software Requirements

BlackBerry development can be done with either the:


BlackBerry Java Development Environment (JDE) Versions 5.0 and 6.0 are supported BlackBerry Eclipse Plug-in version 1.3

Available from: http://na.blackberry.com/eng/developers/javaappdev/devtools .jsp Testing BlackBerry applications can be done with a simulator

Simulators are installed with the JDE or the Plug Plug-in in

2 - 45

Installing BlackBerry JDE


BlackBerry JDE is installed to C:\Program Files\Research In Motion During development, the MDS (middleware) and a simulator will be used extensively:

2 - 46

Installing BlackBerry Eclipse Plug-in

After downloading the installation files, run the BlackBerry Eclipse plug plug-in in installer (setup.exe) and accept the default installation directory of:

C:\Eclipse p

After the install is complete, copy the contents of the plugins and features directories from the above folder and paste p them under:
C:\Sybase\UnwiredPlatform\Unwired_Workspace\Eclipse\syba y p p y se_workspace\mobile\rclipse\features C:\Sybase\UnwiredPlatform\Unwired_Workspace\Eclipse\syba se_workspace\mobile\rclipse\plugins k \ bil \ li \ l i

This allows you to use the plugin within the Sybase Unwired W kS WorkSpace Eclipse E li environment i t

2 - 47

Windows Mobile Requirements

Windows Mobile applications require:


Windows Mobile 6 or 6 6.5 5 SDK .NET Compact Framework version 3.5

These are freely downloadable from the Microsoft web site For y your convenience, they y have already y been installed on the classroom Virtual Machines

2 - 48

SAP Java Connector (JCo)


Used to access BAPI/RFCs on SAP systems Install the SAP JCo version 2.1.x 21x

Installation of connector is not part of the Sybase Unwired Platform installation

JCo files can be downloaded from the SAP web site There are two DLLs (librfc32 (librfc32.dll dll and sapjcorfc sapjcorfc.dll) dll) and one JAR file (sapjco.jar)

Installation directories for these files depends on your Windows Operating System

2 - 49

Labs
Lab 2-1: Installing SAP Java Connector Files Lab 2-2: 2 2: Starting Sybase Unwired Platform

Task 1: Start Sybase Unwired Platform Services Task 2: Start and Explore the Sybase Control Center

Lab 2-3: Reviewing g the Sybase y Unwired Platform Developer p Edition Installation

2 - 50

Lab Debriefing
What did you do and why? What went well in the lab? What insights did you get during the lab? What did you observe in the lab? What did you find challenging? Add any items to your troubleshooting list

2 - 51

Module Summary

During the course of this module, you have learned:


Necessary prerequisites for the Sybase Unwired Platform Development Edition How to perform an installation of Sybase Unwired Platform In order to test your mobile application, you will need the Bl kb Blackberry and/or d/ Windows Wi d Mobile M bil development d l t kits kit How to prepare the SAP Java Connector for SAP access

2 - 52

Module Post-Assessment
1. True/False. Eclipse is a prerequisite for the Sybase Unwired Platform installation. installation 2. True/False. Visual Studio 2008 is a prerequisite for the Sybase Unwired Platform installation. installation 3. True/False. A license is required to run Sybase Unwired Platform in a development environment. 4. True/False. Developers will always want to set their Sybase Unwired Platform services to start automatically. y JDE is installed as p part of the 5. True/False. The Blackberry Sybase Unwired Platform installation.

2 - 53

Sybase Unwired Platform 2.1 Mobile Application Development

Module 3: Introduction to the Unwired W kS WorkSpace


Copyright 2012 Sybase, Inc. All rights reserved. Unpublished rights reserved under U.S. copyright laws. Sybase, and Sybase logo, are trademarks of Sybase Inc., or its subsidiaries. indicates registration in the United States of America. SAP, and the SAP logo, are the trademarks or registered trademarks of SAP AG in Germany and in several other countries. All other trademarks are the property of their respective owners.

Module Pre-Assessment
1. What is Eclipse? 2 Before any kind of development can be performed 2. performed, what must you launch in Eclipse? 3. What must be created before you can begin development in an Eclipse-based environment?

3-2

Module Objectives

Upon completion of this module, you should be able to:


Navigate within the Unwired WorkSpace Use each of the views provided by Unwired WorkSpace Connect Unwired WorkSpace to a back-end database, an SAP ECC system and to an Unwired Server Create a workspace and project in preparation for mobile application development

3-3

Introduction to the Unwired WorkSpace S (Eclipse) ( )

MODU ULE E TO OPIC CS


3-4

Configuration g of the Unwired WorkSpace p Beginning Development

Starting Unwired WorkSpace

Either go to Start Programs Sybase or use the desktop icon

Choose a workspace location

Thi is This i where h your E Eclipse li projects j t will ill b be stored t d

3-5

Unwired WorkSpace Welcome Screen

3-6

Eclipse Perspectives

The Eclipse Workbench is extensible through plug-ins Plug-ins Plug ins can add new perspectives into Eclipse

Unwired WorkSpace plug-in adds the Mobile Development perspective

An Eclipse perspective can add views views, editors editors, wizards wizards, menus and toolbars to the Eclipse Workbench Views p provide ways y to navigate g and work with resources Editors provide tools to create and modify resources Wizards guide you through the process of creating artifacts necessary to build applications

A mobile application project is created with a wizard

Menu bars, toolbars and context menus provide the items you need to create and manipulate project artifacts

3-7

Unwired WorkSpace and Perspectives


When you start the Unwired WorkSpace, the Mobile Development perspective is automatically opened If the Mobile Development perspective is not opened, open it by choosing the Window Open Perspective menu item Mobile Development:

3-8

Unwired WorkSpace User Interface


WorkSpace Navigator contains all project files Enterprise Explorer contains all connection profiles Diagram Window contain all project diagrams

Problems Tab displays any warnings or errors generated Properties View displays the object in focus properties

3-9

Makeup: Mobile Development Perspective

Mobile Development perspective contains several views:


WorkSpace Navigator Enterprise Explorer Palette Properties Problems Outline

In addition addition, there are:


Wizards Editors Context Menus Toolbars and Menu Men Items

3 - 10

WorkSpace Navigator View


Is the developers focal point When you start Eclipse you specify Eclipse, the Workspace folder A workspace is a container of projects Projects contain MBOs as well as other entities, such as Workflow diagrams (*.xbw)

3 - 11

Project Closed

WorkSpace Navigator Context Menu

Common tasks are:

Open in Diagram Editor

Opens the Mobile Application Diagram

Search Import I t / Export E t Close Project

3 - 12

Enterprise Explorer View


Developers need access to EIS data to create MBOs The Enterprise Explorer is where connection profiles to EIS sources are defined:

Database D t b Servers S SOAP and REST Web Services SAP Servers

You can also view the repository p y of Unwired Servers here

3 - 13

Palette
The Palette will contain different items depending on which editor is active The Palette shown is for the Mobile Application Diagram

Click Cli k on an it item, lik like Mobile Business Object and then click Object, to drop it onto the diagram

3 - 14

Properties View
Entities such as MBOs contain many properties Property values can be set in this view Most of the design work for an MBO is performed here:

Watch for tabs

Watch for tabs

3 - 15

Customizing Views
Properties view displays across the bottom of the Unwired WorkSpace Given that there are many tabs with many properties, it will be difficult to work in such a small area Use the icons on the top right of the Properties View to maximize/minimize as you work:

3 - 16

Problems Visible in WorkSpace Navigator


Icons are used in WorkSpace Navigator to visually display project errors and warnings When these icons appear, go to the Problems view to see details and potential troubleshooting tips

3 - 17

Problems View

Displays errors and/or warnings

Not contextual, contextual displays all open projects projects errors and warnings This action takes you to the specific location (screen, MBO, etc.) where the warning or error occurred

Line items in the Problems View may be double-clicked

3 - 18

Outline View

Shows a thumbnail sketch of the contents of an editor:

Click these icons to configure the Outline view for graphical or list orientation

3 - 19

Wizards
The Mobile Development perspective contains wizards that simplify common development tasks For example, example wizards help with:

The creation Th ti of f MBO MBOs The deployment of MBOs O to the Unwired Server

3 - 20

Mobile Application Diagram Editor

An editor for graphically designing MBOs and defining their relationships

MBOs are the cornerstone of mobile applications

To create an MBO, either:


Drag a source (table, D (t bl BAPI Operation, etc.) from the Enterprise Explorer to the diagram Use the Palette to add an MBO to the diagram

3 - 21

Mobile Application Diagram Context Menu


Right-click to access the context menu Common tasks here include:

Add MBO Filter Switch Developer Profile Generate Code Deploy Project

3 - 22

Available Online Help


An online help system is navigated using the Eclipse-based help engine Access to a PDF version of the document is also provided using a link in each help help book

3 - 23

Context Sensitive Help


Many wizard screens contain a Question Mark icon Click the icon to reveal context contextspecific help

3 - 24

Opened this view

Clicking here

Developer Profiles

Unwired WorkSpace provides two developer profiles:

Basic

Limits the visible functionality of the Perspective Enables the full functionality of the Perspective Enables advanced screens in the wizards

Advanced

3 - 25

Functionality by Enabled Profile


Basic Profile Advanced Profile

3 - 26

Perspective Preferences

Select the menu item Window Preferences to access settings that can alter the way in which Eclipse works:

3 - 27

Introduction to the Unwired WorkSpace S (Eclipse) ( )

MODU ULE E TO OPIC CS


3 - 28

Configuration g of the Unwired WorkSpace p Beginning Development

Connection Profiles

Before development can begin connection begin, profiles are necessary for:

EIS Sources

Database Web Services SAP

Unwired Server

The sample profiles shown here are installed with the product

3 - 29

Sample Database

My Sample Database is installed with the p platform


It is a Sybase SQL Anywhere database Used as an example EIS data source The My Sample Database Connection Profile is automatically created in Unwired WorkSpace

Rightclick

Right-click the My Sample Database connection p profile to connect to that EIS

3 - 30

Database Connection Profile Properties

Default password for SQL Anywhere databases is: sql

3 - 31

Creating a New Database Profile Step 1

Start by right-clicking over the Database Connections node:

3 - 32

Creating a New Database Profile Step 2


Choose the appropriate JDBC driver for your backend database In this example, example we are connecting to Microsoft SQL Server Provide a name for this connection profile f

3 - 33

JDBC Drivers
Only JDBC drivers for Sybase are installed with Sybase Unwired Platform For Microsoft, Oracle or IBM drivers, they must be downloaded from:

http://msdn.microsoft.com/en-us/data/aa937724.aspx http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/in dex.html http://www306.ibm.com/software/data/db2/express/download.html

3 - 34

Microsoft JDBC Driver Installation


Microsofts JDBC driver is downloaded as an *.exe that you run and place into a specified folder Copy sqljdbc.jar sqljdbc jar to ..\Servers\UnwiredServer \lib\3rdparty Restart the Unwired Server

3 - 35

Creating a New Database Profile Step 3

After installation of the JDBC driver, click the Add icon to locate the driver:

Click here to add the driver to Unwired WorkSpace


3 - 36

Creating a New Database Profile Step 4


Click Add JAR/Zip Navigate to the appropriate folder and select the JAR file:

3 - 37

Creating a New Database Profile Step 5


Once installed and configured select the driver configured, from the dropdown list Provide typical database connection information

Database D t b name, server host name/port and login credentials

Verify setting by clicking the T t Connection Test C ti button b tt Click Finish to complete the database profile

3 - 38

New Database Profile - Completed

Right-click the new Database Connection Profile to connect and to navigate through database objects and schema

3 - 39

Unwired Server Connectivity

A server connection profile named My My Unwired Server is provided

Use this profile to connect and view the servers repository

Connection profiles to other Unwired Servers can be created by rightright clicking on the Unwired Servers node

3 - 40

Unwired Server Connection Profile Properties

Port 2000 was configured during g the installation


3 - 41

Default password is set during installation

Connected Unwired Server

Domains allow server partitioning

One domain, named default is created at default, installation

Packages are containers of MBOs that have been deployed to Unwired Server Workflow applications are also l d deployed l dt to 3 - 42 the server

Creating an SAP Connection Profile


Connection profiles for SAP are needed if using the Java Connector (JCo) Right-click over the SAP Servers node in the Enterprise Explorer to start the wizard and name your new profile:

3 - 43

Sample SAP Connection Profile

Requires:
Host Name or IP Address of the SAP Application Server System ID and number Client ID User U Name N Password

Connection details are provided by an SAP Administrator

3 - 44

SAP Connected View

After connecting to the SAP application server, server you can navigate modules and review details of BAPIs in each module:
BAPI O Operation ti Inputs/Outputs

3 - 45

Introduction to the Unwired WorkSpace S (Eclipse) ( )

MODU ULE E TO OPIC CS


3 - 46

Configuration g of the Unwired WorkSpace p Beginning Development

High-Level Development Flow

3 - 47

Mobile Application Development Steps


Step 1: Create a Mobile Application project Step 2: Create Mobile Business Objects (MBOs) using the Mobile Application Diagram editor Step 3: Configure MBOs, e.g. create relationships Step 4: Deploy MBOs to Unwired Server Step 5: Depends on type of application being built

Native applications - use the Generate Code option and then set up projects in the IDE of your choice (Visual Studio, Eclipse, p , Xcode) ) Mobile Workflow applications - create a new Workflow Forms Editor diagram and create screens for the workflow

3 - 48

Step 1: Create Mobile Application Project

Click the New icon on the toolbar and choose the Mobile Application Project wizard

3 - 49

Naming the Project

The mobile application project must be given a name:

3 - 50

New Project Completed


The new project is basically a set of empty folders A blank Mobile Application Diagram is opened The next step is to create MBOs for the project

3 - 51

Project Folders

These folders are created for each project:

Mobile Business Objects

Lists of each MBO that has been created Lists which EIS data sources have been referenced by the MBOs MBO data d is i cached h d in i the h Consolidated C lid d Database D b (CDB) Defines options and schedules for refreshing data A mechanism that allows the user to provide runtime input to the load or synchronization parameters of an MBO Continued

D t S Data Source R References f

Cache Groups

Personalization Keys

3 - 52

Project Folders

Roles

Secures access to an MBO and its operations Defines when changes are sent to the Unwired Server Contains project-level deployment profiles Java classes used to filter results before the data is passed down to the client Client-side code used for development of Native mobile applications

Synchronization Groups

Deployment

Filters

Generated Code

3 - 53

Project Files
Below is how the LosLogos project appears in the file system Moving a project from one machine to another requires copying all project-related directories and files:

3 - 54

Adding an Existing Project


Use the Import feature in Unwired WorkSpace Choose General and specify Existing Projects into Workspace

3 - 55

Import: Project Selection and Completion

A project can be imported from the file system OR by choosing a ZIP file:

*** Remember to check the errors via the Problems View

3 - 56

Exporting Projects

Unwired WorkSpace provides an Export feature

Useful if you need to share a project with other developers Right-click in a null area of th W the WorkSpace kS N Navigator i t Select Export

To export:

Can export to a File System or as an Archive file

3 - 57

Export Details
Provide necessary details for creating a file system or archive Resulting ZIP file will contain everything needed to import the project to another developers Unwired WorkSpace

3 - 58

Can select ZIP or TAR archive hi format

Labs

Lab 3-1: Navigating the Unwired WorkSpace


Task 1: Set Up the Student Development Directories Task 2: Start and Explore Unwired WorkSpace Task 3: Set up Database Connectivity Task 4: Add an Existing Project and Explore Contents/Views Task 5: Create a New Project for the Student Application

Lab 3-2: Creating g an SAP Connection Profile

3 - 59

Lab Debriefing
What did you do and why? What went well in the lab? What insights did you get during the lab? What did you observe in the lab? What did you find challenging? Add any items to your troubleshooting list

3 - 60

Module Summary

During the course of this module, you have learned:


Unwired WorkSpace is essentially an Eclipse plug-in plug in How to maneuver within Unwired WorkSpace What is needed in order to begin the development of a mobile application

A WorkSpace and project Mobile application diagram Database or other EIS Connections Unwired Server Connections

3 - 61

Module Post-Assessment
1. True/False. A WorkSpace is a physical file. 2 What is the name of the Sybase Unwired Platform Eclipse 2. Perspective? 3. True/False. A WorkSpace can contain multiple projects. 4. Which view is used mostly, when configuring application components?

3 - 62

Sybase Unwired Platform 2.1 Mobile Application Development

Module 4: MBO Design, Development and D l Deployment


Copyright 2012 Sybase, Inc. All rights reserved. Unpublished rights reserved under U.S. copyright laws. Sybase, and Sybase logo, are trademarks of Sybase Inc., or its subsidiaries. indicates registration in the United States of America. SAP, and the SAP logo, are the trademarks or registered trademarks of SAP AG in Germany and in several other countries. All other trademarks are the property of their respective owners.

Module Pre-Assessment
1. True/False. Mobile Business Objects only reside on the mobile device. device 2. Regardless of type, MBOs will ALWAYS contain:
a. b. c. d. SQL Java code Attributes Operations p

3. True/False. Oracle 11g is a supported back-end database for Sybase Unwired Platform.

4-2

Module Objectives

Upon completion of this module, you should be able to:

Create MBOs from:


SAP BAPIs Web Services (both SOAP and REST) Databases (tables and stored procedures) Drag-n-drop from f the Enterprise Explorer Start the Wizard via the Palette

Create MBOs using either of the following methods:


Create relationships between MBOs Create Personalization Keys Better understand MBO properties including:

Load and/or Synchronization Parameters

Deploy p y MBOs to an Unwired Server

4-3

MBO O Basics

MODU ULE E TO OPIC CS


4-4

MBOs from SAP BAPI MBOs from SOAP Web Services MBOs from REST Web Services MBOs from a Tables/Stored Procedures Advanced MBO Topics Deploying MBOs to Unwired Server

Mobile Application Requirements

In order to create any Sybase Unwired Platform mobile application (Native or Workflow), Workflow) two components are necessary:
Mobile Business Object(s) MBOs User Interface

MBOs are always designed using the Unwired WorkSpace

They are always deployed to an Unwired Server

Native UIs are created with the IDE of your choice Workflow UIs are created with the Unwired WorkSpace

Mobile Workflow Forms Editor

4-5

MBO Defined

An MBO is like any object in the programming world, it is a container of attributes and operations
Attributes define the data-makeup of the object Operations O ti d define fi what h t th the object bj t iis capable bl of fd doing i

Native and Workflow applications will contain screens which display and allow editing of data
The fields displayed/edited are derived from an MBOs attributes The types of changes allowed depend on the MBOs operations

4-6

Sample Mobile Application Diagram / MBOs

A typical Mobile Application Diagram will contain many MBOs:

4-7

The + symbol to the left of the id attribute indicates a primary key

MBO Properties View


MBOs have many properties The properties view contains nested tabs and is where you will perform most of your object configuration:

4-8

MBO Attributes

Attributes are mapped to a data source when the MBO is created

For example, if the data source is a database table, the attributes are mapped to columns from the SELECT statement

4-9

MBO Operations

Operations have a name and a type


The operation types are CREATE UPDATE, CREATE, UPDATE DELETE, DELETE OTHER OTHER does not allow data manipulation

Operations can be edited from the Definition tab in the Properties view Operations can have parameters to provide id iinput

4 - 10

More About Parameters


Parameters can be defined as nullable, updatable or required Parameters are assigned their value from attributes, attributes Personalization Keys or Default Values:

4 - 11

Personalization Keys
Mechanism to allow mobile application users to provide input to the parameters of an MBO May be created in the Unwired WorkSpace or the SCC

4 - 12

More on Personalization Keys Properties

Protected property

Obfuscates the values stored in the key so that they are more secure Can be set to:

St Storage property t

Server values are stored in the CDB Client values are stored in the device local database Transient values are stored in memory

Transient is required when the Personalization Key is used in the context t t of faW Workflow kfl application li ti

4 - 13

System Defined Personalization Keys


Username and password are system-defined personalization keys Represent the credentials supplied when the user logs into the mobile application These credentials can be passed to the EIS source from f the h mobile bil application

4 - 14

Operations and SAP BAPIs

The prior examples showed a table-based MBO

Operations invoked CREATE/UPDATE/DELETE SQL statements

If th the MBO were sourced d from f a BAPI BAPI, no SQL would ld b be written but you would still have CREATE, UPDATE and DELETE type t operations ti
The BAPI-based MBO will call some other BAPI operation in order d t to perform f th the d data t manipulation i l ti More on BAPI-based MBOs and updates will be discussed l t iin thi later this module d l

4 - 15

MBO Relationships
In a relational database tables are related using Primary/Foreign keys MBOs can be related in a similar fashion Relationships must be manually created by the developer in U i d WorkSpace Unwired W kS

Relationships can be one-to-many, many-toone, or one-to-one

4 - 16

MBO Roles

Logical entities that control which users or groups can access an MBO

Provide user authorization before the request goes to the back end system (database, back-end (database SAP SAP, etc etc.) )

Sybase Unwired Platform roles work in conjunction with physical h i l roles, l which hi h reside id iin th the underlying d l i security it provider (i.e. LDAP server)

4 - 17

Role Assignments
A role can be assigned to individual or multiple MBOs A role can grant access to an operation within an MBO for security granularity

4 - 18

MBO O Basics

MODU ULE E TO OPIC CS


4 - 19

MBOs from SAP BAPI MBOs from SOAP Web Services MBOs from REST Web Services MBOs from a Tables/Stored Procedures Advanced MBO Topics Deploying MBOs to Unwired Server

BAPI / RFCs

Both SAP BAPI and RFCs can be the source of a MBO


BAPI Business Application Programming Interface RFC Remote Function Call

Any given BAPI might contain one to many operations which can be called from the MBO SAP includes several BAPIs, such as:

Posting g a sales order Listing employee benefits Changing passwords Tracking a shipment

4 - 20

Methods to Access BAPI

BAPI/RFCs can be accessed from SUP using either:


The SAP/JCo (Java Connector) SOAP Web Service

If your SAP Administrator Ad i i h has exposed d the h BAPI as a (SOAP) Web Service, the BAPI can be accessed via the SOAP methods

The creation of an SAP connection profile was demonstrated earlier

4 - 21

SAP MBO Development Overview

Create an SAP Connection Profile

Connect to an SAP Server Via the Enterprise Explorer or the Browse BAPI feature Provide default values or Personalization Keys as input

Identify the SAP BAPI/RFC to use in the MBO

Identify y Input p Parameters

Identify Output Preview execution

4 - 22

Ready to Create SAP MBO

To start, go to the Mobile Application Diagram

This was created automatically when you created the Mobile Application Project

Check Ch k th the t tabs b across th the t top of f th the Edit Editor view i and d select l t the one named Mobile Application Diagram:

4 - 23

Creating MBOs Using the Palette

Click Mobile Business Object in the Palette and click again to drop the MBO onto the diagram

This starts the New Mobile Business Object Wizard

Once selected, O l t d click li k anywhere in the diagram to start t t the th wizard i dt to create t th the MBO

4 - 24

Using the New MBO Wizard


Name the MBO and click Next.. For F a BAPI BAPI-driven di MBO MBO, choose h th the SAP d data t source t type and connection profile:

2 1
4 - 25

Development Methodologies

When creating Mobile Business Objects, choose either:

Bottom up approach Bottom-up

EIS Data Source already exists mapping is automatic EIS Data Source does not yet exist Mapping will be manual once the data source is created Bottom-up approach Top-down approach

T d Top-down approach h

4 - 26

SAP MBO Definition WizardBAPI Selection


SAP systems contain many BAPIs Browse feature allows you to quickly find a specific BAPI

1. Click 1 Cli k the th B Browse button 2 Enter filter criteria 2. 3. Choose the appropriate BAPI/ Operation

4 - 27

Searching for RFCs


The prior page gives an example p of browsing g BAPI operations Specific RFCs can also be found by clicking the Search button

Wildcards ( * ) can be used

After the BAPI Operation/RFC has been chosen, the next step is to define Inputs and Outputs

4 - 28

Define Input and Output Parameters

These three options will be discussed in d t il starting detail t ti on page 37


4 - 29

Providing Defaults for Read Parameters

4 - 30

Operation Return(s) to Attribute Mapping

4 - 31

Completed SAP MBO

An BAPI-sourced MBO looks similar to any other type of MBO


Database SOAP Web Service REST S Web Service S

The result of the process just presented is a read-only MBO Operations p have to be added to the MBO to allow for updates to the SAP system y

4 - 32

Input Parameters via Structures


Some operation input parameters, such as the GetList BAPI operation use structure (complex) types operation, You must know which of the structure attributes are required to successfully execute the operation

4 - 33

SAP MBO Structures

The following diagram does not contain three MBOs

It is one MBO (FlightList) and two structures

4 - 34

Quick Test of MBO

Right-click over any MBO and choose Preview to test the data that will be returned to the device:

4 - 35

Sample MBO Preview


Click the Preview button to fetch the data Select Save as default values to use these values for the MBO read parameters

A quick test mechanism h i

4 - 36

Runtime u t eC Credentials ede t a s

4 - 37

Runtime Credentials

The system-defined Personalization Keys (username and password) can be passed to an SAP system at runtime, runtime as a means for each user to authenticate themselves

4 - 38

Result esu t C Checker ec e

4 - 39

Result Checker

Web Service and SAP MBO operations do not all use the same error reporting techniques

Result Checkers do not apply to database-driven MBOs

Result R lt Ch Checkers k are J Java classes, l created t db by Developers, D l that implement custom error handling for MBOs: Check each field for errors Implement p logic g that determines what constitutes an error If you choose to Create a new Result Checker, you will be prompted to add the Java nature to your project

4 - 40

Definition of Java Result Checker

Create a new Result Checker using the wizard:


Provide a Package and Class name Which interface is implemented depends on the kind of MBO (SAP, SOAP or REST)

Automatically assigned g

4 - 41

Result Checker Project Artifacts


After you create the Result Checker class, class the project will contain a Filters folder with the Java source file representing the Result Checker The source is then opened and coded

4 - 42

WSResultChecker Interface

Defines a method named checkReturn(SOAPEnvelope)

The parameter is the SOAP Envelope returned when the operation is executed Use the SOAP API to retrieve returned values to see if the operation i was successful f l Returns a single Map.Entry<Boolean, String>

Boolean key set to true if operation was successful

If the String value is not empty/null, it contains a warning message which will be logged on the server String value thrown in body of an exception Error logged on server Client will receive transaction log indicating failure

Boolean key set to false if operation was unsuccessful


4 - 43

RestResultChecker Interface

Defines a method named checkReturn

Contains three parameters:


HTTP responseBody as a String responseBody B d as a Li List t

In the form {header1, value1}, {header2, value2},

httpStat sCode as an Int httpStatusCode

4 - 44

SAPResultChecker Interface

Defines a method named checkReturn(com.sap.mw.jco.JCO.Function) ( p j )


The parameter is the JCo function that is executed Use the JCo API to retrieve returned values to see if the operation was successful The checkReturn method returns a single Map.Entry<Boolean, String>

Boolean ke key set to tr true e if operation was as s successful ccessf l If the String value is not empty/null, it contains a warning message g which will be logged gg on the server Boolean key set to false if operation was unsuccessful String value thrown in body of an exception Error logged on server Client will receive transaction log indicating failure

4 - 45

Partial Code - Result Checker

4 - 46

Result esu t Set Filters te s

4 - 47

Result Set Filters


Java classes created by developers and used to customize the data returned when calling an EIS operation Lets developers manipulate the data returned from a read operation before storing it into the Unwired Servers CDB Multiple Result Set Filters may be created and chained together, applying incremental change to the data

4 - 48

More Reasons for Result Set Filters

MBOs can only get their data from a single EIS source

Database table table, SAP BAPI Operation Operation, Web Service function You can:

A Result Set Filter goes beyond simple filtering

Add, delete, change columns Add and delete rows Augment the output by reading from other EIS sources

4 - 49

Definition of Result Set Filter Class


Create a new Result Set Filter using the wizard Provide a Package and Class name Interfaces to be implemented are automatically assigned

4 - 50

Result Set Filter Project Artifacts


After you create the Result Set Filter class class, the project will contain a Filters folder with the Java source file representing the Result Checker The source is then opened and coded

4 - 51

Partial Code - Result Set Filter

4 - 52

Performing SAP Updates

4 - 53

Performing SAP Updates


MBOs built using the Palette contain no operations, only attributes To perform CRUD operations on an SAP system, you must add operations to the MBO This is done by clicking Add in the Properties view:

4 - 54

SAP Create Operation

Begin the creation of an MBO operation by specifying the:


Operation Name Operation Type Data Source S Type Connection Profile

4 - 55

Associate BAPI Operation to MBO Operation


Use the Browse feature to find the appropriate BAPI / Operation This is the same process used when creating the MBO In this example, we are calling the SAP S CreateFromData operation

4 - 56

Specify Input/Output to BAPI Operation

Result Checkers only pp y to MBO apply operations


4 - 57

Testing Create Operations


Use the Test Execute button to ensure that you have chosen all of the required inputs Need knowledge of the BAPI operation you are calling (what is and is not required) before you create the MBO operation

If you do not have this information, Test Execute will let you, b trial-and-error, by ti l d d t i operation determine ti iinput t requirements i t

The only way to fully test a CREATE operation is to build the UI and test as the user would on the device / simulator

4 - 58

Test Execute Failed Scenario

Customer name was not included in the BAPI operation input parameters, so the execution failed:

4 - 59

Test Execute Success Scenario

Execute was successful, and new customer number was returned:

4 - 60

Committing SAP Changes

Commit SAP Operation (Auto Commit) is enabled by default and can only be changed by editing the operation:

4 - 61

MBO O Basics

MODU ULE E TO OPIC CS


4 - 62

MBOs from SAP BAPI MBOs from SOAP Web Services MBOs from REST Web Services MBOs from a Tables/Stored Procedures Advanced MBO Topics Deploying MBOs to Unwired Server

Introducing Web Services


Web Services can execute on any platform and be written with any language Fundamentally a collection of remote function calls To access a SOAP web service, you need to know:

The location of the service The function name What the function returns What the function takes in as parameters

Information about a SOAP Web Service is available in the WSDL (Web Services Definition Language) document

Creators of the Web Service should provide the WSDL

4 - 63

Supported Web Services

Web Service MBOs can be sourced from either SOAP or REST Web Services
SOAP (Simple Object Access Protocol) Web Services offer the traditional standards-based standards based approach to Web Services REST (REpresentational State Transfer) Web Services are the newer and more popular type of Web Service

REST uses the HTTP protocol instead of SOAP, SOAP making REST simpler to implement

4 - 64

Web Service Connection Profile


Like SAP BAPI-driven MBOs SOAP Web Service MBOs, MBOs require a connection profile Begin by right-clicking the Web Services node in the Enterprise Explorer to start the Connection Profile wizard

4 - 65

WS Connection Profile Wizard


Name the profile, click Next, and provide the WSDL location If basic authentication is required by the service, service enable HTTP authentication, and enter a user name and password Test the connection

4 - 66

Connecting to the Web Service


The new Web Service profile is not connected by default Right-click Right click on a Web Service profile and select Connect from the context menu

4 - 67

Web Service Bindings

Web Service details displayed include:

One SOAP binding

ISt kQ t S i IStockQuoteService GetStockQuote G S Q GetWorldMajorIndices

Two operations

4 - 68

Web Service Function Details


Exploring the function reveals the types and number of inputs and outputs This example takes in request (String containing a Stock Symbol) and returns a complex type (structure) containing t i i many elements l t such as date, high, low, last, etc. etc

4 - 69

Creating the MBO from the Web Service

Drag the Web Service function from the Enterprise Explorer to the Mobile Application Diagram
4 - 70

Mapping Function Return to Attributes


The Web Service function in this example returns stock data for a given stock symbol Data returned will be mapped as attributes of the new MBO

4 - 71

Confirming Attribute Creation


Confirm the method and bindings to be used

Click the Preview button to test the Web Service

4 - 72

Testing the Web Service

When you click the Preview button (on the prior screen), the wizard requests argument values Click Preview Web Service will then return the data

Data Returned

4 - 73

Selectively Defining Attributes


Click the Edit button Click the Generate XSLT radio button Can omit elements that are not wanted d as MBO attributes tt ib t

4 - 74

Resulting Web Service MBO


The SOAP Web Service MBO di displays l on th the Mobile Application Diagram i the in th same way as a SAP BAPI-driven MBO Notice, there are no operations, making this a read-only MBO

4 - 75

Updating Data via SOAP Web Service


For illustration purposes, a .NET Web Service was created with a function to allow a user to add a customer to a table The Web Service function is named add_customer( ) and requires the following input in the specified order:

Customer ID, Company Name, Contact First, Contact Last, C Company St Street, t Cit City, St State t and d Zi Zip C Code, d and dC Company Phone

All are St String i inputs i t except tC Customer t ID which hi h iis a Short Sh t On success, the function returns a value of 1 If no connection, it returns a -2, insert fails, -3, commit fails, -4, di disconnect tf fails, il -5 5

The add_customer( ) function returns a Short


4 - 76

Updatable SOAP Web Service Profile

4 - 77

Dragging a Web Service Function to Diagram

4 - 78

Resulting Updatable Web Service MBO

An MBO does not have to have attributes

In this scenario, scenario the resulting MBO contains only one operation The operation contains parameters which will then be inputted by a user on the application screens

4 - 79

Operation Definition
Unlike an MBO that has attributes, attributes this MBO will pass data values using operation parameters If the MBO has no attributes the attributes, Operation Type must be set to OTHER

4 - 80

Testing Operation Execution


Enter the required q argument (a.k.a parameter) values al es Click the Test Execute button In this scenario, a return of 1 means success

4 - 81

MBO O Basics

MODU ULE E TO OPIC CS


4 - 82

MBOs from SAP BAPI MBOs from SOAP Web Services MBOs from REST Web Services MBOs from a Tables/Stored Procedures Advanced MBO Topics Deploying MBOs to Unwired Server

REST Overview
REST is a set of principles that define how Web standards, such as HTTP and URIs, URIs are used Five key principles of REST are:

Give every resource an ID Gi Link resources together Use standard HTTP methods

CRUD Post, Get, Put, Delete XML, , JavaScript p Object j Notation ( (JSON) ) or both

Allow resources to have multiple representations

SUP only allows XML representations

Communicate in a stateless manner

4 - 83

REST Process
A representation of the client-requested resource is returned The representation places the client application in a particular state As the client traverses a URL, another resource is accessed The new representation places the client application into a different state

The client application pp changes g ( (transfers) ) state with each resource representation

4 - 84

XML Schema Definition (XSD)


The definition of a REST-based MBO requires a schema A schema describes the XML data that is to be returned

Describes an XML document

A Schema defines:
How many y elements ( (tags) g ) and/or attributes Order of the elements Cardinality of elements / attributes

Including if an element / attribute is required

Data type of elements / attributes

4 - 85

Yahoo Traffic Example

Some providers, like Yahoo, will give you a URL for the XSD:

http://local yahooapis com/MapsService/V1/TrafficDataResponse xsd http://local.yahooapis.com/MapsService/V1/TrafficDataResponse.xsd

Yahoo also provides a sample of the XML data that will be returned:

Sample XML is needed if you have no access to an XSD and must to create y your own

4 - 86

Schema (XSD) Creation Example

The .NET Framework SDK has a utility named XSD.exe to create schemas from sample XML data:

4 - 87

Schema Created by the XSD Utility

4 - 88

Connection Profile Terminology


Resource base URL the URL that is required to construct the resource URI Resource URI template The template that is appended to the base URL (for example, customers/{id})

Determines how the URI is parsed so all possible parameters are retrieved All parameters are treated as operation arguments, enabling MBO CRUD operations on the REST Web Service resources A string datatype is used if a datatype is not explicitly specified

/getCustomer/{id(int)} /getCustomer/{id(int?)}

Parameters can also support null values

4 - 89

REST Connection Profile


Start the Connection Profile wizard for REST Services Define the base URL and one or more URI templates:

4 - 90

Connecting to the REST Web Service


Right-click on the REST Web Service Connection Profile Select Connect:

4 - 91

MBO Creation Launch - REST Web Service

Launch the MBO Wizard using the Palette


Select REST Web Service as the Data source type Select a Connection profile

4 - 92

REST Service to MBO Mapping


REST Service request operations map to MBO Operation parameters REST Service response operations map to MBO Attributes

4 - 93

MBO Definition Properties

Verify the URI template, choose the correct HTTP method and then add either a Request or Response representation:

Double-click here to edit the representation or click li k Edit Edit


4 - 94

Choosing a Schema for an MBO

The schema can be:

Remote file accessed via a URL A local file

After providing th XSD the XSD, click li k the Load Elements button and then choose the root element

4 - 95

XSLT Definition

Like a SOAP Web Services can Services, customize generated XSLT

Can choose the elements that are mapped to the MBOs MBO s attributes May also define the XSLT manually a ua y (default)

4 - 96

Service Authentication

For REST Services that require HTTP Basic Authentication, enter user name and password:

4 - 97

Service Header Information


One of the benefits of REST over SOAP is the ability to manipulate the message header(s) For example, Amazons REST Web Service requires authentication by sending a secret access key (that they provide) via the HTTPAuthorization header:

4 - 98

Completed REST MBO for Yahoo Traffic

4 - 99

Editing a Created MBO

Dialogs contain valuable information that will help you correct a problem or error:

4 - 100

MBO O Basics

MODU ULE E TO OPIC CS


4 - 101

MBOs from SAP BAPI MBOs from SOAP Web Services MBOs from REST Web Services MBOs from a Tables/Stored Procedures Advanced MBO Topics Deploying MBOs to Unwired Server

Creating an MBO via Drag-n-Drop


Can create MBOs from a database table or a stored procedure Drag a table or stored procedure from the Enterprise Explorer onto the diagram:

Drag g and drop p a table from the Enterprise Explorer

4 - 102

Quick Create Wizard

When dragging a table onto the diagram, the Quick Create Wizard is invoked

Choose which operations to embed into the MBO The SQL cannot be changed here but can be edited later

4 - 103

Completion of Customer MBO


When the Quick Create Wizard completes, completes the MBO displays in the diagram If changes need to be made to the MBO, MBO they can be made in the Properties View

4 - 104

Using the Palette

Can use the Palette to create database sourced MBOs

Click Mobile Business Object in the Palette and click again to drop the MBO onto the diagram

Follow the New Mobile Business Object wizard wizard

Click thethe MBO icon icon and click Click MBO andin the Diagram create a new click in thetoDiagram to MBO

create a new MBO

4 - 105

Using the New MBO Wizard


Name the MBO and click Next.. Choose Ch the th JDBC d data t source t type and dC Connection ti P Profile: fil

4 - 106

Continued

Using the New MBO Wizard

Specify the SELECT statement:

Enter the SQL statement in the SQL Query text box provided OR Create it graphically

Click the Visual SQL button to g graphically p y build a select statement

4 - 107

Visual SQL Editor

Can build a SELECT statement using the Visual SQL Editor:

4 - 108

Visual SQL Design Options

4 - 109

Continuing with New MBO Wizard

If the defined SQL statement does not contain a WHERE clause no action is required on this screen: clause,

4 - 110

Continued

Continuing with New MBO Wizard


Using the BottomUp approach, approach attributes are automatically mapped to the underlying columns The Top-Down approach requires manual mapping of the columns attributes

4 - 111

Continued

Continuing with New MBO Wizard

The final wizard screen is used to assign role(s) to the MBO

The Advanced Developer Profile must be enabled to see this screen

4 - 112

Completion of Sales_Order MBO


Relationships between MBOs are NOT automatically created Must manually create relationships using the Palettes Relationship tool

4 - 113

MBOs with Computes

All valid SQL is legal when creating an MBO, including a Select that uses a compute:
Computed C t d Column

4 - 114

Mapping Computes

Both columns and computes become mapped to MBO attributes:

4 - 115

Computed Attribute

More on SQL and the MBO

The SQL of an MBO can have multiple tables, joins, parameters SELECT DISTINCT and ORDER BY parameters, BY, etc.: etc :

4 - 116

Static WHERE Clause Values

During development of the MBO, nothing precludes the use of a hard-coded hard-coded WHERE clause as shown below:

4 - 117

Using Stored Procedures


Stored Procedures can also be the source of an MBO:

Drag a stored procedure from the Enterprise Explorer onto the Mobile Application Diagram
4 - 118

Stored Procedure MBO Example

This stored procedure contains two read parameters which require runtime input:

customer_id product_id d t id

4 - 119

MBO O Basics

MODU ULE E TO OPIC CS


4 - 120

MBOs from SAP BAPI MBOs from SOAP Web Services MBOs from REST Web Services MBOs from a Tables/Stored Procedures Advanced MBO Topics Deploying MBOs to Unwired Server

Review - RBS vs. MBS


Conditions/Usage Mode Replication-Based Synchronization
Session based Pull or poke-pull (with listener) Transactional Push Reliable with duplicate detection High overhead due to store & forward and serialization Fairly efficient Always or mostly connected Al Always Asynchronous A h High Available High

Message-Based Synchronization
Individual message based

Transfer Mode Bulk Data Transfer Low Volume Data Transfer Connectivity Requirement Synchronization and Operation Replay Result Transparency p y or users awareness of synchronization Device Status Freshness of Data
4 - 121

Efficient Higher overhead due to session Occasionally connected Mostly synchronous upload + download Asynchronous via background Sync Moderate Not available Potentially high with the use of Server Initiated Sync but can be expensive in high frequency cases

Data Consistency Terminology

Two terms used to describe the process of maintaining data consistency in an RBS mobile application:

Synchronization synchronize between the Unwired Server Consolidated Database ( (CDB) ) and the mobile devices database

Requires a wireless connection Data updates are aggregated and synchronized when a connection becomes available Push type (server-initiated) synchronization can also be implemented

Data Refresh synchronize between the Unwired Server CDB and the EIS

Because RBS applications interact with the CDB CDB, if the EIS connectivity fails, the device can still access the data in the CDB

4 - 122

Data Access & Synchronization Requirements

Developers must define data & synchronization requirements such as:


What data is needed and when How current should the data be on the device Which users can access the data

These requirements help drive update, synchronization, and access decisions Examples:

Data rarely changes, so synchronization is required only occasionally Data is very y volatile, , so a comprehensive p strategy gy is required q to ensure data is kept current on the device Large data load - reduce the frequency that data is updated or accessed in the consolidated database (cache), (cache) or filter out unneeded data using system features such as SQL data queries If data is only used on the device to persist data across application launches, use local caching or temporary usage via a local MBO

4 - 123

Personalization Keys
Enables users to provide input for data retrieval Can be persisted:

On the client (stored in the device database) On the server (stored in the CDB) Transient (In memory)

Can be created by the developer or may use built-in personalization keys p y

Built-in Personalization Keys, Username and Password, can be used to p propagate p g application pp credentials to the backend EIS

4 - 124

Creating a Personalization Key

Right-click in the WorkSpace Navigator and select New Personalization Key:

4 - 125

Personalization Key Properties


Name Type Nullable Protected

Obfuscates the personalization li ti key value, , making g it more secure

Optional default value(s) Storage location: Client, Server or Session (In memory) Description

4 - 126

Load Parameters
In RBS, load parameters control the amount of data refreshed between the back back-end end EIS and consolidated databases Creates partitions in the CDB based on values given Can obtain its value from with a Personalization Key, a S h i ti P Synchronization Parameter, t or a d default f lt value l

Unwired Server

EIS

CDB
4 - 127

Synchronization Parameters

In RBS, a synchronization parameter:


Maps to an attribute Limits the data that is returned to the device C be Can b ti tied dt to a P Personalization li ti K Key, a control t l on a screen, a variable in an application
Unwired Server Mobile Device

CDB Local Database


4 - 128

Initial Synchronization Process


1. 2 2. 3. 4 4. 5. User initiates synchronization and includes a parameter value The request and parameters are passed to the EIS The EIS returns the data to the CDB A partition in the CDB is created for that request The device is synchronized with data from that partition

1
Unwired Server
Mobile ob e Device e ce

2
EIS

4 5
CDB

4 - 129

WHERE Clause with Parameters


An MBOs SELECT statement can contains a WHERE clause A parameter (state code) (state_code) provides runtime input to the WHERE clause

4 - 130

Parameter Mapping

If the data source of the MBO contains a parameter, it is mapped to the backend EIS:

state_code t t d will ill b be passed d as a parameter to the Select statement WHERE clause when the remote operation executes

4 - 131

Setting Load Parameter Properties


Because the MBO contains a read parameter, the Load Parameter shown below is automatically created A value must be provided for the Load Parameter Load L d parameter t values l can come f from either ith a Personalization Key or a Synchronization Parameter

A default value will be sent to the server in absence of these property values

4 - 132

Creating a Synchronization Parameter

Synchronization Parameters are not automatically created

Must ust use Properties ope t es view e o of t the e MBO O to c create eate t them e

In this example, the synchronization parameter is given its value from a Personalization Key which is mapped to the state attribute When Query Limiting is enabled, on subsequent reads, the data is overwritten - when disabled, the data is appended

The default is disabled

4 - 133

Associating Synch and Load Parameters


In the following example, the Load Parameter is given its value from a Synchronization Parameter (stateparm) The Synchronization Parameter could have been populated from:

A Control on the screen, a variable, a literal, or a P Personalization li ti K Key

4 - 134

Synch and Load Parameter Scenarios


Using both Sync and Load Parameters, the CDB and the device can have the same or different data Scenario 1 (CDB and device contain the same data):

Define a state_code state code Load and Sync Parm containing the value of TX The e Load oad Parm a brings b gs TX rows o s back bac to t the eC CDB a and dt the e Sy Sync c Parm sends those same rows to the device

Scenario 2 ( (CDB and the device contain different data): )


Define a state_code Load Parm with a value of TX and a city_name Sync Parm with a value of Dallas The Load Parm brings all TX rows back to the CDB, but the Sync Parm only sends Dallas rows to the device

4 - 135

Load and Sync Parameter Recap


Synchronization parameters are client side Load L d parameters t are server side id
Mobile App Screen Application code can populate either Synchronization Parameter Personalization Key Load Parameter

EIS

OR EIS loads CDB with data p per the Load Parameter


4 - 136

Performance Strategies

Strategies include:
Design the CDB cache to refresh client application data onon demand Create Synchronization groups identify the mobile business objects (MBO) that are to be synchronized as a group

Related MBOs must be within the same Synchronization Group

Create Cache Groups specifies data refresh behavior for every MBO in the group

Related MBOs must be within the same Cache Group

Work W k with ith Data D t change h notifications tifi ti (DCN (DCNs) )t to define d fi h how often to update data in the cache after data changes are detected in the data source

4 - 137

Default Synchronization Group

Every Mobile Application project contains a synchronization group named Default

MBOs are initially placed in this group

Defines a group of related MBOs in terms of their data synchronization requirements i t Developers or administrators can create additional synchronization groups g p

4 - 138

Creating Additional Synchronization Groups

Change detection interval is the frequency, in hours, minutes, and seconds, seconds with which Unwired Server is notified of data changes within the synchronization group:

4 - 139

Using the New Synchronization Group

Once a new synchronization group has been created, created MBOs are assigned to that group via drag-and-drop

E.g. drag an MBO from the Default group to the new synchronization group

For example, example the FlightCustomer MBO can be synchronized on a different schedule than the MBOs residing in Default

4 - 140

Synchronization From the Coding Perspective


Applications must call the synchronize function to fetch data synchronize( ) API function is overloaded

One version takes the name of the synchronization group to synchronize h i

Synchronize(DataChangesLessOften)

U d to only Used l update d FlightCustomer Fli htC t i our scenario in i U d to Used t update d t the th rest t of f the th MBO MBOs iin our scenario i

Synchronize(default)

FlightBooking, FlightList, FlightTrips

One overload takes no arguments and will synchronize all MBOs in all Synchronization Groups

Synchronize( )

4 - 141

Default Cache Group

Every Mobile Application Project contains one Cache Group named Default

MBOs are initially placed in this group

A cache h group specifies ifi th the data refresh behavior for e er mobile business every b siness object (MBO) within that group Developers or administrators can create additional Cache Groups

4 - 142

Cache Group Properties

4 - 143

Cache Policies

Cache policy defines the cache refresh behavior and properties for the MBOs within the cache group based on the policy

On demand - Application logic combined with the cache interval determines when a cache refresh is triggered

Cache is not updated until a request is made of the cache and the cache has expired If a request is made of the cache and it has expired expired, there may be a delay responding to the request while the cache is refreshed

4 - 144

Continued

Cache Policies

Scheduled

The cache is refreshed when a scheduled task, task defined by the Unwired Server administrator, executes

Scheduled tasks are created in the SCC

The cache can also be refreshed per the Cache interval Load L d parameters t fill filled df from t transient i t personalization li ti k keys cannot be used with a scheduled cache type

4 - 145

Continued

Cache Policies

DCN (Data Change Notification)


The cache never expires Data refresh is triggered by an EIS Data Change Notification The cache interval fields are disabled when DCN is selected

4 - 146

Continued

Cache Policies

Online

Used strictly with Mobile Workflow applications where access to real-time EIS data is required

Hence only available for MBS Hence,

Bypasses the Unwired Server cache (CDB)

4 - 147

Relationships
Are the mapping of attributes or parameters of one MBO to those of another Are beneficial because they:

Provision P i i related l dd data as a single i l unit i Properly sequence the operations on the related MBO

Can be one-to-many, many-to-one, or one-to-one

4 - 148

Relationship Types

One to many

One manager manages many employees One manager manages one department Many employees work in one department Changes can be propagated in both directions Operations such as deleting the Parent (e.g. Customer) will automatically t ti ll cascade d down d t to th the child hild ( (e.g. d delete l t orders) d )

One to one

Many y to one

Bi-directional Bi directional

C Composite it

4 - 149

Creating Relationships
Click Relationship in the Palette Drag the relationship from the parent MBO to the child MBO

The line is drawn between the MBOs

The New Relationship wizard will launch allowing further definition of the Relationship

4 - 150

Mapping the Relationship Attributes


Define the type of relationship (one-to-many, etc ) etc.) Click the source attribute and then click the attribute in the target MBO to set the mapping between the two

4 - 151

Completed Relationship

A one-to-many relationship between Customer and Sales order has been created below: Sales_order

4 - 152

Attribute to Parameter Relationship

Relationships can be made between:


Two Attributes Attribute and Parameter Parameter P t and Attribute Two T Parameters

4 - 153

Local Business Object (LBO)

Data exists only in the devices database


Does not use a remote data source Does not have pending status Does not require sync

4 - 154

Can only define create, update and delete operations Are instantiated with code and serve as temporary data stores for a mobile application pp Relationships can be created between LBOs but NOT between LBOs and LBOs, MBOs

Creating an LBO
Since it does not come from an EIS, EIS the creation of attributes in the LBO is a manual process LBOs do not have OTHER-type operations

4 - 155

Resulting LBO
Even though operations were specified in the creation of the LBO, they do not appear in the mobile application diagram The icon for the LBO is different from that of the MBO

4 - 156

MBO O Basics

MODU ULE E TO OPIC CS


4 - 157

MBOs from SAP BAPI MBOs from SOAP Web Services MBOs from REST Web Services MBOs from a Tables/Stored Procedures Advanced MBO Topics Deploying MBOs to Unwired Server

Deployment

MBOs are deployed into a package in the Unwired Server

The package is named after the Mobile Application Project Right-click Ri ht li k th the mobile bil project in the WorkSpace Navigator Select Deploy Project Project

To deploy your MBOs:

4 - 158

Setting Deploy Options

Select a deploy mode, enter a version number and a package name, and select the appropriate synchronization method:

4 - 159

Select synchronization method here

Select MBOs for Deployment

Choose the MBOs you want to deploy:

4 - 160

Deploying JARs
Custom Result Set Filters and Result Checkers should be packaged into Java Archive (JAR) files for deployment to the Unwired Server During deployment, deployment you can select a JAR file to deploy with your application:

4 - 161

Server/Domain Selection

Select which server and domain to deploy the MBOs:

4 - 162

Server Connection Mapping - Before

Click the Server connection area to display the dropdown containing connection choices

4 - 163

Server Connection Mapping - After

Connection Property Values

4 - 164

Creating a Deployment Profile

Last screen of the Deployment Wizard allows you to create a deployment profile / package to make future deployments easier

4 - 165

Deployment Progress and Status

4 - 166

Verifying Deployment
You can verify the deployment of your MBOs by navigating the Unwired Server profile in the Enterprise Explorer Packages are always deployed to a Domain

The L Th LosLogos L package in our example was deployed to the default domain

4 - 167

Mobile Deployment Package

Contains information about MBOs to be deployed to a server:

4 - 168

Mobile Deployment Profile

Allows you to designate the Unwired Server to which a package is deployed as well as perform a simple one-click deploy:

4 - 169

Deployment Package Context Options

Deploy and Build options (Full and Incremental) appear on the Context Menu of the Mobile Deployment Package
The Build options only create JAR files which contain the MBOs These JAR files can then be deployed to an Unwired Server

4 - 170

Labs

Lab 4-1: Creating SAP-based MBOs via JCO


Task 1: Create a MBO that Reads SAP Data Task 2: Create a MBO that Updates SAP Task 3: Deploy MBOs to the Unwired Server

Lab 4-2: Creating a SOAP Web Service MBO


Task 1: Create a SOAP Web Service Connection Profile Task 2: Create and Test a SOAP Web Service MBO Task 3: Create and Test an Updatable SOAP Web Service

4 - 171

Continued

Labs

Lab 4-3: Creating a REST Web Service MBO


Task 1: Create a REST Web Service Connection Profile Task 2: Create and Test a REST Web Service MBO

Lab 4-4: Creating a Database-driven MBO


Task 1: Create Database-driven MBOs Task 2: Create Relationships between MBOs Task 3: Create Personalization Keys y Task 4: Use Load and Synchronization Parameters

4 - 172

Lab Debriefing
What did you do and why? What went well in the lab? What insights did you get during the lab? What did you observe in the lab? What did you find challenging? Add any items to your troubleshooting list

4 - 173

Module Summary

During the course of this module, you have learned how to:
Use the Quick Create wizard to build a simple MBO Build MBOs from all of the EIS sources Build MBOs that require user input at runtime Create Personalization Keys to allow for user input to a mobile application Differentiate between Load and Synchronization Parameters Deploy an MBO to Unwired Server

4 - 174

Module Post-Assessment
1. Aside from attributes and operations, name three other things that make up an MBO. MBO 2. Which paradigm assumes that back-end data sources have already been created and/or identified? 3. True/False. An MBO can only be created by dragging it from the Palette. 4. True/False. Disabling Query Limiting in a Synchronization Parameter results in the device data appending instead of overriding. 5. What entity can be created to simplify the deployment of MBOs?
4 - 175

Sybase Unwired Platform 2.1 Mobile Application Development

Module 5: Introduction to Mobile Workflow A li i Development Application D l


Copyright 2012 Sybase, Inc. All rights reserved. Unpublished rights reserved under U.S. copyright laws. Sybase, and Sybase logo, are trademarks of Sybase Inc., or its subsidiaries. indicates registration in the United States of America. SAP, and the SAP logo, are the trademarks or registered trademarks of SAP AG in Germany and in several other countries. All other trademarks are the property of their respective owners.

Module Pre-Assessment
1. What are the four starting point screens available for a Mobile Workflow? 2. For which devices will Sybase Unwired Platform generate mobile workflow applications? 3. Which Web technologies does the Hybrid Web Container support?

5-2

Module Objectives

Upon completion of this module, you should be able to:


Define the new Hybrid Web Container model for workflow applications Describe the four starting points available for a mobile workflow application Understand U d t dh how server and dd device i iinitiated iti t d workflows kfl differ diff from one another and the purpose of each type Create C t a basic b i Hybrid H b id W Web bC Container-based t i b d mobile bil workflow kfl application Understand U d t d and d explain l i how h to t administer d i i t a mobile bil workflow kfl application

5-3

Introduction to Mobile Workflow f Development

MODU ULE E TO OPIC CS


5-4

Mobile Workflow Forms Editor Overview Mobile Workflow Application Development Configuring Mobile Workflow Application in the SCC Generating and Deploying a Workflow Package

Whats A Mobile Workflow

A Mobile Workflow application is a simple application

E g to perform inventories, E.g., inventories meter reading reading, vacation requests

Workflow applications can be request-response type applications li ti where h one user iinputs t a request t (d (data) t ) and d another user approves or denies the request Mobile Workflow applications include two layers:

Business logic g MBOs with attributes and operations

Can still use entities like load parameters, synchronization parameters, personalization keys Built using g the Mobile Workflow Forms Editor within the Unwired WorkSpace

User Interface screens, controls, application flow

5-5

Server vs. Device Initiated Workflows

Device-initiated:
Workflow can be opened p like any y normal mobile application pp by y the user An example is a user submitting a travel expense report

Server-initiated:
Can be initiated by y an e-mail notification or Data Change g Notification Device receives e-mail notifications from an Unwired Server process that delivers a workflow message to a user based on a configured distribution rule and MBO extraction rules An A example l is i receipt i t of f an approvall request t

A single mobile workflow application can be both a serveri iti t d and initiated dad device-initiated i i iti t d workflow kfl

5-6

Hybrid Web Container Overview

Runtime on the device that executes Mobile Workflow applications


Can customize with the simplicity of web development Utilizes the power of native device services

Is an application that uses a platform supplied embeddable browser control* control on which to build applications:

Rendered using the open source WebKit web browser engine

Some of the files that are generated in Unwired WorkSpace to build the container can be modified for customization p p purposes Container must be loaded onto the device manually or by using g device management g such as Afaria

5-7

Hybrid Web Container Architecture


Mobile Workflow F Forms Edi Editor MBO Development
Deploy

Container Client (HTML/CSS/JS)


Messages

Workflow Server Metadata

Sybase Unwired Platform


Cache Pull

Lookup/Search p

Browser Container Services (Storage/Messaging/ Security/Provisioning)

Push/DCN

Hybrid y Web Container (Runtime App)


5-8

Backend Data

Introduction to Mobile Workflow f Development

MODU ULE E TO OPIC CS


5-9

Mobile Workflow Forms Editor Overview Mobile Workflow Application Development Configuring Mobile Workflow Application in the SCC Generating and Deploying a Workflow Package

Mobile Workflow Forms Editor

Mobile Workflow Forms Editor is the IDE that helps you:


Define the starting points for device or server initiated workflows Design the user interface screens

Put controls onto screens D fi basic Define b i validation lid ti llogic i of f controls t l Create menus on screens

Define how the screens of the application flow Make calls to create, update, delete and other type operations in an MBO Call object queries of an MBO

5 - 10

Mobile Workflow Forms Editor Layout

Contains three tab pages where the developer can perform his work:
Introduction Flow Design

Identifies the starting points (such as client or server-initiated) that make up the application

Developer can edit starting points after running the wizard

Where you define the number of screens that will make up the application as well as the flow between the screens Where controls are added to specific screens Where menu items are created Can create validation rules for screen controls

Screen Design

5 - 11

Mobile Workflow Forms Editor

Flow Design Diagram (tab active) Screen Design tab Palette Context-sensitive Properties p view
5 - 12

Mobile Workflow Editor: Key Concepts

Starting Points

Define how the application pp is to be started Allow you to activate a device user Allow you to require user name and password authentication Developers define which screens are needed and in what order the user traverses the screens Placed onto a screen to display p y data or receive user input p Used to invoke operations such as MBO operations, navigation to another screen, etc. t Variables that hold data bound to MBO attributes or operation parameters

Screens and Navigations

Controls

Menu Items

Keys

5 - 13

Starting Points

A workflow application has four possible starting points:


Client-Initiated Client Initiated initiated by the user when he clicks a given workflow icon in the Sybase Messaging Client Server-Initiated Server Initiated initiated when the user opens a workflow specific e-mail generated by Unwired Server on the device Credential C d ti l Request R t sent t by b the th server when h the th user iis required to provide a username and password for authentication Activate initiated the first time the workflow application is used on the device and allows that user to specify his activation code as provided by the Administrator

5 - 14

Starting Points Example

5 - 15

Screens and Navigations

In the previous slide, when following the client-initiated flow, you can tell the user will see a Start Screen followed by the Create Request screen
The rectangles are the screens The arrows are the navigations

In this scenario, you can add a menu item on the Start Screen that can result in the navigation between it and the Create Request screen Screen transitions can also be created by choosing the GoTo navigation item from the palette

5 - 16

Navigations on the Palette

GoTo

When dragged gg between screens creates a new menu item in the source screen that opens the destination screen Directs flow depending on success or failure of MBO operation calls Lets the user drill down into the details from the higher-level listview control t l
Navigations

Operation p

Listview

5 - 17

Controls
Each screen can contain one or more controls Double-clicking any screen in the Flow Design view will cause that screen to open in the Screen Design view Once in screen design, the palette changes to show the controls you can add

Screen Design View Screen Design Palette

Click the control in the palette and then click again on the screen

5 - 18

Controls Supported By All Platforms

The following controls can be used on all supported pp p platforms:


Button Image Label Link Checkbox Editbox Choice HtmlView

Container C t i to t embed b d ad-hoc dh HTML markup

Listview Attachment Viewer

5 - 19

Controls with Limited Platform Support

Slider
Apple iOS BlackBerry Android Note: When the Optimize for performance option is set in preferences, the Slider control is supported only on BlackBerry

Signature
Apple iOS Android BlackBerry 6.0 60

5 - 20

Menu Items

When a user selects a menu item, it invokes some type of action such as:
Navigating to a different screen Closing Cl i th the screen or application li ti Invoking an MBOs operation

Menus are supported only on BlackBerry and Windows Mobile platforms On the iOS platform, menus are provided from HTML controls designed g to emulate the iPhone navigation g bar and toolbar

5 - 21

Adding Menu Items

Menu items are added to the special Menu box in the Screen Design view

Click MenuItem in the Palette and then click again in the Menu box (blue box)

After adding the menu item, set its properties


Type is the most important menu item it property t Depending on which type, you have h one or more other th properties to set

5 - 22

Menu Item Types


Save screen validates current input, and if successful saves and closes the screen Cancel screen discards any changes and closes the screen Close workflow discards any changes and closes all opened screens Open screen allows navigation to a different screen Add dd ope opens s a new e screen sc ee with t a listview st e co control t o where eea new row can be added Select certificate opens a dialog where the user can choose a certificate to use for the credentials

5 - 23

Continued

Menu Item Types


Online request validates the data input on all open screens, saves it, and synchronously sends it to the server, waiting for a response before closing the workflow application Submit workflow validates the data input on all open screens, closes the workflow application, and sends the data to the server asynchronously Add/Update/Delete Key Collection performs the requisite operation to a Listview control

Not invoked immediately, but is instead invoked when a Submit operation is made on a parent MBO Can only be added to screens that result from a Listview details navigation

5 - 24

Keys and Data

Keys are like variables


They contain a name and a data type They also can contain a mapping to MBO data

A control is bound to a key


Controls get their initial values from data contained in its associated key When the user changes the data in a control, its associated key value changes too

For server-initiated workflows, ,y you can specify p y the value associated with a given key

Attributes in an MBO can be mapped to keys of the workflow

5 - 25

Defining and Using Keys

5 - 26

Keys and Operations


Parameters of an MBO operation or object query can be bound to keys When the operation or object query is invoked, the value passed to each parameter will be the value associated with the corresponding key

5 - 27

Personalization Key Mapping

Personalization Key mapping:


MBOs can have load parameters tied to personalization keys This tab lets you specify internally defined values to be mapped to a key

Personalization keys in a workflow application must be of storage t t type Transient T i t

5 - 28

Output Keys
Lists the keys of which values will be filled by the server and returned to the client Output keys are the result of configuring an Online Request menu item type

5 - 29

Introduction to Mobile Workflow f Development

MODU ULE E TO OPIC CS


5 - 30

Mobile Workflow Forms Editor Overview Mobile Workflow Application Development Configuring Mobile Workflow Application in the SCC Generating and Deploying a Workflow Package

Workflow Development Task Flow


1. Create or open a mobile application project and define your connection profiles and MBOs 2. Connect to Unwired Server 3. Deploy the Mobile Application Project

Select Message-based as the deployment mode

4. Configure the workflow notification mailbox and users in the SCC 5. Create the Mobile Workflow application user interface using the Mobile Workflow Forms Editor

5 - 31

Continued

Workflow Development Task Flow

6. Create screens by dragging and dropping MBOs or MBO operations from WorkSpace Navigator to the Flow Design

Or manually create, delete, and edit screens, controls, menus, screen navigations navigations, and so on Make edits to the generated Custom.js file if desired

7. Generate the Mobile Workflow package

8. Deploy the Mobile Workflow package to Unwired Server 9. On the device, run, test and debug the Mobile Workflow p package g

5 - 32

MBO Development Review

Regardless of the type of application being created (workflow or native), MBOs must be created

Create Connection Profiles to required data sources Create the MBOs from your data sources to meet the application requirements

5 - 33

Creating a Mobile Workflow Application

Assuming you have created the MBOs to support the application select New Mobile Workflow Forms Editor application,

Name the workflow (the *.xbw file)

D id on th Decide the St Starting ti P Points i t follow f ll rest t of f th the wizard i d

5 - 34

Continued

Creating a Mobile Workflow Application


Select an MBO using Search Select the appropriate Object Query (i.e. (i e findByPrimaryKey) and Parameter (i.e. req_id):

5 - 35

Continued

Creating a Mobile Workflow Application

Provide a sample notification:

Will be used for Matching and Extraction Rules

5 - 36

Continued

Creating a Mobile Workflow Application

Provide a Matching Rule using your sample:

Provide an Extraction Rule

Once Matching and Extraction Rules are defined, the wizard is complete

5 - 37

Matching vs. Extraction Rules


Used by Server-initiated Starting Point ONLY They are NOT the same Matching Rule:

Used to provide Unwired Server enough of the STATIC text of an email field to determine where to route a workflow request

Extraction Rule:
Extracts text elements to determine the p position/placement p of the unique ID in the string Unwired Server extracts the ID using start and end tags Will be used to send the correct workflow instance to the designated user device

5 - 38

Completed Workflow in the Flow Design

Flow Design is where you:


Define what and how many screens the application needs Define the flow between the screens

5 - 39

Screen Design
Double-click a screen in the Flow Design to display this view Screen UI elements are designed here:

5 - 40

Workflow Screen Creation Options

Workflow screens can be created by either:

Adding a new screen from the Palette


Controls must be added K Keys must t be b created t d and d mapped dt to th the controls t l Menu items must be added to call the appropriate operations

Dragging D i an MBO from f the th WorkSpace W kS Navigator N i t onto t the th Flow Design

Usually U ll creates t more screens th than iintended, t d d b but t unwanted t d screens can be deleted

Dragging D i an MBO MBOs operation ti f from th the W WorkSpace kS N Navigator i t onto the Flow Design

M t precise Most i option ti

5 - 41

Manual Creation Method

Click the Screen palette item and click again to drop it into th Flow the Fl D Design i editor dit
Enter the name of the screen The key will be automatically set

5 - 42

Adding Navigations

Use the GoTo control in the palette

When creating a GoTo navigation between screens, screens a corresponding Open menuitem on the first screen will automatically be created

Some navigations cannot be explicitly created on the Flow Design but will be implicitly created when relevant properties of various controls and menuitems are specified

Examples: Operation Success, Success Operation Error and Listview Details

Changing the appearance of the navigation via the Navigation property sheet is strictly for design-time

These kinds of changes will have no effect at run-time run time

5 - 43

Creating a Key
A control should have a corresponding key assigned Control properties are set/changed in the Properties p view To create a new key, select the control or other entity (starting point, screen,) and click New in its Properties page (Keys tab):

5 - 44

Creating List Keys


List keys are keys bound to relationships and lists of MBO instances Click the Edit button to display, create or edit child keys, as shown below:

5 - 45

Defining Menus
Specify the MBO and the corresponding operation or object query Map the parameters to keys

Parameters which P hi h are mapped d to attributes ib or personalization keys or have a default value dont necessarily have to have a key mapped to them

5 - 46

Open Menu Items

Open menuitems are bound on a one-to-one basis with GoTo navigations

Creating a GoTo navigation will automatically create an Open menuitem and vice verse

Will also create the appropriate editing g and deleting g behaviors

5 - 47

Drag and Drop Screen Creation Method

Find an MBO operation, or the whole MBO, in the WorkSpace Navigator and drag it to the Flow Design view

This will create the appropriate screens, controls, keys, menus and d navigations i ti for f that th t operation ti or MBO

Dragging an MBO operation will create a screen with a menu item that invokes that operation and with controls bound to keys that are bound to that operations parameters Dragging the entire MBO will create :

Screens for all operations A details screen for the MBO itself Screens for any related MBOs and their operations

5 - 48

Introduction to Mobile Workflow f Development

MODU ULE E TO OPIC CS


5 - 49

Mobile Workflow Forms Editor Overview Mobile Workflow Application Development Configuring Mobile Workflow Application in the SCC Generating and Deploying a Workflow Package

Workflow Administration Overview

Must register each device user so it can connect to Unwired Server


Use the Sybase Control Center (SCC) For F each h device, d i specify if the th user name, Unwired U i d Server S host h t name and port, Relay server farm-id (if applicable) and activation code (if desired)

The workflow application has to be assigned to each device using i SCC

Workflows can also be unassigned in the SCC

Configure Inbox Notification if your workflow is designed to forward email notifications to users

5 - 50

Register A Device User


Click Applications node Click the Application Connections tab and then click the Register button

5 - 51

Notification Mailbox

If workflow application is server-initiated, the Notification Mailbox must be enabled/configured


This mailbox monitors emails incoming into Unwired Server If th the email il matches t h a di distribution t ib ti rule l f for a d device, i th that t email il is sent to the device as a special workflow email

Enable here

5 - 52

Assigning Users to Workflows

The SCC is used by administrators to assign or un-assign users to a workflow device:

5 - 53

Activating a Mobile Workflow

Activate workflows on the device


If f the application defines f an Activate starting point, the user must activate a workflow when using it the first time Workflows within the same activation group (MBO package) are activated together inside one device Successful subscription to back-end back end system establishes the device relationship to the MBO package k f for th that t workflow kfl

5 - 54

Mobile Workflow Use Case Scenario

Use Case:

A Vacation Request mobile device workflow application that is designed to give:


Employees the ability to create a vacation request Managers the ability to approve/reject a vacation request

5 - 55

Continued

Mobile Workflow Use Case Scenario


Employee making request Create ( ) Boss approving request Sends to
Boss Device User
SCC Distribution Rule set to send special email to Boss - which has the Custom 1 distribution rule

Unwired Server sends workflow to Boss SUP reviews starting point extraction rules to determine which workflow to route in order to generate special email containing an i t instance of f th the request t

MBO

INSERT

Trigger sends notification email to approver (boss) and to Inbox Notification (trafficcop)

EIS Database

Vacation Request q Table

Database On Insert Trigger

5 - 56

Introduction to Mobile Workflow f Development

MODU ULE E TO OPIC CS


5 - 57

Mobile Workflow Forms Editor Overview Mobile Workflow Application Development Configuring Mobile Workflow Application in the SCC Generating a Workflow Package

Mobile Workflow Packages


Use the Mobile Workflow Package generation wizard to generate and deploy a package to Unwired Server Right-click in either the Flow Design or Screen Design page of the Mobile Workflow Forms Editor and select Generate Mobile Workflow Package, or click the code generation icon on the toolbar A zip file containing the application and its generated files f is created and placed in the Generated Workflow folder in the project j

The workflow is also deployed to the Unwired Server

5 - 58

Workflow Generation Wizard Dialog

5 - 59

Generation Wizard Selections

Generate
Select to generate the mobile workflow package and its files When option is unchecked, the Mobile Workflow package files are not regenerated regenerated, so that user modified files or changes made in the designer will not be reflected in the generated application

Generate into the project

Place th Pl the generated t d mobile bil workflow kfl package k and d it its fil files iin the current project

5 - 60

Continued

Generation Wizard Selections

Generate to an external folder


Place the generated .zip zip file containing the application and its generated files into a location outside of the current project Click Browse to select the alternate location

Unwired Server Profile

Select the Unwired Server profile with which to associate the mobile workflow application and extract the username and password d credentials d ti l if you are using i static t ti authentication th ti ti Select to deploy the mobile workflow application to an Unwired Server
Continued

Deploy to an Unwired Server

5 - 61

Generation Wizard Selections

Deploy Mode
New select the first time you deploy to the Unwired Server Update updates an existing workflow Replace removes existing workflow and re-deploys

Assign workflow to user(s)


The mobile workflow must be assigned to a device user before the mobile workflow is visible on the user's device It can be assigned to multiple users

Separate p multiple p users with a comma

Device users must be registered in Sybase Control Center Click Get Users to select device users from the list

5 - 62

Continued

Generation Wizard Selections

Validate controls as soon as the user tries to change focus away from them
If unselected, validation occurs only when the screen is saved If selected, l t d validation lid ti occurs as soon as th the control t l lloses focus If validation lid ti fails, f il a h help l element l t appears and d shows h the th error message

5 - 63

Preparing the BlackBerry Simulator

To install and configure the mobile workflow container files on to a BlackBerry device or emulator emulator, you must perform the following on the device:
Locate required files Copy required files to appropriate device/simulator folder Load MDS S and the BlackBerry simulator Configure and activate the workflow container on the device/simulator Generate the workflow application in Unwired WorkSpace

5 - 64

Step 1: Locate Required Files

In Windows Explorer, go to the folder:

<UnwiredPlatform_InstallDir>\UnwiredPlatform\ClientAPI\MBS <UnwiredPlatform InstallDir>\UnwiredPlatform\ClientAPI\MBS \BB\MoMessaging:

5 - 65

Step2: Copy Required .cod Files

Copy the required .cod files to the BlackBerry Simulator directory:


CommonClient.cod shared code that can be used by native Sybase Unwired Platform BlackBerry applications MessagingClientApp.cod the main Mobile Workflow application MessagingClientSettings.cod Sybase Settings options screen where the user enters the server connection information MocaClient.cod MocaClient cod messaging library WorkflowResources.cod image resources for the Mobile Workflo application, Workflow application for e example, ample the Mobile Workflo Workflow icons

5 - 66

Continued

Step2: Paste Required .cod Files

Paste files into the simulator folder:

5 - 67

Step 3: Launch BlackBerry MDS

Go to Start Research In Motion BlackBerry JDE 6 0 0 MDS-CS: 6.0.0

5 - 68

Continued

Step 3: Launch BlackBerry MDS

BlackBerry MDS has started:

5 - 69

Step 4: Start the BlackBerry Simulator

Select Start Research In Motion BlackBerry JDE 6 0 0 Device Simulator: 6.0.0

5 - 70

Continued

Step 4: Start the BlackBerry Simulator

The BlackBerry 9800 device simulator:

5 - 71

Step 5: Access Options


Navigate to the devices Options applet Select Third Party Applications Sybase Settings:

5 - 72

Step 6: Configure Connectivity

Define your connection: Server Name, User name, Activation Code etc Code, etc and then select Save:

5 - 73

Continued

Step 6: Configure Connectivity (Detail)

On the Connection screen, provide the values defined when you registered the device user in the SCC

Server Name varies depending on your environment. In a single node environment environment, use the host name of the Unwired Server

In a production environment with relay servers servers, use the name of a deployed relay server host In a production environment with load balanced relay servers, servers use the name of the load balance controller

5 - 74

Continued

Step 6: Configure Connectivity (Detail)


Server Port the port used by Unwired Server Farm ID the the company ID ID, or Farm ID registered in the relay server

If you are not using relay server server, use a value of 0

User Name the name of the device user you registered in the SCC Activation Code the activation code specified when you registered the device user Enable Automatic Registration if previously configured in the SCC this option will appear on the client device SCC,

5 - 75

Troubleshooting
Always check the Sybase Messaging Clients log entries when you encounter a problem with connections In the Connections screen, select Show Log from the menu:

5 - 76

Step 7: Generate the Package


Right-click in the Flow Design Diagram Generate Mobile Workflow Package Make your selections Click Finish

5 - 77

Step 8: Launch the Workflow


Access the workflow application on the BlackBerry device emulator by navigating to Messaging You should see a Workflows menu item in the Messaging menu Select Workflows:

5 - 78

Continued

Step 8: Launch the Workflow


Note the installing indicator icon on the top-right of the user interface Once the workflow application is installed, its icon will appear and you can select and test your application

5 - 79

Deploying Workflows in Production

In a production environment, you will need to use one or more of the following techniques:
Use Afaria to install the Mobile Workflow container on devices for enterprise deployment supported by Afaria Have your users install the Mobile Workflow container on the BlackBerry device using BlackBerry Desktop Manager

Connect the BlackBerry device to the computer that contains the Mobile Workflow container for BlackBerry Run the BlackBerry Desktop Manager following the instructions in the RIM documentation

For iOS devices, you must use Apples appStore/iTunes/APNS deployment methodology

5 - 80

Labs

Lab 5-1: Building the Vacation Request Mobile Workflow Application

Task 1: Review the Vacation Request Use Case and Add Email User Accounts Task 2: Set Up Ancillary Lab Components BlackBerry Simulator T k 3: Task 3 St Start t and dC Configure fi S Sybase b C Control t lC Center t f for Workflows W kfl Task 4: Create the Device-Initiated Project and Workflow Database Tables and Trigger Task 5: Create the Vacation Request Workflow Project MBOs Task as 6: 6 Deploy ep oy Mobile ob e Workflow o o Application pp ca o MBOs Os Task 7: Create the Device-Initiated Mobile Workflow Application Interface Task 8: Generate and Test the Device-Initiated Mobile Workflow Application

5 - 81

Continued

Labs

Lab 5-2: Building the Vacation Approval Workflow Application


Task 1: Setup the Windows Mobile Emulator Task 2: Create the Server-Initiated Mobile Workflow User Interface Task 3: Generate and Test the Mobile Workflow Application

5 - 82

Lab Debriefing
What did you do and why? What went well in the lab? What insights did you get during the lab? What did you observe in the lab? What did you find challenging? Add any items to your troubleshooting list

5 - 83

Module Summary

During the course of this module, you have learned:


How to describe the new Hybrid Web Container model for workflow applications The components that make up a mobile workflow application To use the four starting points for a mobile workflow application li ti How to develop and generate a mobile workflow application How to administer and test a mobile workflow application

5 - 84

Module Post-Assessment
1. What is the name of the Editor used to create a mobile workflow application? 2. True/False. Before you can test your mobile workflow application you must customize the user interface application, interface. 3. True/False. You create mobile workflow screens by dragging a database table or other data source object to the Screen Design diagram.

5 - 85

Sybase Unwired Platform 2.1 Mobile Application Development

Module 6: Advanced Mobile Workflow A li i Development Application D l


Copyright 2012 Sybase, Inc. All rights reserved. Unpublished rights reserved under U.S. copyright laws. Sybase, and Sybase logo, are trademarks of Sybase Inc., or its subsidiaries. indicates registration in the United States of America. SAP, and the SAP logo, are the trademarks or registered trademarks of SAP AG in Germany and in several other countries. All other trademarks are the property of their respective owners.

Module Pre-Assessment
1. True/False. To alter the appearance of a web frontend, the only thing you can do is edit its CSS. CSS 2. True/False. Mobile workflow applications are easier to create than Native mobile applications. applications 3. True/False. Workflow applications are message-based.

6-2

Module Objectives

Upon completion of this module, you should be able to:


Make changes to a workflows workflow s CSS or custom JavaScript Implement the online lookup feature in a workflow application Enable online device caching of data Use the Attachment Viewer control Localize a workflow application

6-3

User Interface f C Customization

MODU ULE E TO OPIC CS


6-4

Implementing p g Online Lookup p Other Advanced Topics Localization Security Aspects

Workflow Review

You already learned how to build client and server-initiated workflows


Create screens, develop the flow, call MBO operations from menu items Generate, deploy and test the application Enter E t d data t iinto t th the workflow kfl t to b be propagated t dt to the th EIS Generate and test Server-initiated notifications

The appearance of your workflow applications was fairly generic


Customizations are totally at your discretion The out-of-the-box out of the box workflow may suit your needs

6-5

Generated Mobile Workflow Files


Generating a workflow application results in the creation of several HTML CSS and HTML, JavaScript files These files are placed in the Generated Workflow folder of the project Some S of f these h files fil can be customized

6-6

Customization

Hybrid Web Container uses:


HTML CSS JavaScript

These web technologies make it easy for you to customize the generated files by using JavaScript code

6-7

HTML
The generated HTML files contain all screens for the workflow app, each in their own <DIV> section of the document Files can be opened with third-party Web development tools and modified

Any y changes g made using g a third-party p y tool will be overwritten if generated from the Mobile Workflow deployment tool

Mobile Workflow Forms Editor includes a HTMLView control that can be placed on a screen, and in which custom HTML code can be inserted

Will be published in-line when the file is re-generated

6-8

CSS
A third-party CSS library is used to modify the look-and-feel of the HTML page jQueryMobile CSS file is embedded as the default look-andfeel for iOS, iOS BlackBerry 6 6, and Android

Windows Mobile and BlackBerry 5 uses a different CSS library

Can select from the variety of themes within the jQueryMobile framework or use your own CSS rules for skinning pages and screen elements

These can be device specific

You can leverage existing CSS style rules from your own organization's organization s Web standards

6-9

JavaScript

Customization points have been provided in custom.js to allow modifications

Customization of the HTML page can be executed using embedded JavaScript in these customization points

Allows access to data-access functions for requests and cached h d values l Additional custom JavaScript files can be added to the Mobile Workflow package

6 - 10

Generated Files: The Details

Files created each time a generate is performed:

manifest xml manifest.xml

A compilation of all resources used in the application The deployment unit for the application This is what is actually deployed to the device

<workflow_name>.zip kfl i

6 - 11

Continued

Generated Files: The Details

Files re-created if the Generate option is selected in the Mobile Workflow package generation wizard:

workflow.html kfl ht l

Container of all screens in the workflow app, each in their own <DIV> section of the document Same as above, but for BlackBerry 5.0 devices Same as above, but for iOS and BlackBerry 6.0 devices

workflow_CustomLookAndFeel.html

workflow_jQ jQueryMobileLookAndFeel.html y

<workflow_name>.xml WorkflowClient xml WorkflowClient.xml

Mappings between the keys and the MBO parameters, operations and attributes Functions to determine the locale do not edit Internal functions called by the generated code do not edit

Resources js Resources.js

Workflow.js

6 - 12

Continued

Generated Files: The Details

Files re-created if the Generate option is selected and the files do not exist:

API.js

P bli functions Public f ti th that t can b be called ll d b by th the d developer l

e.g. isWindowsMobile(), getCurrentMessageValueCollection(), getCurrentScreen() navigateForward(), getCurrentScreen(), navigateForward() updateUIFromMessageValueCollection()

Recommend y you do not edit this file Internal workflow functions Recommend you do not edit this file Continued

Utils.js

6 - 13

All *.css css files

Generated Files: The Details

Files re-created if the Generate option is selected and the files do not exist (cont (cont.): ):

Custom.js

This is Thi i where h you make k your customizations t i ti Details on this to follow later in this section MessageValue, MessageValueCollection and W kfl M WorkflowMessage objects bj t that th t allow ll you t to easily il view i and d manipulate the contents of the in-memory data that the workflow application is using

W kfl M WorkflowMessage.js j

6 - 14

Makeup of Custom.js

Contains pre-defined customization points (function stubs) that can be coded with JavaScript: WorkflowLoad WorkflowLoad, Submit Submit, NavigateForward, NavigateBackward, ShowScreen, MenuItemClick Save MenuItemClick,

Each customization point has a Before and After version, i.e. BeforeWorkflowLoad

Before methods return a boolean


If true, the default behavior is executed, i.e. NavigateForward (next screen) If false, the default behavior is replaced with the developers custom code

6 - 15

Coding in Custom.js
Developers have access to all of the standard JavaScript functions including DOM element manipulation functions, manipulation, etc etc. and also have access to many workflow functions that are provided in API js API.js The functions in API.js are categorized as:

Generall utility G tilit f functions ti ( (e.g. guid()) id()) Workflow-specific utility functions (e.g. parseDateTime()) Workflow message data functions (e.g. getCurrentMessageValueCollection()) Workflow UI functions (e.g. getCurrentScreen()) Workflow native functions ( (e.g. g doOnlineRequest()) q ()) Workflow validation functions (e.g. validateControl())

6 - 16

Example #1: Workflow Page Manipulation

This example will modify the header and footer of each page of the application
Header will contain a company logo Footer F t will ill contain t i a copyright i ht notice ti

To achieve this goal, the customAfterNavigateForward method will be coded in custom.js:


Function stub stub

6 - 17

Example #1: Images Added to Workflow

An images folder is created and placed under the HTML folder

Images to be used are imported into this folder

6 - 18

Example #1: Code for Headers / Footers

Add code for the function as follows and then re-generate:


Add a logo to the header

Add a copyright py g to the footer


6 - 19

Example #1: Before and After

B f Before
6 - 20

After

Example #2: Changing Colors

This example will modify the CSS files to:

Change the background Change text colors

Since we are testing Si t ti with ith BlackBerry 6.0, edits will b made be d to t th the jqueryj mobile-1.0a3.css file

6 - 21

Example #2: CSS Code Changes

Find the .ui-body-a selector and change the background and color property values

Commented out the background gradient values:

6 - 22

Example #2: Before and After

B f Before
6 - 23

After

Example #3: Background Image


In this scenario, you use an image for the background instead of a solid background Image files must be imported into your project

Specific background attributes including a URL


6 - 24

Example #3: Before and After

B f Before
6 - 25

After

Example #4: Adding Validation Checks

Hook into the submit process of a workflow by editing the customBeforeSubmit function in Custom.js Custom js

Sample code is provided in some of the function stubs:

6 - 26

Example #4: Researching Key Values

Edit the generated *.html file to determine values needed when writing JavaScript functions:

Screen Key

Menu Item Control Key

6 - 27

Example #4: Edit Custom.js

6 - 28

Example #4: Result of Validation Check

When the user enters a value greater than 1000, the error message is displayed and the form is not submitted:

6 - 29

Example #5: Creating Hyperlinks from Data

In the code on the next slide:

Data is read from the employee keys

Use provided functions in API.js

Hyperlinks are created to be clicked to perform some kind of action like:

A mailto: link - when clicked, will cause the device to start an email using the employees email address A tel: link - when clicked clicked, will cause the device to start dialing the employee using his phone number A location link - when clicked, , will cause the device to open p the browser and navigate to the page specified, passing relevant location data Continued

6 - 30

Example #5: Creating Hyperlinks from Data


function customBeforeShowScreen(screenToShow, screenToHide) { if (screenToShow === "Favorite_Details") { var form = document.forms[screenToShow + "Form"]; if (form) { var mvc = getCurrentMessageValueCollection(); var a = document.getElementById("ListEmpFavorites_email_attribKey"); a.href = "mailto:" mailto: + mvc.getData( ("ListEmpFavorites ListEmpFavorites_email_attribKey email attribKey"). ).getValue(); a.innerHTML = mvc.getData("ListEmpFavorites_email_attribKey").getValue(); a.id = "ListEmpFavorites_email_attribKey"; a = document.getElementById("ListEmpFavorites_officePhone_attribKey"); a.href = "tel:" + mvc.getData("ListEmpFavorites_officePhone_attribKey").getValue(); a.innerHTML = mvc.getData("ListEmpFavorites_officePhone_attribKey").getValue(); a.id = "ListEmpFavorites_officePhone_attribKey"; _ _ a = document.getElementById("ListEmpFavorites__location_attribKey"); a.href = "javascript:void(0)"; a.onclick = function() {showUrlInBrowser("http://maps.google.com/maps?q=" + mvc getData( mvc. ("ListEmpFavorites ListEmpFavorites__location_attribKey location attribKey") ).getValue());return getValue());return false;}; a.innerHTML = mvc.getData("ListEmpFavorites__location_attribKey").getValue(); a.id = "ListEmpFavorites__location_attribKey"; } } return true; }

6 - 31

Example #6: Code to Read and Navigate

Excerpt code in the customAfterNavigateForward function:

6 - 32

Example #7: Code To Set Screen Title

6 - 33

Example #8: Using the JSChart Library

Third-party library for building real-time interactive charts in web pages:

6 - 34

User Interface f C Customization

MODU ULE E TO OPIC CS


6 - 35

Implementing p g Online Lookup p Other Advanced Topics Localization Security Aspects

Implement MBO Changes


To provide the online lookup capability in a client-initiated workflow application application, the MBO will need to contain an Object Query Click Add to define a new Object Query The findByPrimaryKey operation was pre-defined. Here, we are showing the addition of a new Object O Q Query

6 - 36

Object Query Example


Name the Object Query Define input parameters

Map to MBO attributes

Generate G t Edit the Query Definition as needed

6 - 37

Redeploy to Unwired Server

After adding the Object Query, save the project and re-deploy the project to Unwired Server

Be sure to choose Message-based when you deploy workflow MBOs

6 - 38

Create Workflow Application


In the project, create a new Client-initiated Mobile Workflow application Add a new empty screen named CustomerList:

6 - 39

Define Search Screen

Add an EditBox control to the Start Screen where user will input search criteria

User will enter a state into this control

Add a menu it item t to perform f th the online li llookup: k

6 - 40

Generate Key for EditBox Control


With the EditBox control selected click the New Key button in Properties view Give the key an appropriate name and type

6 - 41

Configure Lookup Menu Item

Invoke finder object query and success screen navigation:

6 - 42

Map Query Object Parameters to Keys

On the Parameter Mappings tab of the Menu Item:

Map the finder finder method methods s in parameter to the key tied to the control where criteria will be entered:
Finder method in parameter

Key tied to control


6 - 43

Add Listview Control to Results Screen

Drag the Listview control to the results screen

6 - 44

Configuring Listview Key

For this scenario, select Customer from the Key dropdown

Maps the Customer MBO to the Listview control Listview Details are created from scratch or use the drag and drop method for creating screens before using it
Bind Customer MBO to Listview

You can also map the Listview to a Listview Details Screen

6 - 45

Define Listview Columns (Cells)


Add cell lines and then add fields for each cell line For each field, field choose an MBO key, key then define the width and a header name:

6 - 46

Configure Application General Properties


Change Module display name to what you want the user to see under the workflow icon on the device Choose a workflow Client icon

6 - 47

Generate and Test

Generate the workflow and test:

6 - 48

Server Initiated Online Lookup


Online lookup can also be added to server-initiated workflow applications The process here is a little more automated

Th Object The Obj Query Q will ill b be automatically i ll generated d

Steps:
Create an MBO with one load parameter Map p the p parameter as a p propagate-to p g attribute Then assign the MBO to a cache group that uses an Online p y policy

6 - 49

Sample MBO Source

Note that when the source of any MBO contains an input parameter the parameter automatically becomes a Load parameter, Parameter in the MBO:

6 - 50

Resulting Load Parameter

For Online lookup, map the Load Parameter to a Propagate to Attribute:

Note the Load parameter in this case is not being given a value

6 - 51

Create A New Cache Group


To perform online lookup, never use the Default Cache Group Server-initiated Server initiated online lookup scenarios require the cache policy set to Online

O li cache Online h policy li will ill only l work k with i h MBS applications li i

6 - 52

Assigning MBOs to Cache Groups


MBOs are automatically assigned to the Default Cache Group Drag MBOs from one cache group to another

Do not D t drag d th the MBO MBOs inside Mobile Business Objects folder into your cache group

6 - 53

Query Object Creation


The findByParameter object query does not exist until it is created automatically automatically as a result of the previous steps The name of this object query is non-editable

For the changes to take effect re-deploy the project and build a Server-initiated Workflow application

6 - 54

Creating Server-Initiated Workflow

Steps:

Create a workflow application using the editor with a serverserver initiated starting point

From Unwired WorkSpace, WorkSpace select File New Mobile Workflow Forms Editor Select the folder that contains the Customer MBO that was just configured for Online Lookup Name the file CustomerOnlineLookup.xbw and click Next In the Starting Points screen, select Responds to server-driven notifications, , and click Next

6 - 55

Creating Workflow Application

This is the standard wizard for creating new mobile workflow application:

6 - 56

Configuring A Server-Initiated Workflow

Select server-initiated starting point:

6 - 57

Associate Workflow to MBO / Object Query


Search for the MBO Select the FindByParameter object query Wizard will add the parameter to be used:

6 - 58

Define Sample Notification

Define a sample email notification:

6 - 59

Define Matching Rules


Create a Matching Rule Used to determine how to route the email notification

Select S l t only l the th text up to and including the first parenthesis

Matching M t hi R Rule l iis not t an Extraction Rule


Continued

6 - 60

Define Matching Rules

Once selected, Matching Rule will be entered into the Matching Rule area of the window:

6 - 61

Define Extraction Rules


In this scenario, the state value will be extracted from the subject line and passed to the object query parameter Requires definition of Start and End tags Verify V if value l extracted is as expected t d

6 - 62

Complete the Workflow


Add screens and flows as needed When all the required screens are completed, completed generate the workflow to the device using the context menu

6 - 63

Test Email Notification


The workflow editor has a test feature that allows you to manually send messages to devices Right-click Right click and select Send a notification

6 - 64

Test Message
Provide a sample message that adheres to that of the Matching Rule Will be used by the Extraction Rule to determine the value to send to Unwired Server via the MBO

6 - 65

Result of Test Notification


The workflow notification has been received on the device User can click to open the workflow form:

6 - 66

Resulting Workflow Form

Once opened, the workflow f instance will display only the d that data h satisfies i fi the criteria used by the h M Matching hi and d Extraction Rules

E.g. Customers who reside in TX

6 - 67

User Interface f C Customization

MODU ULE E TO OPIC CS


6 - 68

Implementing p g Online Lookup p Other Advanced Topics Localization Security Aspects

On-Device Request Result Caching

Can now specify a timeout value when making an online request that invokes an object query

Formerly referred to as synchronous submit

When value is non-zero, the results of the query will be cached and encrypted in a cache on the device Subsequent requests using the same parameter values will use the results from the cache rather than a new result set retrieved from the server The contents of the cache can be cleared through custom code, either selectively or entirely

6 - 69

Setting On-device Cache Timeout

6 - 70

AttachmentViewer Control

Uses device-side rendering of the following file types:


pdf jpg gif doc

Content for attachments can be downloaded as part of the original workflow message sent either as the result of an online request or as a server-initiated notification

6 - 71

Attachment Support

When requested as part of an online request of a workflow application attachments will be stripped out of the message application,

These attachments are:

Stored in the device cache for later use when displaying in the attachment viewer Encrypted

Binary y content can also be extracted from the workflow message and used as the source for an image on the page

6 - 72

Attachment Support By Platform

Note that BlackBerry and Windows Mobile require third-party software to view certain file types:

6 - 73

Create Database to Contain Images

Database sample below has a column (pic) that is a blob type

Also contains picType to hold the MIME type necessary for the AttachmentViewer

6 - 74

Inserting Sample Data

In this example, a Sybase SQL Anywhere system stored procedure (xp_read_file) (xp read file) is being used to read the physical pictures and convert them to binary data as they are inserted into the table:

6 - 75

Sample Data Inserted into Table

Table showing the binary conversion of the provided image files:

6 - 76

Source MBOs for Binary Data

6 - 77

Available Screen Keys

Note that the data binding of Emps/pic, which is a Binary type in the database, database is mapped to a key of type String:

6 - 78

Screen Design
Attach the Input Data Binding Key to the AttachmentViewer control Set the MIME type key

AttachmentViewer Control

6 - 79

AttachmentViewer on Device
Creates the hyperlink Click hyperlink to launch the viewer:

Picture fetched using Att h AttachmentViewer tVi f from database via MBO
6 - 80

User Interface f C Customization

MODU ULE E TO OPIC CS


6 - 81

Implementing p g Online Lookup p Other Advanced Topics Localization Security Aspects

Localization

Is the process of translating an application into different languages

Adapting an application for a specific country or region

Th f The following ll i can b be llocalized li d iin a W Workflow kfl application: li ti


Screens Screen Controls Menu items

Localization is accomplished by defining conversion instructions within a locale properties file

6 - 82

Changing Encoding Type


The properties file must be edited using ASCII so that its content can be correctly read and converted to Unicode This is done in Window Preferences:

6 - 83

Creating Locales
A locale is created in the Workflow Forms Editor Click the New button in the Localization tab

Results in a new properties file being added to your project

6 - 84

Locale Wizard
Must minimally specify a language Optionally, you can specify a country and a variant:

6 - 85

Mobile Workflow Localization Requirements


Application names can not begin with a numeric Combination Requirements:

If you add a locale that includes a country, must also include th locale the l l th that t contains t i only l th the llanguage If you add locale that includes a variant, must also include a l l with locale ith th the llanguage and d country t
Language only Language and Country Language, Country Language and Variant

6 - 86

Default Locale
Denoted with a blue checkmark Used when the regional settings on the device does not match the locales created for the workflow:

6 - 87

Editing a Locale Properties File

Right-click one of the newly created locale files in the WorkSpace Navigator:

6 - 88

Configure the Device for Localization

On BlackBerry, the locale is changed under Options Typing and Input Languages:

6 - 89

User Interface f C Customization

MODU ULE E TO OPIC CS


6 - 90

Implementing p g Online Lookup p Other Advanced Topics Localization Security Aspects

MenuItem of Type Select Certificate


Create a menu item on a workflow screen Select the Select Certificate type to allow the user to display and choose an X.509 certificate

The screen is Th i automatically i ll created d that h allows ll the h user to select which certificate to use:

6 - 91

Certificate Picker Windows Mobile

Windows Mobile platform certificate picker will display when the Specify Specify Certificate Credentials Credentials menu item is used:

Select your Certificate

Certificate pp details appear...

6 - 92

Certificate Picker - BlackBerry

The platform picker varies depending on which platform the application is running:
Certificate details appear...

Select your Certificate

6 - 93

Design-Time Authentication

Static certificate-based authentication can be specified at design-time:

Click Generate from Certificate to display p y Picker dialog


6 - 94

Labs

Lab 6-1: Enhancing the Workflow Application


Task 1: Make General Cosmetic Changes Task 2: Write Validation Rules Using the Editor Task 3: Familiarize Yourself with Generated Files Task 4: Alter Application Appearance Task 5: Add Custom Business Logic Task 1: Create a Client-initiated Client initiated Online Lookup Task T k 1: 1 Setup S t the th D Database t b Task 2: Create the Mobile Workflow Application T k 3: Task 3 Add an Attachment Att h t Viewer Vi C Control t l

Lab 6-2: Creating an Online Lookup Scenario

Lab 6-3: Using the Attachment Viewer Control


6 - 95

Lab Debriefing
What did you do and why? What went well in the lab? What insights did you get during the lab? What did you observe in the lab? What did you find challenging? Add any items to your troubleshooting list

6 - 96

Module Summary

During the course of this module, you have learned:


Workflow application screens can be customized via Mobile Workflow Forms Editor, and the HTML, JavaScript and/or CSS generated files How to add business logic using JavaScript in combination with the provided API How to configure device data caches in a workflow application How H to t use th the Att Attachment h t Viewer Vi control t l How to perform Online Lookups from a workflow application How to localize a workflow application

6 - 97

Module Post-Assessment
1. True/False. BlackBerry can natively display XLS attachments. attachments 2. True/False. Custom.js is where you will make the majority of the modifications to a workflow application. application 3. Name the file that contains many of the workflow functions that can be called when modifying the workflow application.

6 - 98

Sybase Unwired Platform 2.1 Mobile Application Development

Module 7: Introduction to Native Mobile A li i Development Application D l


Copyright 2012 Sybase, Inc. All rights reserved. Unpublished rights reserved under U.S. copyright laws. Sybase, and Sybase logo, are trademarks of Sybase Inc., or its subsidiaries. indicates registration in the United States of America. SAP, and the SAP logo, are the trademarks or registered trademarks of SAP AG in Germany and in several other countries. All other trademarks are the property of their respective owners.

Module Pre-Assessment
1. For which platforms can you generate native mobile applications? 2. Differentiate between a synchronization parameter and a load parameter. 3. Name the platforms to which you can deploy Sybase Unwired Platform Native applications. 4. Name the language used to build iOS applications.

7-2

Module Objectives

Upon completion of this module, you should be able to:

Prepare your environments to develop, develop deploy and test a native mobile application

Visual Studio Xcode Eclipse

7-3

Writing a Native Application

MO ODULE TOP PICS S


7-4

Preparing p g the Visual Studio Environment Preparing the Xcode Environment Preparing the Eclipse Environment

Mobile Device Applications

Device applications can consist of:


User Interface layer Business logic layer Unwired Server Client Object APIs Device platform and third-party Frameworks

Unwired Platform provides a mechanism to generate object code for a device platform
Java for BlackBerry or Android devices C# code for Windows and Windows Mobile devices Objective C for iOS devices

This code can be used in the native IDE to develop a native mobile application

7-5

Generating Code for a Native Application

Unwired WorkSpace is used to generate the back-end code for an application

This back-end code is then imported into an IDE project of choice to develop the user interface

In the Unwired WorkSpace right-click i ht li k over th the M Mobile bil Application Project and select Generate Code Code Starts the Code Generation wizard

7-6

MBO Selection for Generation


Choose the MBOs for which you wish to generate code Generate metadata classes creates additional classes that describe the attributes and operations of the generated objects

Si il t Similar to J Java R Reflection fl ti

Object manager allows you to retrieve the metadata at runtime

Can only choose one of these two

7-7

Configuring Generation Options


Choose a Language Platform Language, Platform, Server domain, etc. Options change depending on language chosen Choose RBS or MBS S depending on the device platform

7-8

Location of Generated Code

A Generated Code folder appears under the Mobile Application Project in the WorkSpace Navigator

7-9

Generated Metadata Classes

The metadata classes are also under the Generated Code folder

\src\namespace\ intrnl

7 - 10

What Was Generated?

The project illustrated in the previous screens, ForGenVS, now contains objects generated to represent each of the MBOs

ForGenVS has a Customer and a Product MBO

Customer.cs and Product.cs represent these MBOs and contain t i these th k key members: b
Fields for each of the attributes defined in the MBO Properties to GET or SET the values of the fields Methods to fetch data: FindAll( ( ), ) FindByPrimaryKey( y y y( ) ), etc. Create( ), Update( ) and Delete( ) methods

7 - 11

Customer.cs

Partial code from the generated Customer.cs:

Note that the FindAll method returns a Sybase.Collections.GenericList

7 - 12

Writing a Native Application

MO ODU ULE TO OPIC CS


7 - 13

Preparing the Visual Studio Environment Preparing the Xcode Environment P Preparing i th the E Eclipse li E Environment i t

Smart Device Project Template

Launch Microsoft Visual Studio 2008


At the start page select File New Project Choose Visual C# for the language From the Project Templates, select Smart Device Project

7 - 14

Select Target Platform and Template


Choose the target platform and the .NET Framework version Click the Device Application template icon

Note that the target platform and .NET framework version must be the same as the options selected during the code generation process in Unwired WorkSpace

7 - 15

Resulting Project
Once the template is selected the framework of the project is built Project details are displayed in the Visual Studio Solution Explorer Expand the project to view its components

i.e. Expand the References folder to view the predefined assemblies

7 - 16

Add References to the Project


In the VS Solution Explorer, highlight the project name, right click and select Add Reference. Reference Click the Browse tab to locate and select these .dll files from your system:

sup-client.dll

C:\Sybase\UnwiredPlatform\ClientAPI\RBS\WM C:\Sybase\UnwiredPlatform\ClientAPI\RBS\WM\Ultralite

iAnywhere.Data.UltraLite.dll

7 - 17

Additional Libraries

These libraries need to be added to the project:


ulnet11.dll ulnet11 dll mlcrsa11.dll PUtilTRU.dll PUtilTRU dll

In VS, select the project name, right click and select Add Existing Item

ulnet11.dll

C:\Sybase\UnwiredPlatform\ClientAPI\RBS\WM\Ultralite C:\Sybase\UnwiredPlatform\ClientAPI\RBS\WM\ServerSync C:\Sybase\UnwiredPlatform\ClientAPI\RBS\WM

mlcrsa11.dll

PUtilTRU.dll

7 - 18

Configure the Libraries

For each of the added libraries, set the Copy py to Output p property to a value of Copy Always Select the mlcrsa11.dll library

In the Properties pane, scroll t the to th Copy C to t O Output t t parameter Click the drop-down arrow to select Copy always PUtilTRU.dll ulnet11.dll

Repeat p this p process for:


7 - 19

Add Generated Code to Project


Return to Unwired WorkSpace In WorkSpace Navigator Navigator, right click the Generated Code folder and select Copy In Visual Studio, paste this folder into the project Generated Code folder with Dlls and src folder should be di l d displayed:

7 - 20

Delete Unnecessary Files


The copy and configuration of the required .dll dll files has already been completed In the Visual Studio project, project you will need to remove unnecessary dlls

Delete this folder

Therefore, delete the Dlls f ld iin th folder the Generated G t dC Code d folder

Open the O th src f folder ld and d delete d l t the file with the extension csproj j

7 - 21

Creating a Test Form


Add two Label and two Textbox controls to Form1 for username and password Drag and drop two Label and Textbox controls onto the upper portion of the form Drag and drop a Button control and place it below the textboxes Add another Textbox below the button Set the appropriate properties for the controls so that the form looks like like

7 - 22

Adding Code to the Form


Double-click the Login button to display the buttons code window (Form1.cs) (Form1 cs) Add the following Using statements at the top of the source:

using i S Sybase.Persistence; b P i t using DaveCo;

Namespace used during code generation

Add the following in the Login buttons clicked event:


ConnectionProfile cp = ForNativeAppDevDB GetSynchronizationProfile(); ForNativeAppDevDB.GetSynchronizationProfile(); cp.ServerName = dev903; cp.PortNumber p = 2480; Change cp.save(); ServerName to

match y your VM
7 - 23

Continued

Adding Code to the Form

In the Login buttons clicked event, add a try / catch block to connect to the Unwired Server and to write status information to multiline textbox Name of the database class
try {

is project dependent

ForNativeAppDevDB.LoginInSync (textBox1.Text, textBox2.Text); ) textBox3.Text = Connected to SUP; } catch (E (Exception ception e ex) ) { textBox3.Text = Error connecting to SUP \r + ex.Message; }

7 - 24

Cli k th Click the S Save iicon t to save thi this code d

Windows Mobile Deployment

Make sure that your Windows Mobile Device is:


Connected C dl d Cradled

Cradled

At this point, the Windows Mobile emulator should be ready to accept the deployment of the Windows Mobile Unwired Platform application

7 - 25

Build the Test Application


From the VS menu, select Debug Debug SUPNativeApp Check the Output view to insure that the application builds with no errors

7 - 26

Deploy to Windows Mobile

Deploy application to the Windows Mobile emulator:

Select Windows Mobile 6 Professional Emulator

7 - 27

Test Application
Go back to the emulator Form1 should be displayed on the emulator

E Enter login l i credentials: d i l


User ID: supAdmin Password: s3pAdmin

Click the Login button and Connected to SUP should be displayed in the multiline text box

7 - 28

Writing g a Native Application pp

MODU ULE TO OPIC CS


7 - 29

Preparing the Visual Studio Environment Preparing the Xcode Environment Preparing the Eclipse Environment

iOS Development Requirements

To develop for the iPhone, for example, you will need:


MacOS X 10 10.6 6 (Snow Leopard) with Xcode 4 4.0.2 0 2 and iOS SDK 4.3 Development certificates (to sign your applications) Provisioning profiles installed on the device

Must register as an Apple Developer before you can download the components above Subscribe to the Apple Developer Program at:

http://developer.apple.com/iphone

7 - 30

Types of Apple Developer Accounts

Standard Developer

Registration fee applies Allows you to develop commercial applications and deploy them via the App Store Registration fee applies Allows large companies to create applications but distribute them internally (outside of the App Store)

Developer Enterprise

7 - 31

Programming Requirements

What is used when programming the iPhone? Tools Frameworks ObjectiveC

Foundation [textViewsetStringValue: @Hello]; Xcode UIKit

7 - 32

What is Installed with Xcode?

Xcode:

IDE that allows you to create, create manage manage, edit and debug your projects

Si l t Simulator:
Software simulator to simulate iOS device on your Mac Not all features are available in the iOS simulator

7 - 33

Supported Device Platforms

Xcode allows you to develop native applications for iPhone, iPod Touch and iPad:
iPhone 3G iOS 4.2, iPhone 3GS/4 iOS 4 4.2 2 and iOS 4.3 iPod Touch 3rd/4th gen with iOS 4.2 and iOS 4.3 iPad iOS 4 4.2 2 and iOS 4 4.3 3 iPad2 iOS 4.3

7 - 34

Objective C
Language used to build an iOS application Object-oriented Object oriented - but is more like SmallTalk than Java or C#

Messages are sent to objects instead of invoked methods The receiving object must determine how to work with the incoming message

Syntax is completely different from Java or C#

Example: p

[ReceiveObject aMethod: ObjectB] Means that the message, g , aMethod is being g sent to ReceiveObject, passing ObjectB as an argument

7 - 35

Setting Code Generation Options


In Unwired WorkSpace perform WorkSpace, Code Generation Select Objective C for iOS applications Recommend creating separate directories for each device-platform f language generation

Directory must be created before code is generated

iOS applications are MBS

7 - 36

Viewing Generated Code

The generated code folder is broken into:

Includes

I t f Interface fil files Implementation files f

Source files

Copy these files from your Windows environment to a folder on your Macintosh

7 - 37

SUP Client APIs for iOS

In addition to the generated code, you MUST copy the iOS Client APIs to your Mac

Located at: ...Sybase\UnwiredPlatform\ClientAPI\MBS\ObjectiveC

Copy the C th entire ti contents t t of f the th f folder ld into i t a separate t directory on the Mac from the directory containing the generated code

7 - 38

Starting Xcode
On the Mac, select File New Finder Window Navigate to the /Developer/Applications folder on the Macintosh HD Double-click on the Xcode icon

7 - 39

Xcode Initial Screen

Start your new project by clicking the Create link:

7 - 40

Choosing an Xcode Project Template


With Xcode running, click on FileNew Project Choose an appropriate project template type:

7 - 41

Defining Project Options

Provide a name as well as other project options:

7 - 42

Initial Project

As seen on a prior page, the Windows-based project template results in a main window and application delegate being created:

App Delegate Main Window

7 - 43

Target Summary Settings

Can change targeted device and SDK here:

7 - 44

Configure Scheme Settings


On Xcodes menu select ProductEdit Scheme In the Info tab of the scheme dialog choose the appropriate Destination and Build Configuration

7 - 45

Adding SUP Generated Code to Project


Click the Xcode menu FileAdd Files to In the Finder window that appears select appears, the Generated Code folder that was copied from the Unwired WorkSpace:

7 - 46

Project with Generated Code Added

The Xcode project now contains the code that was generated in the Unwired WorkSpace and copied to the Macintosh:

7 - 47

Importing SUP Client API Libraries


Click Xcodes FileAdd Files to menu and choose the appropriate SUP Client libraries (3 files) Choice depends on Product Scheme settings shown earlier 7 - 48

Project After Importing Client API Libraries

7 - 49

Add SUP Client API Includes to Project

From the Windows machine, copy the \UnwiredPlatform\ClientAPI\MBS\ObjectiveC\includes folder into your Xcode project folder on the Macintosh:

7 - 50

Setting Project Header Search Path


Click on the Xcode project and select the Build Settings tab Alter the Header Search Paths, Paths adding the /includes folder you copied into the project

7 - 51

Adding Preference Settings


Right-click the project and create a New Group named d Resources R Add Settings.bundle into the Resources group This file is part of the SUP Client APIs that were copied i d earlier li

Located in the /includes folder

Allows the user to input user preference i f information, ti such h as server name, server port, etc.

7 - 52

Adding Other Required Frameworks


In the Project Navigator, select the Project, then choose the Target and then the Build Phases tab Expand the Link Binary With node and click the + symbol located at the bottom of this node to add the required frameworks

7 - 53

Choosing Frameworks
Can hold the Command key down to multi-select Frameworks: The following are required:

AddressBook.framework Add B kf k CoreFoundation.framework QuartzCore.framework Security.framework y libicucore.A.dylib libstdc libstdc++.6.dylib 6 dylib libz.1.2.3.dylib

7 - 54

Frameworks Added

7 - 55

Editing Target Valid Architectures

In the Build Settings of the target, adjust the Valid Architectures as shown below for an iOS Simulator environment:

7 - 56

Editing Target Library Search Path

The targets Library Search Path should include the location of the SUP Client API libraries:

7 - 57

Build the Project

Perform a Clean, followed by a Build of the project to make sure the configuration steps were successful:

7 - 58

Writing g a Native Application pp

MODU ULE TO OPIC CS


7 - 59

Preparing the Visual Studio Environment Preparing the Xcode Environment Preparing the Eclipse Environment

Define Code Generation Options


In Unwired WorkSpace, perform Code Generation For BlackBerry applications, select Java language Select Java ME platform Select an Unwired Server and Domain Enter a unique package name, etc. Check Replication-based

7 - 60

Expected Generation Error

Note that an error icon will appear in the generated source code for the BlackBerryNativeDB.java file

This file calls the net_rim_api.jar p j which is not in this projects build path

Ignore this error for now


Later when you create the BlackBerry project (different ( ff project), the requisite BlackBerry libraries are automatically added to the project This error will be resolved

7 - 61

Changing Perspectives

Until now, weve been using the Sybase Unwired WorkSpace Mobile Development perspective

Thats where we saw the error

To develop the user interface for the BlackBerry yp platform, , install the BlackBerry Eclipse plugin Then, ,y you can select Window Open Perspective Other

Select the BlackBerry y Application Development perspective

7 - 62

Create a New BlackBerry Project


From the BlackBerry Application Development perspective, select File New BlackBerry Project Name the project and select BlackBerry JRE 6.0.0 600

7 - 63

Two Projects in One Environment


We are no longer in the Unwired WorkSpace Navigator The Package Explorer will display all projects regardless of perspective type

Unwired WorkSpace Project


7 - 64

BlackBerry Plugin P j t Project

Add Required Files


Click the Libraries tab and then click the Add External Jars button Navigate to this directory:

C \S b \U i d Pl C:\Sybase\Unwired Platform\ClientAPI f \Cli API \ RBS \ BB

Select these files:


CommonClient.jar sup p_client_rim.jar j UltraLiteJ.jar

Click Finish to complete the wizard

7 - 65

Define the BlackBerry Application


At the completion of the wizard the BlackBerry Application Descriptor is displayed Click the Project tab:

Add a title for the application

Add an icon by clicking li ki th the Add External... button

7 - 66

Copy Unwired Platform Files to Project

Using Windows Explorer, navigate to

C:\Sybase\Unwired Platform\ClientAPI\RBS\BB CommonClient.cod, sup_client_rim.cod, UltraLiteJ.cod

Copy these files:

Paste these files to these two directories:


C:\BlackBerry_Java_Plugin\plugins\net.rim.ejde.componentpa ck6.0.0_6.0.0.30\components\simulator p C:\Sybase\UnwiredPlatform\Unwired_WorkSpace\Eclipse\syb ase_workspace\mobile\eclipse\plugins\net.rim.ejde.component _ p p p g j p pack6.0.0_6.0.0.30\components\simulator

7 - 67

Continued

Copy Unwired Platform Files to Project

Continuing in Windows Explorer, copy all the *.java files in the Unwired WorkSpace project projects s Generated code \src \src folder to the BlackBerry Application Development projects own \src \src folder
Do not copy the folder itself! Must M t copy iindividual di id l fil files If you get errors in the BlackBerry Application project, then you did not t copy/paste / t the th fil files correctly tl

7 - 68

Generated Files After Copy

The daveCo and daveCo.intrnl packages represent the files that were copied

These are the files that were generated in Unwired WorkSpace

7 - 69

Creating a Test Application


MyScreen.java is created for you by the New Project wizard Open MyScreen.java MyScreen java

Add the following required Imports to your code:

7 - 70

Continued

Creating a Test Application

Sample connection code:

7 - 71

Running the Mobile Application


Go to the Eclipse menu Run Run Configurations Select your mobile application and click Run:

7 - 72

Connected Status Screen


Upon executing/running the mobile application, go to simulator Click the mobile application applications s icon

If a connection was successful to the Unwired Server, Server the screen will display in its title Connected

7 - 73

Labs
Lab 7-1: Configuring BlackBerry Eclipse Plug-in Lab 7-2: 7 2: Project Setup Lab 7-3: Preparing the Visual Studio Environment

Task 1: Generate Code from Unwired WorkSpace Task 2: Create a Visual Studio Project j Task 3: Configure the Visual Studio Project Task 4: Create the Test Form Task 5: Deploy and Test the Application

7 - 74

Labs

Lab 7-4: Preparing the Eclipse Environment


Task 1: Generate Code from Unwired Platform Task 2: Create a BlackBerry Project Task 3: Copy Files to the BlackBerry Project Task 4: Create a Test Application Task 5: Run the Test Application

7 - 75

Lab Debriefing
What did you do and why? What went well in the lab? What insights did you get during the lab? What did you observe in the lab? What did you find challenging? Add any items to your troubleshooting list

7 - 76

Module Summary

During the course of this module, you have learned:

How to prepare your environments to develop, develop deploy and test a native mobile application

Visual Studio Xcode Eclipse

7 - 77

Module Post-Assessment
1. What utility do you use to connect (start) and cradle the Windows Mobile emulator? 2. True/False. The Mobile Development perspective is used to create a BlackBerry user interface. interface 3. True/False. You must copy all the *.java files in the Unwired WorkSpace projects Generated code folder to the BlackBerry Application Development projects own folder before f you begin to write code in your BlackBerry project. 4. In an iOS project, the generated code folder is broken into _______________ and _________________ source files.

7 - 78

Sybase Unwired Platform 2.1 Mobile Application Development

Module 8: Sybase Unwired Platform Client APIs API


Copyright 2012 Sybase, Inc. All rights reserved. Unpublished rights reserved under U.S. copyright laws. Sybase, and Sybase logo, are trademarks of Sybase Inc., or its subsidiaries. indicates registration in the United States of America. SAP, and the SAP logo, are the trademarks or registered trademarks of SAP AG in Germany and in several other countries. All other trademarks are the property of their respective owners.

Module Pre-Assessment
1. For which platforms can you generate native mobile application code? 2. Name the two types of replication available in Sybase Unwired Platform. Platform 3. Name the language used for building iOS applications. 4. What development IDE is used to create iOS applications?

8-2

Module Objectives

Upon completion of this module, you should be able to:


Explain details behind the Sybase Unwired Platform Client APIs Use the generated MBO code with the Client APIs to create a Windows/Windows Mobile application that performs CRUD functions Enhance the Windows application to perform typical platform functionality such as setting personalization key values functionality, values, synchronization parameter values, logging, etc. Use the generated MBO code with the client API to create an iOS native application that performs CRUD functions

8-3

Introduction

MODU ULE E TO OPIC CS


8-4

Exploring p g the Generated Code Sybase Unwired Platform Client API Overview Building a Visual Studio Application Building an iOS Application

Module Overview
In the previous module, you learned how to prepare the Visual Studio, Studio Xcode and Eclipse environments to begin development of native applications This module builds on those applications and demonstrates how to use the Sybase Unwired Platform Client APIs to build complete applications in Visual Studio and Xcode

8-5

Terminology

The terminology used in this module will be as it relates to the .NET NET environment

Will use terms like Assembly, Namespace, Using, etc.

These t Th terms will ill not t coincide i id with ith th those of f th the Obj Objective ti C or Java environments

For example, .NET uses Namespace, Objective C uses Name Prefix, and Java uses Package

It will be up to you to make the translation that is appropriate for your chosen environment

8-6

Introduction

MODU ULE E TO OPIC CS


8-7

Exploring p g the Generated Code Sybase Unwired Platform Client API Overview Building a Visual Studio Application Building an iOS Application

Topic Purpose
In order to understand the generated code and some of the code examples examples, you need to know what was created by Sybase Unwired Platform (server-side) You will be shown all of the objects that were created, created as well as various property settings, to help you understand the code examples that follow

8-8

Sample Mobile Project MBOs

The sample project contains different types of MBOs (database and Web Services), Services) some of which are related:

SOAP Web Service MBO that th t allows ll updates Notice how the number of operations differs between the MBOs
8-9

MBO Operations
An Other-type operation was added to the Customer MBO This operation calculates a sales tax rate by calling a stored procedure:

8 - 10

Personalization Keys

Personalization keys were created to allow user input so as to filter the data:

8 - 11

Load Parameters

The Contact MBO contains a Load Parameter that filters the data being brought back to the CDB

It is fed by the StatePersKey personalization key:

8 - 12

Synchronization Parameters

The Contact MBO contains a Synchronization Parameter that is used to filter the data sent between the CDB and the device:

8 - 13

Object Queries

The Contact MBO contains FindAll, findByPrimaryKey and findByLastName object queries:

8 - 14

Cache and Synchronization Groups


New Cache and Synchronization groups were added to the project The Product MBO was placed within these new groups:

8 - 15

Code Generation Review


Use the Generate Code wizard to create the object code that you will copy to the IDE of your choice Generated code should never be modified by the developer

8 - 16

Project to Generated Code Mapping


Sync Parm Container

Class th Cl that t generates PKs

Database class

8 - 17

Customer Object Fields

Fields (Instance variables) were generated for each of the MBO attributes and relationships:

8 - 18

Customer Object Properties


.NET Properties (getters and setters) were created for each of the attributes These properties will be used to allow you to display update and create display, customers

8 - 19

Customer Object CUD Operations


Operations, which were defined in the MBO, are included in the generated code You will learn to write code to call these operations

8 - 20

Customer Object Finder Methods


The generated code also includes methods for each of the Object Queries FindAll( ) returns a Generic List object

8 - 21

Review the Generated Code

Although you should never edit the generated code, a lot can be learned by a thorough review
Double-click on any of the generated classes in the Solution Explorer nd dropdown in the editor to easily view and navigate Use the 2 to any of the generated members

8 - 22

Introduction

MODU ULE E TO OPIC CS


8 - 23

Exploring p g the Generated Code Sybase Unwired Platform Client API Overview Building a Visual Studio Application Building an iOS Application

Introducing the Client APIs

In order to build a native mobile application, you will need knowledge of:
Generated Object Code from your Mobile Application Project Sybase S b Unwired U i d Platform Pl tf Client Cli t APIs API Language and workings of your target device platforms d l development t environment i t - such h as Visual Vi l St Studio di

Sybase Unwired Platform Client APIs are libraries that contain functionality required to build a native mobile application

8 - 24

Client Libraries

Recall that when setting up external IDE projects (Visual Studio Xcode), Studio, Xcode) you added the following client libraries:

8 - 25

Client Library Makeup


sup-client.dll is a .NET assembly that contains the core of the Client API sup-client.dll is comprised of three key namespaces, listed in order of importance:

Sybase.Persistence Sybase.Collections Sybase.Reflection

8 - 26

Namespace Information

Sybase.Persistence

Contains interfaces, interfaces enumerations and important classes, classes such as the Database class, to allow the application to connect to an Unwired Server, Server create a device local database database, etc. Contain several list-based classes that can be populated with MBO data and traversed to access/display data Classes contain functionality to allow runtime interrogation/investigation of details, such as MBO attributes and d their th i types, t operation ti d details, t il etc. t

Sybase Collections Sybase.Collections

Sybase.Reflection

8 - 27

Client API Documentation


Documentation is available for each supported language In the case of .NET, NET C:\Sybase\UnwiredPlatform\ClientAPI\apidoc\cs contains a Windows Compiled Help file (*.chm): (* chm):

8 - 28

Inside the Client API Documentation

Choose a namespace to see classes, interfaces, etc.:

8 - 29

Continued

Inside the Client API Documentation

Choose a class to see members (methods, properties, etc.):

8 - 30

Learn the API by Example


The best way to learn the Client API is by example The next topic will demonstrate typical RBS processes such as:

Connecting C i to an U Unwired i dS Server Creating/deleting a device database CRUD operations Setting g Personalization Key y values Setting Synchronization Parameter values

8 - 31

Introduction

MODU ULE E TO OPIC CS


8 - 32

Exploring p g the Generated Code Sybase Unwired Platform Client API Overview Building a Visual Studio Application Building an iOS Application

Creating Forms

Begin by creating the necessary forms for the application

This is a common Visual Studio process

Business functionality can be placed inside the form control events form, and/or functions

8 - 33

New Form and Controls


Displayed is FormLogin.cs The form contains three Labels, Labels two TextBoxes and a Button control:

8 - 34

Using Statements

In the code-behind-the-form, add the necessary using statements:

8 - 35

Unwired Server Connection Code

8 - 36

Synchronization Code Example


Synchronize( ) brings the data down to the device per the load and sync parameters Synchronize( ) is overloaded so as to pass the name of the Synchronization Group as a parameter

8 - 37

Microsoft ListView Setup Code


The custom SUPUtility class also contains a method that will initialize a Microsoft Listview control Created as a method to avoid repeating the same code in numerous places

8 - 38

Code Example to Read Data

8 - 39

Code Example to Edit Data

Data is read from the selected item on the list screen and passed to an overloaded constructor and then processed:

List Screen Code Detail Screen Constr.

8 - 40

Code Example to Update Data


The following reads in changes made by the user into the MBO reference (custDet) and then uses the MBOs Update( ) method to apply the changes to the device database Then the Update( ) is replayed on the server with SubmitPending( )

8 - 41

Code Example to Create Data

A new MBO instance is created, properties are used to set values, values and Create( ) is called:

8 - 42

Personalization Key Code


Instantiate the PersonalizationParameters object by calling the Database object objects s GetPersonalizationParameters( ) method This object has properties for each Personalization Key defined in the project

Set values into the properties

Save and synchronize:

8 - 43

Code to Populate Synchronization Params


Instantiate the MBOs Synchronization Parameters object by calling the MBOs MBO s GetSynchronizationParameters( ) method Properties exist for each synchronization parameter

S Save Set, S and dS Synchronize h i

8 - 44

Code Example to Delete Data


Delete code is relatively easy Get a handle to the instance you wish to delete, delete usually by calling a Finder method, and then use the MBOs Delete( ) operation

8 - 45

Code Example to Call an Other Method


Create an instance of the Other operation Set the parameter values Call the Save( ) method:

8 - 46

Code Example to Call FindByLastName

8 - 47

Dynamic Queries

Sybase.Persistence.Query is used to build dynamic queries:

8 - 48

Client Logs Table


Use the Database classs GetLogger( ) method to obtain an instance of the logger interface Choice of the logger method that writes rows to the logs table depends on the log level:

8 - 49

Reading Client Log Entries

You can use a Query object to fetch rows into the client logs table and then display them in a control (i.e. (i e ListView):

8 - 50

Makeup of Log Entries


Name
messageId component entityKey code

type
long String String Int

Description
The unique key of the log Name of the MBO for the row for which this log record was written String representation of the primary key of the row for which this log record was written One of several possible error codes codes. Text in blue are MBS only only. 200 indicates success. 401 indicates that the client request had invalid credentials, or that authentication failed for some other reason. 403 indicates that the client request had valid credentials credentials, but that the user does not have permission to access the requested resource (package, MBO or operation). 404 indicates that the client tried to access a non-existent SUP package or MBO. 405 indicates that there is no valid license to check out for the client. 500 to indicate an unexpected (unspecified) server failure. failure Descriptive message from the server with the reason for the log record The operation p ( (e.g. g create, , update, p , or delete) ) that caused the log g record to be written The id of the replay message sent by the client that caused this log record to be written Date and time of the log record

message p operation requestId timestamp 8 - 51

String String g String DateTime

Sybase Unwired Platform Documentation

Additional documentation can be found in the Developer Reference for Windows and Windows Mobile guide:

8 - 52

Introduction

MODU ULE E TO OPIC CS


8 - 53

Exploring p g the Generated Code Sybase Unwired Platform Client API Overview Building a Visual Studio Application Building an iOS Application

Project Setup Review


Recall that iOS project setup and configuration steps were shown in the previous module Project setup included:

Generating G i your projects j object bj code d and d copying i iit to your Mac Copying the provided iOS Client Library files from your Windows environment to your Mac Copying other Sybase Unwired Platform required files (headers, settings.bundle, etc.) to your Mac Configuring Xcode project settings such as Header and Library Search Paths, etc.

8 - 54

Objective-C Client API Documentation

8 - 55

Model-View-Controller (MVC)

iOS applications are built using the MVC pattern:

Model

Represents and manages the application state (the data) Does not care about the UI Representation of MBOs built with the Unwired WorkSpace Is the UI and allows the user to manipulate the data Built using g Interface Builder ( (XIB file), ) which is p part of Xcode The code that bridges the Model and the View

View e

Controller

When the data changes (Model), it is responsible for updating the View and vice-versa

Built using Xcode

8 - 56

Creating a New Controller


In Xcode, right-click over your Project and AddNew File Select Cocoa Touch UIViewController:

8 - 57

Naming the Controller (and Options)


Name the controller class to be associated with the XIB Enable the option to build an XIB file:

8 - 58

Result of Controller Class Creation

Notice that the project now contains the controllers header and implementation files, files as well as the *.xib xib file (User Interface):

8 - 59

Interface Builder

The View (UI) portion of an application is an XIB file which is managed by Interface Builder

Installed/integrated with Xcode

Use th U the Interface I t f Builder B ild t to add dd controls t l t to screens and d set t their properties View elements are connected to Controller elements via drag and drop

8 - 60

XIB Opened with Interface Builder

Select the *.xib file to begin View design:

Note the new blank screen

8 - 61

Interface Builder Object Library

Contains controls that are dragged onto screens:

8 - 62

Interface Builder Attributes Inspector

Where various properties of screens and screen controls are set:

8 - 63

Controller Header File


Defines instance fields and properties for each of the controls and the underlying MBO Also defines actions to be coded in the implementation file

8 - 64

Controller Implementation File


Add the required imports Instruct the Objective C Objective-C compiler to generate (i.e. (i e to synthesize) getters and setters methods for the instance fields defined in the header file

8 - 65

Coding Actions in the Implementation File


One of the actions defined in the header was buttonPressed For this scenario, code that will interact with Sybase Unwired Platform will be placed in this action:

8 - 66

Controller PseudoCode Process


Create a synchronization profile Register a callback (optional)

For notifications of subscription results or failures

Create the database and start synchronization Start the client engine g Login to the Unwired Server Subscribe to the database Process CRUD requests Unsubscribe from the database Disconnect from the server

8 - 67

Initialization Code

8 - 68

Code Example to Create Customer

After generating a new key value and d allocating ll ti a new customer instance, , the...

Attribute values are set Save operation is called Pending g changes are submitted to the Unwired Server

8 - 69

Code Example to Read Data

Call the findAll method of the MBO to return the data to a structure that can then be traversed to access the data:

8 - 70

Example for Setting a Personalization Key

Personalization keys can be assigned a value at runtime, usually by querying the user for input

E.g. When the findAll method is executed, the resultset will be limited to CA CA customers:

8 - 71

Code Example to Update Data


To update a customer, call one of the finder methods to get a reference to a particular customer Provide new values for the desired properties, save the changes and submit to the Unwired Server:

8 - 72

Code Example to Delete Data


Find method is called and returns a specific customer Customer MBOs delete and submitPending operations are called to update the data on the server:

8 - 73

Code Example for Application Cleanup

An application cleans up by unsubscribing and stopping the connection:

8 - 74

Linking Controls to Properties (Outlets)

From the Connections Inspector, drag to associate an Outlet (field) in the Controller with a screen control:

8 - 75

Linking Controls to Actions

From the Connections Inspector, drag to link controls to controller actions:

8 - 76

Preparing to Test an iOS Application

Before you can run the application in the simulator, you must register your MBS device user in the Sybase Control Center (SCC)

Similar to what is done for Mobile Workflow applications

In the SCCs Treeview (left view) select Device Users


In the right view, select the Devices tab Click the Register button

In the Register Device window specify:

User name, server name, port, Farm ID and an activation code

8 - 77

Register Device Window of the SCC

8 - 78

Settings.bundle
During the Xcode project setup and configuration, one of the steps was to copy the settings bundle settings.bundle file into the project This file creates a settings screen for the Sybase Messaging Client

8 - 79

Click here to access Settings Screen

Enter Messaging Client Settings


Input server connection information User name and activation code are the values set when the device was registered in the SCC

8 - 80

iPhone Simulator
Simulator functions like the real device ProductRun in Xcode starts the iPhone simulator

Depends on your project settings

Test the application To close the simulator, select iOS Simulator Quit iOS Simulator or press Command + Q p

8 - 81

Client APIs
This module has discussed only a few of the Client APIs For more information, information refer to the Sybase Unwired Platform Developer Guides for:

Windows Wi d and d Windows Wi d Mobile M bil iOS BlackBerry

8 - 82

Labs

Lab 8-1: Using Sybase Unwired Platform APIs and Generated Code
Task 1: Import an Existing Project Task T k2 2: C Create t a Visual Vi l Studio St di Project P j t Task 3: Configure the Visual Studio Project Task 4: Create the Login Form Task 5: Create the Main Form Task 6: Create the Customers Form Task 7: Create the Customer Detail Form Task 8: Create the Contacts Form Task 9: Deploy and Test the Application

8 - 83

Lab Debriefing
What did you do and why? What went well in the lab? What insights did you get during the lab? What did you observe in the lab? What did you find challenging? Add any items to your troubleshooting list

8 - 84

Module Summary

During the course of this module, you have learned how to:
Develop, deploy and test a Windows Mobile native application Develop using Generated Code, the Client API and Visual Studio as the development IDE Develop, deploy and test an iOS native application using Generated Code, Code the Client API and Xcode as the development IDE

8 - 85

Module Post-Assessment
1. True/False. Sybase Unwired Platform gives you a FindAll( ) method. method You must write the code for any additional finder methods yourself. 2 What utility do you use to connect (start) and cradle the 2. Windows Mobile emulator? 3. What must your code do after you submit pending changes? 4. True/False. Another name for interface files is header files.

8 - 86

Sybase Unwired Platform 2.1 Mobile Application Development

Module 9: Android Native Application D l Development


Copyright 2012 Sybase, Inc. All rights reserved. Unpublished rights reserved under U.S. copyright laws. Sybase, and Sybase logo, are trademarks of Sybase Inc., or its subsidiaries. indicates registration in the United States of America. SAP, and the SAP logo, are the trademarks or registered trademarks of SAP AG in Germany and in several other countries. All other trademarks are the property of their respective owners.

Module Pre-Assessment
1. True/False.Android SDK Tools include: SDK Manager and AVD Manager. Manager 2. True/False. Android Development Tools (ADT) is a plugin to the Eclipse IDE. IDE 3. True/False. An Android mobile application cannot run on an emulator.

9-2

Module Objectives

Upon completion of this module, you should be able to:


Identify key components of the Android SDK used for Android application development Configure an Android environment to develop an Android mobile application Generate G t J Java Object Obj t code d t to b be used d as backend b k d code d f for an Android application Create, C t test t t and d launch l h an Android A d id mobile bil application li ti

9-3

Writing an Android Native Application

MODU ULE E TO OPIC CS


9-4

Configuring g g the Android Environment Generating Java Object Code Creating the Android Project Launching and Testing the Application Using Client Object API

Android Application Development


Android is a software stack for mobile devices that includes an operating system, system middleware and applications Android applications are complied into an installable Android package Once installed on a device, each Android application is contained in its own security sandbox

Android operating system is a multi-user Linux system with each applicaiton as a different user Each application is assigned a unique Linux ID

Only the user ID assigned to an application can access it

Each p process has its own virtual machine so an application pp runs in isolation from other applications

9-5

Android SDK Tools

SDK Manager
Tool to install and update SDK Tools Each time the SDK Manager is launched the system is checked for most current version of software and makes recommendations

AVD Manager M
Tool to manage Android Virtual Device configurations AVD is a device configuration for the Android emulator

9-6

ADT Plugin for Eclipse


Android Development Tools (ADT) is a plugin to the Eclipse IDE Using the ADT you can:

Define D fi projects j Create an application ID Add components with the Android Framework API Debug g applications pp Export signed files to distribute an application

Current version of ADT is ADT 16 16.0.1 0 1 and requires:


Eclipse Helios v3.6 or higher SDK Tools r16

9-7

AndroidManifest.xml File
Every Android application must have an AndroidManifest.xml file in its root directory Presents essential information to the Android system that allows the application to run Some of the key information in this file:

Assigns a package name to the application Describes components of the application

So the Android system knows when application components are to be launched

Declares permissions so the application can interact with other applications Lists libraries that the application must be linked against

9-8

Creating an Android Mobile Application

Using Unwired WorkSpace, create a mobile application that will pull data from Unwired Platform
In this class, we will create a basic application to pull data from the sampledb When the project is deployed and packaged, it will create a JAR file that will be used as the backend for the Android application

Use Android ADT functionality in Unwired WorkSpace to create an Android application to run on an Android device

9-9

Writing an Android Native Application

MODU ULE E TO OPIC CS


9 - 10

Configuring g g the Android Environment Generating Java Object Code Creating the Android Project Launching and Testing the Application Using Client Object API

Create Android Virtual Device (AVD)

Launch the Android AVD Manager to create the virtual device:

9 - 11

Click New to create the device definition

Continued

Create Android Virtual Device (AVD)


Name user-defined Target must be the same as your applications build target

Must be equal to or greater than the API level that the application compiles against

SD card default is 96 MiB Skin default is HVGA Can add specific Hardware features by clicking New...

9 - 12

Create Android Virtual Device (AVD)

Click Create AVD and confirmation message is displayed:

9 - 13

Install ADT into Unwired WorkSpace


ADT extends Eclipse to provide all Android development capabilities From Unwired WorkSpace, select Help Install New Software Follow the install wizard prompts to locate the ADT zip file Add a name for the Android ADT:

9 - 14

Install ADT into Unwired WorkSpace


Select Developer Tools and click Next to proceed ADT components that will be installed are:

When the ADT installation completes, restart Unwired WorkSpace


Continued

9 - 15

Install ADT into Unwired WorkSpace

After restart, Unwired Workspace will be prompted to install latest version of the Android SDK

Navigate to the SDK that was just installed:

9 - 16

ADT in Unwired WorkSpace

Once installed, the ADT toolbar is displayed in Unwired WorkSpace:

Use these buttons to:


Open the Android SDK Manager Open Android Virtual Device Manager Open a wizard to create a new Android Project Open O a wizard i d to t create t a new Android A d id T Test tP Project j t

9 - 17

Writing an Android Native Application

MODU ULE E TO OPIC CS


9 - 18

Configuring g g the Android Environment Generating Java Object Code Creating the Android Project Launching and Testing the Application Using Client Object API

Extract Deployment File

When a mobile application is deployed in Unwired WorkSpace it creates a jar file that defines the project WorkSpace, deployment parameters

Before code generation can take place for an Android project, project you must extract a file called deployment_unit.xml from a deployed projects project s default_package.jar default package jar file using a utility of some type

Navigate to the JDK directory on your system to use a JAR utility for this task

JAR utility tilit iis llocated t d at: t C:\Sybase\UnwiredPlatform\JDK1.6.0_26\bin

9 - 19

Extract Deployment File

Use this command to extract the deployment_unit.xml file:


jar xf c:\temp\default c:\temp\default_package.jar package jar deployment_unit.xml

This operation Thi ti will ill extract t t th the d deployment_unit.xml l t it l file fil t to th the JDK1.6.0_26\bin directory

Copy the XML file to a temporary location

9 - 20

Generating Java Object Code

Once the deployment unit file is extracted, the code generation batch file can be used to generate backend code for the Android application

Code generation batch file is provided with Sybase Unwired Platform at:

<UnwiredPlatform InstallDir>\MobileSDK\ObjectAPI\Utils\bin <UnwiredPlatform_InstallDir>\MobileSDK\ObjectAPI\Utils\bin

Syntax:
codegen.bat java client android ulj <path> \deployment_unit.xml [-output <output dir>] [-doc] <output_dir>] [ doc]

9 - 21

-output and doc are optional parameters If an output t t directory di t is i not t specified, ifi d output t t is i placed l d in i ...\Utils\bin directory

Writing an Android Native Application

MODU ULE E TO OPIC CS


9 - 22

Configuring g g the Android Environment Generating Java Object Code Creating the Android Project Launching and Testing the Application Using Client Object API

Create an Android Project

From Unwired WorkSpace select File New Project and select Android Android Project:

9 - 23

Continued

Create an Android Project

Follow the Create Android Project wizard to name the project and designate the default project location:

9 - 24

Select Build Target

In the Select Build Target window, click the Android version

Must be Android version 2 2.2 2 or higher

9 - 25

Click Next and the Application summary window is displayed

Complete Project Creation

Enter these values:


Name Project name Package name com sybase sup samples obj com.sybase.sup.samples.obj ectapi Create Activity verify checkbox is selected

Name will be <projectname>Activity An Activity represents a single screen with a user interface

Click Finish to create the project

9 - 26

Project Displayed in ADT

Once the Android Project is created, Eclipse switches to the Android ADT interface with the project displayed in Package Explorer in the left pane:

9 - 27

Add External JAR Files

From Package Explorer, select the Android project


From the Eclipse menu menu, select Project Properties Java Build Path and select the Libraries tab Click the Add External JARS button and browse to this location:

C:\Sybase\UnwiredPlatform\MobileSDK\ObjectAPI\Android

9 - 28

Add External JAR Files

Select all JAR files in this directory:


ClientLib.jar ClientLib jar Sup-client.jar UltraLiteINI12.jar

9 - 29

Add Compiler Resource

Using Windows Explorer, browse to this directory:

C:\Sybase\UnwiredPlatform\MobileSDK\ObjectiveAPI\Android

Copy the armeabi folder Return to Package Explorer and select the project

Right g click and select New Folder to create a new folder Label this folder libs

Paste the armeabi folder into the libs folder

9 - 30

Add User Permissions


Next step is to modify the AndroidManifest.xml file in Package Explorer to add permissions to the project Double-click the AndroidManifest.xml file and click the AndroidManifest xml tab to open the file: AndroidManifest.xml

9 - 31

Modify the AndroidManifest.xml File

Below this line:


<uses-sdk android:minSdkVersion= android:minSdkVersion=8 8 />

Add these lines:


<uses-permission i i android: name android permission INTERNET></uses name=android.permission.INTERNET></uses -permission> <uses-permission android:name=android.permission.READ_PHON E STATE></uses-pemission> E_STATE ></uses pemission>

9 - 32

Add Detail to AndroidManifest.xml File

From Package Explorer, access the AndroidManifest.xml file and add activity information below this line: Add these lines:

</activity>

<activity android:name=.DetailActivity android:label=@string/app @ g/ pp_name> <intent-filter> <action android:name=android.intent.action.MAIN/> / <category android:name=android.intent.category.LAUNCHER/> g y / </intent-filter> </activity>
9 - 33

Save Changes to Manifest File

Save changes to the AndroidManifest.xml file

The project will not save if there are problems in the file

9 - 34

Confirm Application Properties


After saving changes to the AndroidManifest xml file AndroidManifest.xml file, click the Manifest tab Confirm the Package address is the same entered when the project was created, that is:

com.sybase.sup.samples.objectapi b l bj t i

Can optionally enter Version code and Version name on this screen to track application pp versioning g

9 - 35

Copy Generated Object API Code to Project

Using Windows Explorer navigate to Explorer, the location of the codegen bat output codegen.bat directory

In the classroom image, this is: p_code C:\temp

Paste these files to the src folder of the project

9 - 36

Create the User Interface


Use sample code files to create the user interface for the sample project Browse to this directory:

C \S b C:\Sybase Courses\SUP521\Lab C \SUP521\L b R Resources CustomerListAdapter, DetailActivity, AndroidMobileAppActivity

Copy these java files:

In Package Explorer, paste the sample java files to this project directory:

src\com sybase sup samples objectapi src\com.sybase.sup.samples.objectapi

Select to copy over any existing files


Continued

9 - 37

Create the User Interface

Browse to this directory:

C:\Sybase Courses\SUP521\Lab Resources customer.xml, customer xml detail detail.xml xml and main.xml

Copy these xml layout files:

In Package Explorer, Explorer paste these xml file to this project directory:

res\layout

9 - 38

Sa e the project Save

Completed User Interface

Completed project with all copied libraries and code files should appear as:

9 - 39

Writing an Android Native Application

MODU ULE E TO OPIC CS


9 - 40

Configuring g g the Android Environment Generating Java Object Code Creating the Android Project Launching and Testing the Application Using Client Object API

Create the Launch Configuration


From Package Explorer, right click on the Android project and select Run As Run Configuration On the Run Configurations window, click Android Application and click the New button:

New button

9 - 41

Continued

Create the Launch Configuration


In the Android tab, enter the project projects s name Click Browse and select the project:

9 - 42

Continued

Create the Launch Configuration


Select Launch Default Activity Select the Target tab and select the Deployment Target of:

Automatic and AVD

Click Apply and Close

9 - 43

Test the Application


From Package Explorer select Explorer, the project and select Run As Android Application It may take a few minutes for the Android Virtual Devices Device s home screen to appear

9 - 44

Test the Application

Android Project is displayed on the Android emulator:

9 - 45

Launch the Application


Click the project icon to launch the project Customer list from the Customer MBO is displayed on the mobile device:

9 - 46

Modify Data
Double click an entry in the customer list and modify the name Click Submit

Submit button is mapped to the synchronize operation using the AndroidMobileAppDB.beginSy nchronize operation Synchronization y occurs in the background so the mobile user interface is not affected

9 - 47

Confirm Changes

As shown, the change made to the customer name is changed on the mobile device and sent to Unwired Server:

9 - 48

Confiming Communication with Server

View the application activity in the SCC:

9 - 49

Writing an Android Native Application

MODU ULE E TO OPIC CS


9 - 50

Configuring g g the Android Environment Generating Java Object Code Creating the Android Project Launching and Testing the Application Using Client Object API

Application APIs

Manage mobile application:


Registrations Connections Context

Application APIs specifically for Android applications:

getApplicationContext

Returns the Android application pp context that allows access to application-specific resources and classes Sets the Android application context that is required before calling the startConnection, registerApplicaiton or unregisterApplication methods

setApplicationContext pp

9 - 51

Called in a user interface thread, not a background thread

Connection APIs

Contain methods for:


Managing local database information Establishing connection with Unwired Server Authenticating

ConnectionProfile class manages local database information

Set the properties for this class during application initiation and before creating or accessing the local client database

Encryption key can be defined when setting properties

9 - 52

Connection APIs
Database class name is generated as Package Name + DB DB For example:

connectionProfile i fil profile fil = <PkgName>DB.getConnectionProfile( ); Profile.setPageSize( 4*1024 ); Profile.setEncryptionKey (Your key of more than 16 characters);

9 - 53

Synchronization APIs
MBOs can be synchronized based on synchronization parameters for individual MBOs or a group of MBOs Synchronization parametes let an application change the parameters that retrive data from an MBO durin a synchronization session Primary purpose of a synchronization parameter is to partition data

When a value is changed, the call to save automatically propogates the change to Unwired Server

9 - 54

Synchronization APIs

For example, to change a synchronization parameter:

CustomerSynchronizationParameter sp = Customer.getSyhnchronizationParameters ( ); sp.setMyid (10001); sp.save ( );

9 - 55

Personalization APIs
Personalization keys allow an application to define certain input parameter values that are personalized for each mobile user Personalization APIs can be used to manage personalization key and get and set personalization key values Personalization keys include three types: client, server or transient (or session)

Client keys are persisted in the local database Server keys are persisted on the Unwired Server Session keys are not persisted and are lost when the device application pp terminates

9 - 56

Object APIs for Android

API for Android includes these packages:


com.sybase.collections com sybase collections com.sybase.mobile com.sybase.persistence com.sybase.reflection com.sybase.sup.client.persistence

Packages g specific p to Android applications: pp


com.sybase.mobile com.sybase.sup.client.persistence com sybase sup client persistence

9 - 57

com.sybase.mobile Package

Interface:

ApplicationCallback - Callback handler for events to interest to a mobile application

Cl Classes:
Application - Class for management of mobile application registrations, i t ti connections ti and d context t t ApplicationError - Error codes associated with applicaiton and d registration i t ti errors ApplicationSettings - Supports the discovery of settings which have been received form the server after application registration and connection

9 - 58

Continued

com.sybase.mobile Package
ConnectionProperties - Supports the configuration of properties to enable application registrations and connections ConnectionPropertyType - Defines the types of connection property ConnectionStatus - Constants for application connection status DefaultApplicationCallback - Default used for application callback handler DeviceCondition - Status codes associated with device condition changes RegistrationStatus - Constants for application registration status

9 - 59

Continued

com.sybase.mobile Package

Exceptions:
ApplicationRuntimeException - Thrown when a call to startConnection, registerApplication or unregisterApplication cannot be completed due to an error ApplicationTimeoutException - Thrown when a call to startConnection registerApplication or unregisterApplication startConnection, cannot be completed due to a time out ConnectionPropertyException - Thrown when a call to startConnection, registerApplication or unregisterApplication cannot be completed due to:

A problem with a value of one or more connectionProperties or if appplicationIdentifier has not been set

9 - 60

Object API Reference Documentation

Refer to the Sybase Client Object API Javadocs from the Unwired Platform installation:
<UnwiredPlatform_InstallDir>\MobileSDK\ObjectAPI\apidoc Open O th the A Android d id subdirectory bdi t

9 - 61

com.sybase.sup.client.persistence Package

Classes:

AbstractEntity

Abstract base class of all the generated MobileBusinessObject implementation S per class of BigBinary Super BigBinar and BigString

BigData

Exceptions:
StreamNotClosedException StreamNotOpenException WriteAppendOnlyException

9 - 62

Labs

Lab 9-1: Developing an Android Native Application


Task 1: Import a Project into Unwired WorkSpace Task 2: Create an Android Virtual Device Task 3: Install ADT into Unwired WorkSpace Task 4: Generate Java Object API Task 5: Create an Android Project Task 6: Define Application pp Properties p Task 7: Create the User Interface Task 8: Launch and Test the Application

9 - 63

Lab Debriefing
What did you do and why? What went well in the lab? What insights did you get during the lab? What did you observe in the lab? What did you find challenging? Add any items to your troubleshooting list

9 - 64

Module Summary

During the course of this module, you have learned:


Key components of the Android SDK used for mobile application development include the SDK Manager and the AVD Manager How to configure and install the Android ADT into Unwired WorkSpace How to generate Java Object code to be used for Android application development How to create, build and launch an Android mobile application

9 - 65

Module Post-Assessment
1. True/False. AndroidManifest.xml file contains information that tells an Android device how to run an application. application 2. What does an Activity in an Android application represents?
a. Si Single l screen with i h a user interface i f b. Group of screens with a user interface c. Action that occurs in the application

3. True/False. These elements are added to the AndroidManifest.xml file: <uses-permission> and <activity>.

9 - 66

Sybase Unwired Platform 2.1 Mobile Application Development

Module 10: Data Change Notification (DCN) and P h Push


Copyright 2012 Sybase, Inc. All rights reserved. Unpublished rights reserved under U.S. copyright laws. Sybase, and Sybase logo, are trademarks of Sybase Inc., or its subsidiaries. indicates registration in the United States of America. SAP, and the SAP logo, are the trademarks or registered trademarks of SAP AG in Germany and in several other countries. All other trademarks are the property of their respective owners.

Module Pre-Assessment
1. What are the two types of Data Change Notifications? 2 What standards protocols can DCN use to send and 2. receive messages? 3. What is JavaScript Object Notation (JSON)?

10 - 2

Module Objectives

Upon completion of this module, you should be able to:


Describe the benefits and use of Sybase Unwired Platform Platforms s Data Change Notification (DCN) feature Implement Regular Data Change Notification Implement Data Change Notification for mobile workflow applications li ti Understand the differences between Data Change Notification and dD Device i Notifications N tifi ti Use logging to help test DCN enabled mobile applications

10 - 3

Data Change C Notification f Overview O

MODU ULE E TO OPIC CS


10 - 4

DCN Logging, gg g, Sizing g and Monitoring g for Developers p Implementing Regular Data Change Notification Implementing Workflow Data Change Notification Device Notifications - Push

Data Change Notification and Push

Data Change Notification (DCN):


A mechanism that alerts and sends EIS changed data to the CDB associated with an Unwired Server Messages are formatted using JavaScript Object Notation (JSON) Messages M are sent t over an HTTP or HTTPS connection ti

Data change notification (DCN) listener ports are 8000 (HTTP) and 8001 ( HTTPS/secure)

Push:

A mechanism that allows Unwired Server to notify clients of new MBO data rather than waiting for the next MBO synchronization h i ti

10 - 5

Data Change Notification Advantages


Allows you to re-populate only changed data and NOT the entire MBO cache data every time data changes in the backend EIS system Allows MBO cache to be updated in near real-time real time by the EIS rather than on an Unwired Server driven schedule or client initiated synchronization Reduces traffic to/from the Unwired Server Insures consistency between the EIS and the Unwired Server CDB

10 - 6

Change Reconciliation with DCN

Two changes must be reconciled in order to implement DCN from the EIS to the actual device:
Change from the EIS to Unwired Server (CDB) Change Ch from f CDB to t the th client li t database d t b (synchronization) ( h i ti )

10 - 7

Types of DCN

Regular DCN (DCN)

Provides Native Mobile Application DCN C functionality f to replication-based (RBS) and message-based synchronization (MBS) clients Provides DCN functionality to workflow clients by extending t di regular l DCN for f MBS workflow kfl clients li t

Workflow DCN (WF (WF-DCN): DCN):

10 - 8

DNC With or Without Payload

DNC with Payload requires a JavaScript Object Notation (JSON) string (dcn (dcn_request) request) that contains one or more :upsert and :delete operations

Directly updates the Unwired Server cache (CDB), (CDB) with either:

The built-in, direct cache-affecting operations :upsert (update or insert) or With :delete

DNC without Payload instructs the Unwired Server to:


Sync an MBO (read operation) Invoke one or more MBO operations (CUD including alternate read operations)

10 - 9

DCN Backend Configuration


Regular DCN and Workflow DCN must be configured either with or without Payload Both these DCN types can be created via:

Database D b triggers i EIS system events External integration processes such as user exits, Java, etc.

Configurations g of the backend systems y will be required q to support JSON and HTTP(S)

Your backend EIS MUST be able to send HTTP(S) requests to the Unwired Server

10 - 10

Flow: Regular DCN with RBS


Unwired Server Client 7 8 3 6 5 1 D C N 4 2 EIS

Details on next slide

10 - 11

Example Steps: Regular DCN with RBS


1.EIS data associated with a DCN is updated 2 HTTP(S) push the EIS pushes a DCN message with new 2. or changed MBO data contained in the message on the configured HTTP(S) port 3. DCN operation the DCN service receives the message and implements the upsert function into the CDB tables of the corresponding MBOs

DCN upsert p operations p also sets the changed g flag g of an MBO package to true

4. Unwired Server responds p Unwired Server sends a response message back to the EIS that contains the status of each DCN in the submitted message
10 - 12

Continued

Example Steps: Regular DCN with RBS


5. Change detection Unwired Server generates a message for the client indicating that it should synchronize 6. Change notification the message is pushed from Unwired Server to the device 7. RBS synchronization the client receives the message and issues a synchronization request to Unwired Server 8. Synchronization Unwired Server retrieves the new/updated data based on the client synchronization parameter and returns it to the client

10 - 13

Flow: Regular DCN with MBS


Unwired Server EIS Client 6
MBS Sync Scheduler
MBO

MBO MBO

D C N

4 2

Details on next slide

10 - 14

Example Steps: Regular DCN with MBS


1. EIS data associated with a DCN is updated 2 HTTP(S) push the EIS pushes a DCN message with new 2. or changed MBO data contained in the message on the configured HTTP(S) port 3. DCN operation (with payload) the DCN service receives the message and implements the upsert function into the CDB tables of the corresponding MBOs

DCN upsert p operations p also sets the changed g flag g of an MBO package to true

4. Unwired Server responds p by y sending g a response p message g back to the EIS that contains the status of each DCN in the submitted message
10 - 15

Continued

Example Steps: Regular DCN with MBS


5. Synchronization triggered Unwired Server checks the changed flag status for the package when the synchronization group schedule time is reached
If the flag is true, true Unwired Server retrieves a list of all subscribed devices for this package and synchronizes If synchronization logic for a particular device returns new data, an MBS message is generated for that device

6 MBS message iis pushed 6. h d from f Unwired U i dS Server t to th the d device i

When the client receives this message, it performs the corresponding di create, t update, d t or delete d l t operation ti on the th device's mobile database

10 - 16

Flow: DCN with Payload


Unwired Server
MBO

EIS

2 DCN Servlet

MBO MBO

3 1

HTTP

Details on next slide

10 - 17

Example Steps: DCN With Payload


1. Some event initiates the DCN request

Example: a database trigger

2. Unwired Server cache (CDB) could be updated directly from th EIS, the EIS or th the DCN request t could ld originate i i t f from a source other than the EIS

The actual data (payload) is applied to the cache through either an :upsert (:update or :insert) or a :delete operation

3. Unwired Server returns a DCN status message to the requester

10 - 18

Flow: DCN Without Payload


Unwired Server
MBO MBO MBO

EIS 2
EISConnection

DCN Servlet 3 1

HTTP

Details on next slide

10 - 19

Example Steps: DCN Without Payload


1. The DCN requester sends an MBO operation execution request along with operation parameters request, parameters, to Unwired Server 2. Unwired Server executes the operation (effectively calling the EIS operation)

And updates the consolidated database (CDB) if needed, d depending di on th the operation's ti ' cache h update d t policy li

3. Unwired Server returns a DCN status message to the requester

10 - 20

DCN Communicaton

Issue an HTTP(S) call to the DCN port calling a specific servlet to notify Unwired Server:

Default DCN port is port 8000 C ll can either Call ith b be a GET or POST

The response you get from the Unwired Server to your EIS can be ignored or processed The HTTP request can be altered before the processing g of the DCN takes place to utilize existing event notifications

For altering g and filtering g the DCN, , use DCN Filter Java classes

10 - 21

Data Change C Notification f Overview O

MODU ULE E TO OPIC CS


10 - 22

DCN Logging, gg g, Sizing g and Monitoring g for Developers p Implementing Regular Data Change Notification Implementing Workflow Data Change Notification Device Notifications - Push

The DCN Log


Captures data for data change notifications between an enterprise information system (EIS) and an MBO package General logging captures:

Ti Time, User, U Stage, S Package, P k MBO, MBO Thread Th d ID, ID Node N d ID, ID Error E Time, Workflow ID, Application Connection ID, User, Package, Thread ID, Node ID, Operation, Subject, From, To, Body, Error

Workflow logging captures:

Useful for developers p during g development p and test system y application testing

10 - 23

DCN Logging in the SCC

Can view log in the SCC under its respective domain

Server Domains {DomainName} Log General DCN tab:

10 - 24

Enabling/Disabling DCN Logging

Can configure HTTP logging to record request event information logged by DCNs

By default, HTTP logging for DCNs is enabled and prints output to: <UnwiredPlatform_InstallDir>/Servers/ <UnwiredPlatform InstallDir>/Servers/ UnwiredServer/logs/<server.name>-http.log
Open <UnwiredPlatform_InstallDir>/Servers/UnwiredServer/ Repository/Instance/com/sybase/djc/server/ApplicationServer/${you rserver}.properties Delete the enableHttpRequestLog line Save the file Restart Unwired Server

To disable HTTP DCN logging:

10 - 25

.log and .properties File Locations

The <server.name>-http.log is located:

The {yourserver}.properties {yourserver} properties file is located:

10 - 26

{yourserver}.properties Data

Display of the {yourserver}.properties file :

10 - 27

Changing Post Sizing

Default size of an HTTP request is 10 MB

To handle larger data change notifications:


Stop all Sybase Unwired Platform services Open the jetty-web.xml file, located in:

<UnwiredPlatform_InstallDir>\Unwired Platform\Servers

\UnwiredServer\deploy\webapps\dcn\WEB-INF\ Find the property, <Set name="maxFormContentSize" type="int">10000000</Set> and increase the value up to 100MB

Example: <Set name="maxFormContentSize type="int">100000000</Set>

10 - 28

Save the file and restart Sybase Unwired Platform services

DCN History Statistics

Historical information for monitored packages

Detailed data provides specific information on past notification activity for packages

C t Categories i of f information: i f ti
Domain: The domain to which the package affected by the DCN belongs b l Package: The name of the package containing data changes MBO: The name of the MBO to which the notification applied Notification Time: The date and time that Unwired Server received the DCN Processing g Time: The time that Unwired Server used to process the DCN

10 - 29

DCN Performance Monitoring Statistics

Performance monitoring highlights key totals and identifies average minimum, average, minimum and maximum values for primary activities

Calculations are dynamic and based on the data currently available in monitoring database for the specified time period
Description
Thetotalnumberofnotificationssentbytheenterprise informationsystemtoUnwiredServer. TotalNotifications

Keyperformanceindicator

Average/Minimum/Maximum Theaverage,minimum,ormaximumamountoftime ProcessingTime UnwiredServertooktoprocessaDCN. TimeatMinimum/Maximum ThetimeofdayatwhichtheshortestorlongestDCN M Message P Processing i Ti Time processing i event tcompleted. l t d TimeofLastNotification Received MBOwith ith Minimum/Maximum NotificationProcessingTime ThetimeatwhichthemostrecentDCNwasreceivedby UnwiredServer. Th nameof The fthe th package k and dassociated i t dmobile bil business b i object(MBO)withtheshortestorlongestnotification processingtime.

10 - 30

Monitoring Device History

Device Notifications can be captured and monitored as such:


Device Notification Statistics - provide data about the occurrence and frequency of notifications sent from Unwired S Device Notification History Statistics - provide specific information on past device notifications, indicating which packages synchronization groups, packages, groups and devices were involved in synchronization requestserver to replication synchronization devices Device Notification Performance Statistics - provide a general indication of the efficiency of notification processing and the total demand of synchronization requests on the system y

10 - 31

Data Change C Notification f Overview O

MODU ULE E TO OPIC CS


10 - 32

DCN Logging, gg g, Sizing g and Monitoring g for Developers p Implementing Regular Data Change Notification Implementing Workflow Data Change Notification Device Notifications - Push

JSON Digression
JavaScript Object Notation (JSON) is a lightweight, textbased open standard designed for human-readable data interchange Often used for serializing and transmitting structured data over a network connection JSON O Strings can automatically be parsed/marshalled by the eval() JavaScript function into an object

JSON schemas can be used to verify a JSON String There are JSON Parsers available for many languages

10 - 33

DCN URI Template

The following is a template of a Request URI for issuing a DCN:


http://[localhost]:8000/dcn/DCNServlet? cmd=dcn& username=supAdmin& p password=s3pAdmin& p domain=Default& package=DCN_NativeApp:1.0& dcn_request={}& dcn_filter=com.sybase.my.dcn.DcnCustomfilter& ppm=U1VQIGlzIGdyZWF0

10 - 34

POST or GET?
POST and GET HTTP methods are both allowed All request parameters can be in either the URI or POST body Using POST is recommended If you are using HTTP BASIC authentication, the JSON encoded DCN request is always sent as the HTTP POST body Syntax:

http://<hostname>:8000/dcn/HttpAuthDC NServlet

10 - 35

dcn_request

dcn_request parameter contains a two part JSON string:


Package name Message array

Package name in the dcn_request is required for backwards compatibility but may be ignored

The package name in the request URI will be used instead

Example: p
...&package=unwired_server_PackageName &dcn_request={"pkg":"dummy","messages": q { p g y , g [{"id":"1","mbo":"CustomerWithParam","op": ":upsert","cols": {"id":"10001","fname":"Adam"}}]}

10 - 36

dcn_request Messages

Each message includes a set of parameters:

Message id (id):

To be used to track the DCNs sent to the Server Thi value This l will ill be b returned t d in i the th DCN response Name of MBO that should be updated Operation that this DCN should invoke Name value pairs representing the attributes and values of an MBO

Mobile Business Object (mbo)

Operation name (op)

Bindings (col)

10 - 37

:upsert and :delete Operations

:upsert
Used to inject data into the Unwired Server cache (CDB) for a specified MBO Performs in place update or insert to Unwired Server cache

:delete

Special built-in DCN :delete operation

Be careful: this is not the MBOs delete operation

Used to delete data from the Unwired Server cache for a specified MBO Performs in place delete to Unwired Server cache

10 - 38

:upsert

The :upsert operation requires: Pass entire key dcn request={ dcn_request={ attribute(s) of the MBO "pkg":CustomPackage", "messages:[{ in order to locate the "id":"1", "mbo":"Department", correct row "op":":upsert", "cols": Any other MBO { attributes that are to "DepartmentID":999", be used in the upsert "DepartmentName":"MyDepartment, "D "DepartmentHeadID":"501 t tH dID" "501 }}]} All columns l used d iin the operation should use the MBOs MBO s attribute names, not the data source p column/parameter/etc. names

10 - 39

:delete

The built-in :delete operation requires: Pass entire key attribute(s) of the MBO in order to locate the correct row

All columns l used d iin the h operation i should h ld use attribute ib names instead of column names

Example:
dcn_request={"pkg":CustomPackage", "messages":[{"id":"1","mbo":"Department", "op":":delete", "cols":{"DepartmentID":999"}}]}

10 - 40

User-defined Operations

The User-defined MBO operation requires:

Name of the user-defined user defined operation

E.g. createCustomer of type CREATE operation in the Customer MBO

All parameters used in the MBO operation All columns l used d in i th the operation ti should h ld use th the MBO parameter name

All operation ti t types are possible ibl (CREATE (CREATE, UPDATE UPDATE, DELETE, OTHER) See example below...

10 - 41

Multiple Messages in a Single DCN


A single DCN may contain multiple messages, with each message containing a specific operation For each message in the array, you get a result description in the DCN response

To distinguish between message results, must use the message id

See example below...

10 - 42

DCN Response

Unwired Server returns a JSON string containing a status message for each message sent

Use a custom DCN filter to alter the response representation

DCN response has h three th parts: t


recordID the messageID sent success true|false statusMessage g a string g describing g the result. Empty p y if success is true

Example: p
[{"recordID":999","success":true,"statusMe ssage":""}]

10 - 43

Data Change C Notification f Overview O

MODU ULE E TO OPIC CS


10 - 44

DCN Logging, gg g, Sizing g and Monitoring g for Developers p Implementing Regular Data Change Notification Implementing Workflow Data Change Notification Device Notifications - Push

DCN for Workflows (WF-DCN) Overview


WF-DCN is very similar to Regular DCN Sends notifications to devices to keep the mobile workflow and the EIS in sync when a change in the EIS occurs May start server-initiated workflows with a WF-DCN

You must decide whether you will notify server-initiated device users via the Notification Mailbox feature in the SCC or the WF-DCN (cannot implement both for the same device user)

There are two modifications for WF-DCN:


The cmd URI p parameter is now wf instead of dcn The message format has some new parameters

10 - 45

New WF-DCN Parameters

New parameters are added to the message so as to be compliant with the Workflow Email Notification mechanism

Username (to) SUP user name, not the username used to register the device Subject (subject) Subject of the workflow message Originator (from) who the workflow message is from Body of the workflow message (body) it can embed customized information (received) received time of the Mobile Workflow message (read) whether the Mobile Workflow message is read (priority i it ) whether h th th the M Mobile bil W Workflow kfl message h has a hi high h priority i it List of dcn request (data) JSON format string as previously seen in dcn request dcn_request

10 - 46

WF-DCN Without Payload


The cache group policy of MBOs used in the WF-DCN without payload must be online The online MBO contains the findByParameter object query with the same parameters defined in the load operation The query is triggered by the workflow server-initiated starting point after extracting the parameter values from the WF-DCN message body

10 - 47

WF-DCN Without Payload

SAP implementation example:


Sybase Unwired Server
MBO
Workflow Engine

SAP EIS
BAPI BAPI BAPI BAPI Function
HTTP

HTTP

MBO MBO

JCO

SAP Workflow and Inbox

4 Client
WF-DCN

1
10 - 48

WF-DCN Message Without Payload


The message format of the WF-DCN message without payload: Syntax:

{id:,op::,subject:,to:, { id : , op : : , subject : , to : , from:,read:,priority :,body:,data{}} , y , {}}

Example:
{id:999,op::delete,subject:test,t { , p , j , o:test,from:test,read :,priority:,body: MATCH:SUP MWF TaskID:TS97200149 MATCH:SUP_MWF,TaskID:TS97200149, WIID:1470577, USER:PERF0111*#END#*,data{}}

10 - 49

WF-DCN With Payload

SAP example:
Sybase Unwired Server 4 3 2
MBO MBO MBO WF-DCN ABAP Function

SAP EIS
SAP W kfl Workflow and Inbox

HTTP

5 Client

Workflow Engine

1
10 - 50

WF-DCN With Payload

MBO cache group policy

Cache g group pp policy y of MBOs used in WF-DCN with p payload y must be DCN

Message format example:


{id:,op::,subject:,to:,fr om : , read :, priority om:,read:,priority :,body:, data:[{id:,pkg:Package,messages : [{id:2,mbo:MBO,op::upsert, cols: cols : {attribute1:value1,attribute2:value 2,attribute3:value3} }

10 - 51

Email Data and WF-DCN With Payload

The message must contain e-mail information:


Subject To From Etc.

Message must include:


Package g name MBO name Attribute name Attribute value

Th message can iinclude The l d multiple lti l MBO MBOs

10 - 52

WF-DCN With Payload Example


{id:999,op::upsert,subject:PER { , p p , j F0111s Leave Request,to:supAdmin, from:Leave Work Flow,read:false, priority:true, priority :true, body:MATCH:SUP body : MATCH:SUP_MWF, MWF, TaskID:TS97200149, WIID:1470577, USER:PERF0111*#END#*,data:[{id:dcb test pkg:sup mwf:1 2 messages:[{ test,pkg:sup_mwf:1.2,messages:[{ id:2,mbo:Workitem,op::upsert, cols:{WORKITEM:1470577,USERNAME: perf0111,DESCRIPTION:cc,DECISION :test}},{id:6,mbo:Alternatives , op : :upsert , cols :{ WORKITEM : 1470 ,op::upsert,cols:{WORKITEM:1470 577,USERNAME:perf0111,PKEY:01, PVALUE:A p}}]}]}
10 - 53

Processing Messages

After Unwired Server receives the message, a matching workflow server-initiated starting point initiates the following:
Parses the message Extracts E t t data d t fi fields ld f from th the message Sets the extracted data into the parameter of an object query operation ti

Since the MBO uses an online cache policy, the object query is mapped dt to a lload d operation ti

The data is then passed into the load operation as a load parameter to trigger MBO data refresh

10 - 54

WF-DCN Response
A WF-DCN Response is also a JSON string BUT differs from a Regular DCN Response WF-DCN responses include two parts:

The result Th l of f processing i the h Mobile M bil Workflow W kfl request The result of processing the general DCN requests

See example below...

10 - 55

Data Change C Notification f Overview O

MODU ULE E TO OPIC CS


10 - 56

DCN Logging, gg g, Sizing g and Monitoring g for Developers p Implementing Regular Data Change Notification Implementing Workflow Data Change Notification Device Notifications - Push

Push Overview
Push is a mechanism to notify mobile clients of changes made to the cache (CDB) Unwired Server determines when individual clients need to be notified of data changes Current Unwired Server push notification options:

BlackBerry:

HTTP Configured by Sybase Control Center Light Weight Polling (LWP) Apple Push Notification Service (APNS)

Windows Mobile and Windows

iOS

10 - 57

Pushable Applications

Mobile applications are modified to:


Register for Push Notifications on the Unwired Server Implement a Push Listener

S Separate application li i (dbl (dblsn) ) for f Windows Wi d

Built-in API for BlackBerry

Implement logic to react to Push notifications MBS synchronized y applications pp are inherently yp pushable

10 - 58

Labs

Lab 9-1: Implementing Regular DCN With Payload

Task 1: Implement Regular Data Change Notification

Lab 9-2: Implementing WF-DCN for Workflow Mobile A li ti Applications

Task 1: Implement WF-DCN for Workflow Mobile Applications

10 - 59

Lab Debriefing
What did you do and why? What went well in the lab? What insights did you get during the lab? What did you observe in the lab? What did you find challenging? Add any items to your troubleshooting list

10 - 60

Module Summary

During the course of this module, you have learned:


The benefits of DCN The two types of DCN: Regular vs. WF-DCN The difference between a DCN with and without PayLoad How to implement a Regular DCN for Native mobile applications How to use logging and monitoring to test applications How to implement a WF-DCN for mobile workflow applications What options p y you have to implement p device specific p Push notifications

10 - 61

Module Post-Assessment
1. What are the two modifications required to a generic DCN when configuring a WF-DCN? 2. What must the MBO cache group policy be for WF-DCN with payload? 3. What two part JSON string does a dcn_request parameter contain?

10 - 62

Sybase Unwired Platform 2.1 Mobile Application Development

Appendix B: Administration for the Developer

Copyright 2012 Sybase, Inc. All rights reserved. Unpublished rights reserved under U.S. copyright laws. Sybase, and Sybase logo, are trademarks of Sybase Inc., or its subsidiaries. indicates registration in the United States of America. SAP, and the SAP logo, are the trademarks or registered trademarks of SAP AG in Germany and in several other countries. All other trademarks are the property of their respective owners.

Module Pre-Assessment
1. Based on earlier learning, list two reasons for using the Sybase Control Center. Center 2. Is the web-based application (the SCC) the only means of administering the S Sybase base Un Unwired ired Platform? 3. Can multiple servers be viewed/administered from a single SCC?

B-2

Module Objectives

Upon completion of this module, you should be able to:


Navigate the Sybase Control Center Perform Unwired Platform administration tasks as they relate to development and testing of mobile applications Understand more of the architecture and terms related to the S b Sybase Unwired U i d Pl Platform tf

B-3

Review What You Already Know

MODU ULE E TO OPIC CS


B-4

General Administration Security Application Management Troubleshooting Monitoring and Miscellaneous Troubleshooting,

Setting Expectations
Items discussed in this module are meant for a developer that must perform some administrative tasks in order to complete development and testing Installation of a full production environment: e.g. e g Installation and configuration of Relay Servers, setup of clustered environments system health monitoring environments, monitoring, performance tuning techniques, etc. will be covered in the Sybase Unwired Platform Administration course

B-5

Administrative Tasks Already Performed


Enterprise Developer Edition platform installation Setting up of development connection profiles Setting up Device Users via the SCC Administering Mobile Workflow applications in the SCC Statically viewing the Unwired Server log files

B-6

Topics to be Covered

The following are some of the key administration topics that will be covered in this module:
Domain creation User U creation ti Role creation Server-side connection profiles Deployment Dynamic log viewing and configuration Port management and configuration

B-7

Review What You Already Know

MODU ULE E TO OPIC CS


B-8

General Administration Security Application Management Troubleshooting Monitoring and Miscellaneous Troubleshooting,

Sybase Control Center Home Page


Menu bar contains major view ie and areas in the SCC

The toolbar is based on tile views which can be opened or closed via the toolbar icons

Unwired Cluster Nodes


B-9

Most views contain tabs look inside each

SCC Management View Default

By default, the Management View is displayed after login:

B - 10

Display Resource Explorer

Use the SCCs View menu item to display the Resource Explorer

B - 11

Resource Explorer

Displays already discovered and registered resources (servers):

B - 12

Adding to Perspective Resources

Add a server resource to the Perspective Resources view in order to manage it

B - 13

Preparing to Manage a Different Server


In the SCC, select ViewSelectPerspective Resources to display the following dialog Select the resource added in the previous slide

Th go to R Then ResourceAuthenticate A h i ...Resource R Manage: M

B - 14

New Server Management View

Multiple Management Views can now be seen in a single instance of the SCC:

B - 15

Basic Server Management Tasks

Maintenance
Start/Stop/Suspend/Resume server Monitor and manage client licenses

Review Log
Used for troubleshooting and diagnostics Change sub-component log level Server log g files are separate p for each node and client requests q could be spread over multiple logs if multiple servers exist in the cluster

Configure Ports

B - 16

Starting / Stopping Servers

Click the checkbox to the left of the server name to enable the Start/Stop/etc. Start/Stop/etc buttons:

B - 17

Determining License Type of Install

Can also review the number of used and available device licenses:

B - 18

Managing Application Users

Remove unused application users by deleting them

Useful in order to free up the number of device licenses

B - 19

Server Log Text View

The server log file can be dynamically viewed in the SCC:

B - 20

Server Log Grid View

Grid view of the server log may be more reader friendly

Click View Details to get more information about a log entry

B - 21

Server Log - Filtering

Server log filtering is a nice feature since the log files can contain more information than is necessary

Define filter criteria and then click the Retrieve button

B - 22

Server Log - Configuration

These items can be configured for the server log:


Maximum file size Maximum number of log file backups (once the size is reached) The level of detail that is logged by each of the platforms platform s subsub systems

B - 23

Port Numbers
Component
Unwired Server D t b Databases

Ports
CDB: 5200 MS DB: 6262

Configuration File
<install_dir>\Servers\UnwiredServer\Repository\Instance\com\sybase\sup\serv er\SUPServer\sup properties er\SUPServer\sup.properties <install_dir>S\ervers\UnwiredServer\Repository\Instance\com\sybase\sup\serv er\SUPServer\sup.properties and respective listener props files Port 5100 is Messaging Admin Web Service port. Follow manual steps to change to change this port documented in System Admin Guide <install_dir>\Servers\UnwiredServer\Repository\Instance\com\sybase\sup\serv er\SUPServer\sup properties er\SUPServer\sup.properties

IIOP: 2000 Unwired Server Communication Ports HTTP:8000

HTTP:5100 Replication: 2480 (HTTP) Messaging: 5001 HTTP: 80 HTTPS: 443

Unwired Server S h i ti Synchronization Ports Relay Server and Relay Server Outbound Enabler Configuration Sybase Control Center O DS LDAP Server OpenDS S
B - 24

<install install_dir dir>\Servers\UnwiredServer\config\relayserver.properties \Servers\UnwiredServer\config\relayserver.properties

9999, 8282, 8283, 2100, 3638 10389

Various service-config.xml files in SCC_3-0\services folder

<install_dir>\Servers\UnwiredServer\OpenDS\config\config.ldif i t ll di \S \U i dS \O DS\ fi \ fi ldif

Server Management Communication Ports


Management ports can be changed or secured in the General tab Active DCN ports are also visible in this tab

B - 25

Using Secure Protocol

To use a secured port, you must have an SSL security profile

Begin by importing your companys company s digital certificate into the servers keystore Security Profile points to the certificate (alias)

C t a security Create it profile fil or use an existing i ti one

B - 26

RBS Port Management

RBS ports are set in the Replication tab:

B - 27

MBS Port Management

Change the MBS port or add multiple MBS listener (ports) on the Messaging tab:

B - 28

Apple Push Notification Server Setup


Apple push notifications use SMS-based push to alert offline iPhone users of new items awaiting retrieval SMS-based push uses an IP connection only long enough for the Send/Receive data exchange to complete

The feature overcomes network issues with always-on connectivity ti it and db battery tt life lif consumption ti on 3G networks t k

B - 29

Configuring APNS

An APNS certificate that uses Keychain Access in the Mac must be created created, downloaded and specified

MobileWorkflowPushDistCert is a sample that is provided

B - 30

Configuring BlackBerry Enterprise Server


BlackBerry shops must configure the port of the BlackBerry Enterprise Server (BES) Choose a server, click Properties and set the appropriate port:

B - 31

Review What You Already Know

MODU ULE E TO OPIC CS


B - 32

General Administration Security Application Management Troubleshooting Monitoring and Miscellaneous Troubleshooting,

Security Terms

Authentication
The process of determining if someone (or some thing) is is, in fact, who they say they are Usually involves a user id and password, password but could use other means such as digital certificates, smart cards, retina scan, etc. etc

Authorization

The process of Th fd determining t i i if the th person, once authenticated, th ti t d is permitted access to a resource

E Example: l access ( (read, d update, d d delete) l ) to d data

B - 33

Security Configurations

Available when deploying MBOs to the Unwired Server:

B - 34

Security Configuration

Security Configurations are displayed in the Enterprise Explorer in Unwired Workspace:

B - 35

Security Configurations Definition


Before exploring domains, you must understand what a Security Configuration provides A security configuration:

Aggregates various A i security i mechanisms h i f for protecting i Unwired Platform resources Determines the scope of user identity, authentication and authorization checks Includes security providers

B - 36

Security Components

The Security Provider


Responsible for authentication Identifies what kind of security repository is used by the platform

LDAP Server Wi d Windows A Active ti Di Directory t

Roles:
This is the authorization component Roles memberships are consulted when a user tries to access a particular resource

B - 37

Security Configuration Administration

Security configurations:

Can be assigned to one or more domains

Allows a physical user to be authenticated differently if necessary

Are used by both MBS and RBS type applications

The install Th i t ll of f the th Sybase S b Unwired U i d Platform, Pl tf b both th D Developer l Editions, provide a single Security Configuration named admin d i

B - 38

List of Security Configurations

Click the appropriate buttons to create or delete any security configuration:

B - 39

Security Configuration - Authentication


This admin configuration stores users in an LDAP server Multiple providers can be created/assigned:

B - 40

Security Provider Properties

Define connectivity to the underlying user store:

B - 41

Types of Providers Available

Look at the Authentication provider drop-down list to view options for authentication of the platform:

B - 42

Domains
One of the key features of the Sybase Unwired Platform is its multi-tenancy capabilities Domains provide a logical partitioning of a hosting organizations environment Server connections, packages (containing MBOs), role mappings, logs, etc. can be viewed and managed within a domain

Changes are visible only in a specific domain

B - 43

Reasons to Create Domains


Multiple customers/companies can be supported/segregated within the same Unwired Server cluster Security can be configured differently between domains

DomainA D i A could ld use an LDAP server DomainB could use Windows Active Directory

Can create multiple Domain Administrators where each can administer its own portion of the Unwired Server environment

B - 44

Viewing/Creating Domains
default is the domain provided by the installation Click the New button to add a new domain:

B - 45

New Domain Wizard Step 1

Provide a name:

B - 46

New Domain Wizard Step 2

Assign security configuration(s) to the new domain:

B - 47

Administrator Types

Two Administrators Types


Platform Administrator (supAdmin) Domain Administrator (supDomainAdmin) Super user of the platform Domain management, g Server configuration, g Device Registration, g Monitoring, and Package Deployment and Management Has all of the domain administrator rights as domain owner Package deployment and management, server connections, security configuration fi ti and d role l mapping i Access to those domains that platform administrator grants

Platform Administrator has Cluster Cluster-wide wide administration rights


Domain Administrator has rights to perform Domain manager tasks

B - 48

New Domain Wizard Final Step

Choose the domain administrator(s) for the new domain

Setup of users such as supDomainAdmin comes later in this module

B - 49

Enabling a Domain

Click the Enable button when ready to activate the new Domain:

B - 50

Domain Visibility

Once the wizard is completed and the domain is enabled, it will become visible in the Enterprise Explorer in Unwired Workspace:

B - 51

Domains and Deployment

Be careful when deploying MBOs because you now need to select the correct domain for the targeted Unwired Server:

B - 52

Administering OpenDS LDAP Server

For the Development editions of the Sybase Unwired Platform physical users are created in the OpenDS LDAP Platform, server

Installed with Sybase Unwired Platform

The best tool for administering OpenDS is Apache Directory St di Studio The platform does not ship with Apache Directory Studio

Free download available at http://directory.apache.org/studio/

B - 53

Apache DS Connection Profile


Select the Apache DS menu LDAPNew Connection to create a connection profile We learned about port 10389 when we explored the properties of the Security Provider

B - 54

Apache DS Connection Credentials


Choose Simple Authentication Set the Bind DN to cn=Directory Manager Enter the password

Default password is secret

Verify y profile setup by y clicking the Check Authentication button

B - 55

LDAP Server Connected View

The LDAP Browser view of Apache DS will now show the groups and users that have been set up in the OpenDS LDAP server:

B - 56

Starting New User Wizard

Right-click on the users node to begin the new user wizard:

B - 57

Cloning A Users Properties

To simplify a new user creation, clone the LDAP settings of another user, user such as the provided supUser:

B - 58

Providing New User Name

Specify the new user name:

B - 59

Preparing to Set Password

Double-click on the userPassword attribute to display a screen to allow you to set the password:

Double-click here

B - 60

Setting New Users Password


Enter the password for the new user Set Hash Method as Plaintext

B - 61

New User Completed


When completed, a new user will display in the LDAP Browser of Apache DS All applications created in this course can now be run by logging in as this new user

B - 62

Assign New User to Group


Select a group, such as the SUP User group Right-click Right click and select New Value to add a uniqueMember

After specifying the member name, clone values of another member: b

B - 63

SCC

New user is visible in the SCC at the Applications node Application Users

B - 64

Creating New Domain Administrators

To make a new user a domain administrator:


Go to the Security node Select the Domain Administrators tab Click New to create a new domain administrator

B - 65

Roles
Roles are used to grant users authorization to data Roles can be created in either the Unwired Workspace or the SCC To create a role in the Unwired Workspace, right-click on the Roles node of a project and select Role:

B - 66

Role Creation via Unwired Workspace


Roles in the Sybase Unwired Platform are considered logical A role consists only of a name

No specific N ifi rights i ht or privileges are granted in a role No users are assigned i dt to th the role

B - 67

Role Properties MBO Assignment

After creating the role, assign MBOs to the role in the roles properties:

B - 68

Role Properties Operation Assignment

For more granularity, roles can be assigned to MBO operations only - instead of the entire MBO:

B - 69

Mapping Logical to Physical Roles


The task still outstanding is to map a user to a role(s) Recall that when setting up new users via Apache DS, DS the last step was to assign a user to a group The last step of setting up a role is performed in the SCC Package roles are mapped to physical groups within the underlying user store

B - 70

Assigning Group to Role

Group(s) are then added to the chosen role:

B - 71

Review What You Already Know

MODU ULE E TO OPIC CS


B - 72

General Administration Security Application Management Troubleshooting Monitoring and Miscellaneous Troubleshooting,

Package Details
Packages contain MBOs Can drill-down drill down to see the MBOs that are contained in any package If an MBO is expanded, the operations defined will be displayed:

B - 73

General and Connection Information

B - 74

General Package Administration

Investigate the Packages node in the SCC to:


Disable or delete packages Package type is UNIFIED once deployed, can be used by RBS or MBS type device

B - 75

Manual Purge of Cache Group

During testing, it may become necessary to manually purge the data in a cache group

Normally, cached data is invalidated according to the policy settings of the cache group

B - 76

Synchronization Groups

The Change Detection Interval of any synchronization group can be edited:


Select the group Click Cli k the th P Properties ti b button: tt

B - 77

Deployment and Connections

Recall that when you deploy your MBOs to the Unwired Server you were given a chance to select or create a serverServer, side connection profile:

B - 78

Editing Server Connection Profiles


Server-side connection profiles can be created or changed in the SCC To edit a profile, select the profile and click the Properties button:

B - 79

Server Connection Properties

Make port, server name, user or password changes in the Edit Connection Pool dialog:

B - 80

Deployment
Application developers will create the deployment packages but will not be responsible for deploying them to a production environment Deployment is typically the responsibility of the Sybase Unwired Platform Administrator

However, d H developers l may need dt to deploy d l packages k f from th their i local server to a common server for UAT testing

There are a couple of methods available for deploying packages to other Unwired Servers
Export / Import (SCC) Deployment p y Wizard ( (Unwired Workspace p and SCC) )

B - 81

Exporting Packages Using the SCC

To export a package, select the package and click the Export button:

B - 82

Export Process

Choose the level of information to export and the name and location of the resulting *.zip zip file:

B - 83

Importing Packages Using the SCC

To import a package, click the Import button and select the *.zip zip file that contains the package to be imported into the server:

B - 84

Mobile Deployment Package Generation

To use the SCCs Deployment Wizard, Wizard you must first create a JAR file for the package

To do this, you must create a Mobile Deployment Package in the Project

Done in the Unwired Workspace Discussed earlier in the module on MBOs

B - 85

Building a JAR for Deployment


Once the Mobile Deployment package has been created, right-click on the package and select the Build Package option The result will be a JAR file placed in the Deployment folder of your project

B - 86

SCC Deployment Wizard


Go to the SCC Start the Deployment Wizard by clicking the Deploy button on the Packages node:

B - 87

Choose JAR and Deployment Options

Click Browse to locate the *.jar file and specify other deployment options, options such as synchronization and deployment mode:

B - 88

Configure Deployment Properties

Next, configure deployment p y properties by identifying the projects .jar file Deployment file i l d package includes k name and configuration information Deployment p y descriptor file is included in the .jar fie that was created

B - 89

Select Deployment Mode

Update (default)

Updates package with updated objects Prevents a package of the same name on the target server from being g deleted Replaces a package on the server Verifies a package and returns errors if any

Noclobber

Replace

Verify

Does not deploy a package

B - 90

Select Domain

Click next and the Domain and Security configuration window is displayed: p y

Domain choose the domain to which you want to deploy Security configuration specifies the scope of data access and security

Must be created in the cluster and assigned to the domain where the package is deployed Security configuration can be changed after package deployment

B - 91

Select Role Mapping

Role mapping window is displayed:

Role mapping authorizes client request to access MBOs and operations


Maps logical roles defined in Unwired Platform to physical roles that exist in your security provider Role mapping can be assigned to a package after deployment

B - 92

Review Server Connection Information


Server Connection summary screen is displayed: Properties apply to the MBO chosen in the list Properties can be edited by clicking in the Value field of the property If you want the changes made on this screen to also apply to operations, click li k th the checkbox h kb

B - 93

Deployment Summary
Deployment summary window is displayed: You can use the deployment descriptor created by this process to redeploy a project without having to use the wizard by clicking the Create Create a deployment descriptor check box

Click Finish to complete the Package Deployment

B - 94

Review What You Already Know

MODU ULE E TO OPIC CS


B - 95

General Administration Security Application Management Troubleshooting Monitoring and Miscellaneous Troubleshooting,

Viewing Client Logs

To access the client log, select a package and then the Client Log tab

Client logs show the date/time, user, device, MBO, operation and status (Message) that has been performed:

B - 96

MBO History

To view or clean error history:


Select an MBO Click the History tab

B - 97

Operation History

Error history is also available at the operation level


Select an operation Click the History tab View the operation replay time, failed replays, etc.

B - 98

Enabling Domain Logging

Domains allow Unwired Servers to support multi-tenancy


Domain administrators are responsible for only their part of the server (their domain) Therefore, Therefore server logs can be enabled at the domain level To enable a domain-level server log, select the Log node of a d domain i

Click the Settings tab and click the New button to create a d domain i llog:

B - 99

Sample Domain Log

Enter a start and end date and click the Retrieve button to view the log entries for that date range:

B - 100

Filtering the Domain Log

The domain log can be filtered by selecting:


A package (or packages) A particular user (or users) Specific devices

B - 101

Filtering the Domain Log Entries

Use the tabs to filter the entries in the domain log

For example, example click the Errors tab to see only application errors

Select a log entry to see the details

B - 102

Enabling Monitoring

Enable monitoring to help troubleshoot issues


By default, default monitoring is disabled To enable, click the Monitoring node and then the Enable button in the General tab:

B - 103

Replication Monitoring Detail View

Used to display, per package, the device, user and entity

Including start and finish times and possible errors:

B - 104

Package Statistics Monitoring Example

B - 105

Command Line Tool: supadmin.bat


Script: supadmin.bat in %UNWIRED_SERVER%\bin Supports Interactive and Batch mode General Commands:

exit: Exit command line utility help: Get help login: Login to Unwired server logout: Logout from Unwired server

P k Package C Commands: d
delete: Delete package deploy: d l Deploy D l package k export: Export package import: Import package

B - 106

Alternatives to the SCC


Throughout this course, weve made reference to the Sybase Control Center as the administration tool Other options exist for administering the platform

Using U i an SNMP Cli Client application li i to front-end f d the h management functions of the platform Write your own custom client application to administer the Unwired Server

Sybase Unwired Platform includes a collection of libraries in the Management APIs to develop such a client

B - 107

Sybase Control Center Architecture


Node n

Browser
Flash Plugin HTTPS

Sybase Control Center


Web Container
SUP Flex Web Application

RMI Service
SCC Plugin for SUP MBean Inte erface IIOPS

Unwired Server

SNMP Client Custom Admin Java Client

SNMP

SNMP Service
SUPSNMP Plugin

IIOP

RMI

Node 1
B - 108

Why Write Your Own Admin App

In the modules on Workflow and iOS, we explained the need to create device users

A given company might need to add hundreds of device users

Even though E th h the th SCC h has d device i user t templates, l t you may want a more automated approach By using the Java RMI (Remote Method Invocation) protocol, you can write your own custom Java application

B - 109

Administration API Documentation

The documentation includes a guide to the Management API:

B - 110

Example Code to Register Device User

B - 111

Module Summary

During the course of this module, you have learned how to:
Describe the administration architecture and its components Navigate the Sybase Control Center and perform general administration activities Monitor and manage:

Server status Deployed packages Device Users, Groups, Workflows, etc. MBOs Ports

Set up security features Get more information about the platforms Management APIs

B - 112

Module Post-Assessment
There are no post-assessments in this module

B - 113

You might also like