You are on page 1of 56

Sample: Mobile Workflow Employee Directory

Sybase Unwired Platform 2.1

DOCUMENT ID: DC01644-01-0210-01 LAST REVISED: November 2011 Copyright 2011 by Sybase, Inc. All rights reserved. This publication pertains to Sybase software and to any subsequent release until otherwise indicated in new editions or technical notes. Information in this document is subject to change without notice. The software described herein is furnished under a license agreement, and it may be used or copied only in accordance with the terms of that agreement. To order additional documents, U.S. and Canadian customers should call Customer Fulfillment at (800) 685-8225, fax (617) 229-9845. Customers in other countries with a U.S. license agreement may contact Customer Fulfillment via the above fax number. All other international customers should contact their Sybase subsidiary or local distributor. Upgrades are provided only at regularly scheduled software release dates. No part of this publication may be reproduced, transmitted, or translated in any form or by any means, electronic, mechanical, manual, optical, or otherwise, without the prior written permission of Sybase, Inc. Sybase trademarks can be viewed at the Sybase trademarks page at http://www.sybase.com/detail?id=1011207. Sybase and the marks listed are trademarks of Sybase, Inc. indicates registration in the United States of America. SAP and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world. Java and all Java-based marks are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries. Unicode and the Unicode Logo are registered trademarks of Unicode, Inc. All other company and product names mentioned may be trademarks of the respective companies with which they are associated. Use, duplication, or disclosure by the government is subject to the restrictions set forth in subparagraph (c)(1)(ii) of DFARS 52.227-7013 for the DOD and as set forth in FAR 52.227-19(a)-(d) for civilian agencies. Sybase, Inc., One Sybase Drive, Dublin, CA 94568.

Contents
Context Summary ..................................................................1 Usage Scenario ......................................................................3 Get Started .............................................................................5 Prerequisites ...................................................................5 Registering the Application Connection in Sybase Control Center ............................................................6 Importing the Sample .....................................................7 Working with the Sample Project ....................................9 Exploring the Database ..................................................9 Exploring MBOs ............................................................10 Mobile Business Objects .....................................10 The Mobile Application Diagram ..........................11 Exploring the Mobile Workflow Interface Design ..........12 The Mobile Workflow Forms Editor ......................12 Try It Out ...............................................................................15 Deploying the Sample MBOs to Unwired Server ..........15 Installing the Mobile Workflow Package .......................16 Installing the Mobile Workflow Container on the iOS Simulator ..................................................17 Configuring the BlackBerry Simulator for Mobile Workflow Packages .........................................18 Configuring the Android Emulator for Mobile Workflow Packages .........................................19 Installing Sybase Messaging Runtime on Windows Mobile ..............................................20 Generating Code for a Mobile Workflow Package ...........................................................24 Running the Sample on an iOS Simulator ....................26 Running the Sample on a BlackBerry Simulator ...........32 Running the Sample on an Android Emulator ..............34 Running the Sample on a Windows Mobile Emulator ...38

Sample: Mobile Workflow Employee Directory

iii

Contents

Additional Modifications ................................................40 Learn More ...........................................................................47 Related Reference ........................................................47 Project Artifact Reference ....................................47 Troubleshooting Mobile Device Connectivity Issues ..............................................................48 Learn More about Sybase Unwired Platform ................49 Getting Help ..................................................................50 Index ..................................................................................51

iv

Sybase Unwired Platform

Context Summary

Context Summary
Use the Sybase Mobile Workflow Employee Directory sample to explore artifacts and the resulting mobile workflow package, the development environment, and the underlying components. The Employee Directory sample is a mobile workflow. It is a secure mobile application that is accessible from a supported smartphone. From their mobile devices, employees can use the Employee Directory to: Search for an employee by first name, last name, phone number, or department name. Navigate the organizational hierarchy (by manager and direct reports). Create an employee favorites list. Employees can be added or removed from this list. Initiate a phone call, open e-mail messages, or open a Google map of the employees office location. Sign up for notification of new hires or departures.

The Employee Directory sample is based on a development environment that uses: Sybase Unwired Platform Sybase Unwired Workspace, an Eclipse development environment Mobile Workflow device development The iOS, Android, BlackBerry, and Windows Mobile device platforms

Using this sample provides a comprehensive preview of the benefits Unwired Platform can offer. To learn how to create a mobile workflow package, see Tutorial: Mobile Workflow Package Development. Next steps 1. Review the Usage Scenario on page 3, which explores the business context and use case for the sample. 2. Follow the setup process in Get Started on page 5 to install and prepare artifacts in the Eclipse edition of Unwired Platform. 3. Test functionality and features as described in Try It Out on page 15.

Sample: Mobile Workflow Employee Directory

Context Summary

Sybase Unwired Platform

Usage Scenario

Usage Scenario
A company provides its employees with a mobile workflow for their mobile devices that allows them to use the company directory remotely. Business requirements for the company include: Provide access to enterprise data sources by supporting remote access to the employee directory, company employees can quickly communicate with their colleagues and understand with whom they need to interact. Reduced maintenance and more simplicity the mobile workflow package must easily deploy with little or no employee intervention. The employee user base does not want to spend time troubleshooting or self-supporting. Secure transactions the employee (with credentials stored on an LDAP server) must be authenticated, and secure transmission of confidential internal data across the wireless network ensured.

Next: Get Started on page 5 shows you how to set up the sample on your computer.

Sample: Mobile Workflow Employee Directory

Usage Scenario

Sybase Unwired Platform

Get Started

Get Started
You must complete the setup tasks before you can use the Employee Directory sample. 1. Review the Prerequisites on page 5. 2. Bring all artifacts into the Unwired Platform development environment for Eclipse. See Importing the Sample on page 7. 3. Open connections to the servers that this sample depends on. See Working with the Sample Project on page 9. 4. In the sampledb database, explore the existing tables that are the foundation for the mobile workflow package. See Exploring the Database on page 9. 5. Explore the mobile business objects (MBOs) that perform operations against tables in the sampledb database. See Exploring MBOs on page 10. 6. Review the mobile workflow form interface design in the Mobile Workflow Forms Editor. The design of the interface correlates to the MBOs that perform database operations. See Exploring the Mobile Workflow Interface Design on page 12.

Prerequisites
Before you begin importing and setting up the sample, review and complete the prerequisites. See Supported Hardware and Software for the most current version information for mobile device platforms and third-party development environments. This sample was developed and tested using the supported versions. If you use a different version, some steps may vary. Install Unwired Platform. For Windows Mobile, install: Windows Mobile emulator (or have access to an actual device) Windows Mobile SDK Active Sync 4.5 .NET Compact Framework 3.5 For Blackberry, install: BlackBerry JDE, which includes the BlackBerry simulator and MDS. For more information on configuring the BlackBerry Development Environment, see Developer Guide for BlackBerry. For Android, install: SDK Platform Android SDK Platform-tools Android SDK tools

Sample: Mobile Workflow Employee Directory

Get Started For iOS, install: iOS simulator (or have access to an actual device) Xcode and iOS SDK Start the simulator or connect the device. Start Unwired Server: In Windows, select Start > Programs > Sybase > Unwired Platform > Start Unwired Platform Services. Start Sybase Control Center: In Windows, select Start > Programs > Sybase > Sybase Control Center. Log in using the user ID and password you indicated during installation. If you did not change the ID and password, the defaults are: User ID : supAdmin Password: s3pAdmin

Registering the Application Connection in Sybase Control Center


Use Sybase Control Center to register the device. Prerequisites Start Sybase Control Center. Task 1. Log in to Sybase Control Center with the user name and password indicated during installation. 2. In Sybase Control Center, select View > Select > Unwired Server Cluster Management View. 3. In the left pane, select Applications. 4. In the right pane, click Application Connections. 5. Click Register. 6. In the Register Application Connection window, enter the required information: User name enter a user name, such as user1. Server name the DNS name or IP address of the primary Unwired Server, such as "myserver.mycompany.com". If using Relay Server, the server name is the IP address or fully qualified name of the Relay Server host. Port the port used for messaging connections between the device and Unwired Server. If using Relay Server, this is the Relay Server port. Default: 5001

Sybase Unwired Platform

Get Started Farm ID a string associated with the Relay Server farm ID. Can contain only letters A Z (uppercase or lowercase), numbers 0 9, or a combination of both. Default: 0 Activation code length the number of characters in the activation code. If you are reregistering or cloning a device, this value cannot be changed. Activation expiration (hours) the number of hours the activation code is valid. (Optional) Select the check box adjacent to Activation Code to enter the code sent to the user in the activation e-mail. This value can contain letters A Z (uppercase or lowercase), numbers 0 9, or a combination of both. Acceptable range: 1 to 10 characters.

Note: <server_name> should be the actual name of your machine.

Importing the Sample


Import the sample project archived in EmpDir2_0.zip into Sybase Unwired Platform. 1. Start Unwired WorkSpace and choose your workspace by clicking Start > Programs > Sybase > Unwired Platform > Unwired WorkSpace. Ensure that the Mobile Development Perspective is open. 2. Import EmpDir2_1.zip.

Sample: Mobile Workflow Employee Directory

Get Started a) Click File > Import. b) In the Import wizard, select General > Existing Projects into Workspace and click Next. c) Choose Select archive file and browse to the location where you saved EmpDir2_1.zip. d) Click Finish to import the artifacts in the archive as a project. 3. Right-click the EmpDir project and select Open in Diagram Editor. Ensure that the advanced developer profile is selected. 4. Copy the empDirImages folder from the Workspace Navigator to C:\. 5. Start the sample database by executing <UnwiredPlatform_InstallDir>\UnwiredPlatform \Servers\UnwiredServer\bin\sampledb.bat start from the command line. 6. In the Enterprise Explorer, create an ASA connection profile and connect to sampledb by following these steps: a) In Enterprise Explorer, right-click the Database Connections folder and select New. b) In New Connection Profile, select Sybase ASA as the connection profile type, in Name, enter sampledb, and click Next. c) In Drivers, select ASA v 12.x for Unwired Server Default, and configure these connection properties: Property
Host Port Database name User name Password Save password

Value
The default is localhost. 5500 sampledb Use the default, dba. Use the default, sql. Select this option.

When you are finished, click Test Connection. d) Click OK in the Ping Succeeded window. e) Click Finish. A sampledb database connection profile is added. This new profile should resolve any connection profiles errors you received when you imported the EmpDir project. If it does not, ping the server to see whether or not it is available. 7. Copy the empDirImages folder to the appropriate location (for example, c:\). 8. Right-click the empDir.sql file, then select Execute SQL Files.

Sybase Unwired Platform

Get Started Provide values for the database server type, connection profile name, and database name. 9. Right-click the EmpDir project and select Deploy Project. 10. Select Message-based. For more information, see the section called Install and Configure the Mobile Workflow Container On the Device in Developer Guide: Mobile Workflow Packages. 11. Configure the Sybase Settings on the device for the newly created user. 12. In the Sybase Control Center, click Refresh and ensure that the status for the registered user is Online. 13. Right-click EmpDir.xbw and select Generate Mobile Workflow Package. 14. On the device, open Workflow (for iOS) or go to the Inbox (for BlackBerry or Windows Mobile) and choose Workflows, then select the workflow named Empdir.

Working with the Sample Project


Once you have imported the sample and started the EmpDir database server, you can browse artifacts and open required server connections. 1. In WorkSpace Navigator, expand the EmpDir folder to view the project artifacts. Project artifacts are contained in the Mobile Business Objects and Deployment folders. 2. Connect to the Unwired Server: a) In Enterprise Explorer, expand the Unwired Server folder. b) Right-click the My Unwired Server icon and choose Connect. When you connect to the server, a complete set of administrable elements appear below the server icon.

Exploring the Database


If you have started and connected to the database, you can now explore its structure and design. The tables have been explicitly designed for this sample. By understanding the structure of the database, you can better understand how the business logic programmed into the mobile workflow works with the database. 1. In Enterprise Explorer, expand Database Connections > sampledb > sampledb. 2. To browse the tables used by the mobile application, expand Tables. Expand each table of interest, such as Emps or EmpFavorites, to review the table design for each (columns, keys, constraints, and so on).

Sample: Mobile Workflow Employee Directory

Get Started

Exploring MBOs
Review the existing attributes and operations for mobile business objects, and explore how MBOs are bound to the EmpDir table as their back-end data source. 1. In WorkSpace Navigator, expand the EmpDir > Mobile Business Objects folder to view the MBOs created for this sample (EmpFavorites, Emps, and ListEmpFavorites). EmpFavorites and Emps match two of the table names in sampledb. 2. To see the MBOs and understand the business logic behind them, right-click any MBO and select Open in Diagram Editor.

Mobile Business Objects


Mobile business objects form the business logic for mobile applications and workflows. A mobile business object (MBO) is derived from a data source (database server, Web Service, SAP server, and so on). MBOs form the business logic for mobile workflows that can be deployed to an Unwired Server and referenced in mobile devices (clients). MBOs include: Implementation-level details read-only metadata columns that include information about the data in the implementation. Abstract-level details attributes correspond to class-level properties on the mobile client and map to columns. Parameters correspond to synchronization parameters on the mobile client and map to arguments. MBOs can also contain operations, which themselves contain parameters and arguments, and can be used to update, create, or delete data. For native applications a database runs on the mobile device. When users makes changes, those changes only apply to their local copy of the data. When a sync happens, the changes are sent to the Sybase Unwired Platform server and changes in the actual enterprise database are sent to the mobile device. With Mobile Workflow, even though the user exchanges data with the server, there is no client-side store that is synchronized with the server's consolidated database. Relationships defined between MBOs, link attributes, and parameters in one MBO to attributes and parameters in another MBO.

You can define MBOs using either a top-down approach designing attributes and parameters first, and later binding them to a data source, or a bottom-up approach specifying a data source, and automatically generating attributes and parameters from it. A mobile application includes MBOs, as well as role and server mappings, and other artifacts that are delivered to the Unwired Server during deployment.

10

Sybase Unwired Platform

Get Started

The Mobile Application Diagram


Each mobile application project has an associated Mobile Application Diagram that provides a graphical representation of all mobile business objects (MBOs) within the project. The Mobile Application Diagram is not only a static graphical representation of MBOs. You can copy and paste existing objects, create a new object, or even define data sources for MBOs that are not yet bound to an enterprise data source. However, the application diagram used in this sample is complete as provided. For a larger project, you might want to create a filter to view only selected MBOs either by explicitly selecting the MBOs, or by creating a logical group. To explore this functionality, open the Unwired Platform online documentation and click Sybase Unwired WorkSpace Mobile Business Object Development > Develop > Working with Mobile Business Objects > Mobile Business Object General Properties > Managing Mobile Application Diagram Filters and Logical Groups.

What the Mobile Application Diagram Shows The diagram shows the different objects and how they are related to each other : Emps MBO represents employee information. EmpFavorites MBO represents a list of commonly contacted employees. ListEmpFavorites MBO represents a listing of an employee's favorites.

Sample: Mobile Workflow Employee Directory

11

Get Started

Exploring the Mobile Workflow Interface Design


Use the Mobile Workflow Forms Editor to explore the mobile workflow package. Business logic is not stored in the mobile workflow package. Instead, the mobile workflow package relies on the MBOs that are deployed to the Unwired Server to provide the business logic. The separation of the workflow interface from the processing and logic components keeps the workflow compact and makes more efficient use of the client devices battery. 1. In WorkSpace Navigator, double-click empDir.xbw. 2. Click the Flow Design tab to explore the flow of all existing screens. You can also see each individual screen by selecting it, then clicking the Screen Design tab.

The Mobile Workflow Forms Editor


The Mobile Workflow Forms Editor consists of views and pages that allow you to model the interface of the device screens. The Mobile Workflow Forms Editor has drag-and-drop functionality, which allows you to drag and drop mobile business objects onto the Flow Design page. You can also drag and drop mobile business object operations onto the Flow Design page. The Mobile Workflow Forms Editor contains three pages: Introduction Creating a new custom device workflow, or double-clicking an existing one, opens the Introduction section of the Mobile Workflow Forms Editor. This page is the starting point for designing your custom device mobile workflow. You can access help and launch tutorials from this page. Flow Design Use this page to specify the manner in which screens link together. You can then link specific screens and actions to a mobile business object on a server. The Palette view shows available screens and connections. The Flow Design page displays an empty canvas with the Palette to the right, which shows the available screens and connections. You can drag and drop items from the Palette to the canvas. Screens that you drag to the Flow Design canvas are displayed as icons and show the connection lines between them. Dragging a new screen into this page starts a new screen. Double-clicking a screen opens the Screen Design page. Right-clicking anywhere in the Flow Design page displays a context menu. Screen Design Use this page to design the screen of your custom device mobile workflow. The Palette view shows the menu and controls you can use to design a new screen. Drag controls to design the user interface on the device screen.

12

Sybase Unwired Platform

Get Started The Device Workflow toolbar includes a list of existing screens. You can open a different screen by selecting the corresponding screen name from the list.

Sample: Mobile Workflow Employee Directory

13

Get Started

14

Sybase Unwired Platform

Try It Out

Try It Out
Deploy the sample MBOs, register device users, and run the sample on a device simulator. Now that you have set up your sample project and understand the MBOs that are used, you can deploy those MBOs to Sybase Unwired Server and run the sample on a device simulator. You can install a device simulator, then run the mobile workflow application on it. In the sections that follow you will be able to see basic usage of the Workflow application. In addition, you will learn how to apply optional modifications to the sample, including the look and feel on the device, the device cache, adding a confirmation dialog, and debugging.

Deploying the Sample MBOs to Unwired Server


Deploy the sample to the Unwired Server to make the MBO logic available to the user interface (empDir.xbw). Prerequisites Ensure you are connected to an Unwired Server. Task There are multiple techniques you can use to deploy the mobile application. This sample documents how to deploy the sample from the project. For information on the other options, open the Unwired Platform online help and click Sybase Unwired WorkSpace - Mobile Business Object Development > Develop > Packaging and Deploying Mobile Business Objects. Note: Skip this section if you have already implemented the steps in Get Started > Setting Up the Sample. 1. Right-click the EmpDir project and select Deploy Project. Accept the defaults for the deploy mode, target version, and package name. 2. Select Message-based, and click Next.

Sample: Mobile Workflow Employee Directory

15

Try It Out

3. Select all boxes to deploy all MBOs and click Next. 4. (Optional) In the Packager User-defined Classes window, click Next. This window is only seen if you are using the Advanced Developer Profile. 5. Select My Unwired Server and click Connect. 6. Accept the defaults for Domain and Security configuration, and click Next. 7. If you are using the Advanced profile, map the connection profile for sampledb to the Server connection profile of the same name. a) From Server Connection, select New Server Connection. b) Accept the defaults and click OK. This mapping process creates a named endpoint to the correct server that gives you access to the systems you require. 8. Click Finish to deploy the package to the Unwired Server.

Installing the Mobile Workflow Package


Configure the emulator or simulator, install the Mobile Workflow package, and generate the Mobile Workflow package files.

16

Sybase Unwired Platform

Try It Out

Installing the Mobile Workflow Container on the iOS Simulator


The Workflow Container referenced in this procedure is a sample container. You can use the provided source code in Xcode to build your own customized user interface and configure other resources. Prerequisites Register the application connection in Sybase Control Center See Supported Hardware and Software for the supported Xcode and SDK versions.

Task 1. From your Mac, connect to the Microsoft Windows machine where Sybase Unwired Platform is installed: a) From the Apple menu, select Go > Connect to Server. b) Enter the name or IP address of the machine, for example, smb://<machine DNS name> or smb://<IP Address>. You see the shared directory. 2. Copy the MobileWorkflow-2.1.tar.gz from your Sybase Unwired Platform installation <UnwiredPlatform_InstallDir>\UnwiredPlatform \ClientAPI\Workflow\ios to a location on your Mac: 3. Unarchive the MobileWorkflow-2.1.tar.gz. This creates a Workflow folder. 4. In the Workflow folder, double-click WorkFlow.xcodeproj so that it opens in the XCode IDE. 5. If necessary, add these frameworks from the SDK to the project by selecting Project > Edit Active Target > <ProjectName> > General: Security.framework AddressBook.framework QuartzCore.framework CoreFoundation.framework libicucore.A.dylib libz.1.2.3.dylib libstdc++.dylib 6. In XCode, select Build > Build. The project builds and the simulator starts. Configuring iOS Connection Settings Configure the settings for the Mobile Workflow application.

Sample: Mobile Workflow Employee Directory

17

Try It Out 1. Go to the device Settings screen and click WorkFlows. 2. Enter the settings for the Mobile Workflow application: Server Name the machine that hosts the server where the mobile application project is deployed. Server Port Unwired Server port number. The default is 5001. Company\Farm ID the company or farm ID you entered when you registered the device in Sybase Control Center, in this case, 0 (zero). User Name the user you registered in Sybase Control Center. Activation Code the activation code for the user, for example, 123. Password enter your password so that the Workflow container registers using the automatic registration option. Note: The Activation Code and Enable Automatic Registration options are mutually exclusive. If you use a password for automatic registration, you cannot enter an activation code and vice versa. URL Suffix (Optional) the URL suffix used to connect to a Relay Server.

Configuring the BlackBerry Simulator for Mobile Workflow Packages


Copy the .cod files to the BlackBerry simulator directory. 1. Navigate to <UnwiredPlatform_InstallDir>\UnwiredPlatform \ClientAPI\Workflow\BB. 2. Copy the required .cod files to the BlackBerry simulator directory. These include: CommonClientLib.cod shared code that can be used by native Sybase Unwired Platform BlackBerry applications. Workflow.cod the main Mobile Workflow application. MessagingClientLib.cod where the user enters the server connection information. MocaClientLib.cod messaging library.

3. Start the MDS server by clicking Start > Research in Motion > BlackBerry JDE 6.0.0 > MDS-CS. 4. Start the BlackBerry simulator. Configuring BlackBerry Connection Settings Configure the connection settings for the Mobile Workflow application. 1. Click the Workflow icon on the applications screen, then press the Menu key and select Settings. 2. Enter the settings for the Mobile Workflow application: Server Name the machine that hosts the server where the mobile application project is deployed. Server Port Unwired Server port number. The default is 5001.

18

Sybase Unwired Platform

Try It Out Company\Farm ID the company or farm ID you entered when you registered the device in Sybase Control Center, in this case, 0 (zero). User Name the user you registered in Sybase Control Center. Activation Code the activation code for the user, for example, 123. Enable Automatic Registration when you select this option, the Registration Password field is enabled. Enter your password. Note: The Activation Code and Enable Automatic Registration options are mutually exclusive. If you use a password for automatic registration, you cannot enter an activation code and vice versa. URL Suffix (Optional) the URL suffix used to connect to a Relay Server.

Select Menu > Save to save the settings. 3. Start the Mobile Workflow application, then view the settings log to verify that the connection is active. In Workflows, select Settings. On the Connection settings screen, select Show Log.

Configuring the Android Emulator for Mobile Workflow Packages


Configure the Android emulator. Prerequisites Install the Android SDK and run the SDK Manager to install SDK Platform, Android SDK Platform tools, and Android SDK Tools. See Supported Hardware and Software for the most current version information. Task 1. Run the Android SDK Manager and select Virtual devices. 2. Click New, provide a name, and select the target version. 3. In the Android emulator, start the newly created virtual device. 4. (Optional) Select Wipe User Data. 5. Run platform-tools\adb and install SybaseDataProvider.apk and Workflow.apk, which are located in \UnwiredPlatform\ClientAPI \Workflow\Android. If you encounter an error indicating the device is offline, repeat these commands to ensure the files are properly installed. If you selected Wipe User Data, reinstall the apk files if they were previously installed, delete the device user previously created in SCC, and recreate the device user in SCC. The Sybase Mobile Workflow application should now appear in the emulator.

Sample: Mobile Workflow Employee Directory

19

Try It Out

Configuring Android Connection Settings Configure the connection settings for the Mobile Workflow application. 1. Click the Workflows icon on the applications screen, then select Settings. 2. Enter the settings for the Mobile Workflow application: Server Name the machine that hosts the server where the mobile application project is deployed. Server Port Unwired Server port number. The default is 5001. Company\Farm ID the company or farm ID you entered when you registered the device in Sybase Control Center, in this case, 0 (zero). User Name the user you registered in Sybase Control Center. Activation Code the activation code for the user, for example, 123. Enable Automatic Registration when you select this option, the Registration Password field is enabled. Enter your password. Note: The Activation Code and Enable Automatic Registration options are mutually exclusive. If you use a password for automatic registration, you cannot enter an activation code and vice versa. URL Suffix (Optional) the URL suffix used to connect to a Relay Server.

Select Save to save the settings. 3. Start the Mobile Workflow application, then view the settings log to verify that the connection is active. From the Mobile Workflow application, tap Settings > Show Log.

Installing Sybase Messaging Runtime on Windows Mobile


Start the Device Emulator Manager and your synchronization software, cradle the device, and install Sybase Messaging Runtime. Prerequisites The Sybase Messaging runtime client requires that you have Microsoft .NET Compact Framework 3.5 Redistributable installed. The synchronization software must be running, and the device must be connected and cradled.

Task 1. Start the Device Emulator Manager by navigating to C:\Program Files \Microsoft Device Emulator\1.0 and double-clicking dvcemumanager. 2. From the list of devices, right-click the device you want to use, and select Connect. 3. Right-click on the device again and select Cradle.

20

Sybase Unwired Platform

Try It Out The synchronization software appears. 4. Go to <UnwiredPlatform_InstallDir>\UnwiredPlatform\ClientAPI \Workflow\WM and copy the SUPMessaging_Pro.cab file to a folder on your mobile device, for example:

5. Use File Explorer on the device emulator to browse to the SUPMessaging_Pro.cab file. 6. Click on SUPMessaging_Pro.cab once to start the installation. Installing Microsoft Synchronization Software Install and configure Microsoft synchronization software so you can deploy and run a mobile application on a Windows Mobile emulator. Note: Microsoft ActiveSync is for Windows XP. If you are using Windows Vista, Windows 7, or Windows 2008, install Virtual PC 2007 SP1 and Windows Mobile Device Center to manage synchronization settings. Download the Windows Mobile Device Center from http://

www.microsoft.com/windowsmobile/en-us/downloads/microsoft/device-centerdownload.mspx.
1. Download Microsoft ActiveSync from http://www.microsoft.com/windowsmobile/enus/help/synchronize/device-synch.mspx. Save it to your local machine. Windows XP requires ActiveSync version 4.5. 2. In Windows Explorer, double-click setup.msi. 3. When installation is complete, restart your machine. ActiveSync starts automatically, and its icon appears in the Windows toolbar. 4. Double-click the ActiveSync icon. 5. Select File > Connection Settings. 6. Select Allow Connections to One of the Following, then select DMA. 7. Under This Computer is Connected to, select Work Network.

Sample: Mobile Workflow Employee Directory

21

Try It Out

8. Click OK. Configuring Windows Mobile Connection Settings Configure the connection settings. Prerequisites Install the Sybase messaging runtime client. Task 1. Select Start > Programs > Sybase Settings. 2. In the Sybase Settings screen, click Connection. 3. In the Connection screen, enter the connection settings: Server Name the machine that hosts the server where the mobile application project is deployed. Server Port Unwired Server port number. The default is 5001. Company\Farm ID the company or farm ID you entered when you registered the device in Sybase Control Center, in this case, 0 (zero). User Name the user you registered in Sybase Control Center. Activation Code the activation code for the user, for example, 123. Enable Automatic Registration when you select this option, the Registration Password field is enabled. Enter your password. Note: The Activation Code and Enable Automatic Registration options are mutually exclusive. If you use a password for automatic registration, you cannot enter an activation code and vice versa.

22

Sybase Unwired Platform

Try It Out URL Suffix (Optional) the URL suffix used to connect to a Relay Server.

Note: The URL Suffix setting is in Advanced settings.

Note: "localhost" is name of your machine. 4. Click Done.

Sample: Mobile Workflow Employee Directory

23

Try It Out 5. Start the Mobile Workflow application, then view the settings log to verify that the connection is active. Select tap Start > Programs > Sybase Settings > Menu > Show Log

Generating Code for a Mobile Workflow Package


Generate the files for the Mobile Workflow package and deploy them to the Unwired Server. Prerequisites Complete these tasks: The device must be registered in Sybase Control Center. If Microsoft ActiveSync is not running, start it now. (Windows XP) If Windows Mobile Device Center is not running, start it now. (Windows Vista, Windows 7, Windows 2008)

Task 1. In the Mobile Workflow Application Designer, click . 2. In the New Mobile Workflow Package Generation wizard, select: Option
Favorite configurations Generate Unwired Server Profile

Description
(Optional) Select a configuration. Select Generate into the project. Select My Unwired Server as the profile with which to associate the mobile workflow package. Deploy the mobile workflow package to an Unwired Server, and in Deploy Mode, select New. Select this option, and click Get Users. Select a user, for example, user1.

Deploy to an Unwired Server

Assign workflow to users

24

Sybase Unwired Platform

Try It Out

3. In the Mobile Workflow Package Generation wizard, click Finish. The files for the mobile workflow package are generated and stored in the specified location as a .zip file. The mobile workflow package appears in Enterprise Explorer in the Workflows folder under Unwired Server.

Sample: Mobile Workflow Employee Directory

25

Try It Out

Running the Sample on an iOS Simulator


Run the Workflow application to try out the Employee Directory sample on your iOS simulator. 1. Launch the iOS simulator. You can see the Sybase mobile workflow client application.

2. Launch the Workflow application, then set a password.

26

Sybase Unwired Platform

Try It Out

The workflows are listed, and server notifications appear as e-mail messages in the Messages section. 3. Select the empDir application.

The Credential screen appears once.

Sample: Mobile Workflow Employee Directory

27

Try It Out

4. Provide the user ID and password.

Your credentials are cached by the mobile workflow and are not requested again. 5. Search the employee directory in a variety of ways. Use the % symbol to represent wildcards.

28

Sybase Unwired Platform

Try It Out

The following are example search results for employees whose names begin with Jo.

6. Select one of the results to display Employee Details.

Sample: Mobile Workflow Employee Directory

29

Try It Out

7. In the Employee Details screen, do any of the following: View attachments such as images using the attachment viewer. Navigate through the company hierarchy by selecting the Manager or Direct Reports. 8. Add a commonly contacted employee to a favorites list, and request the list from the Search screen. Go to the Options screen, which allows you to enable or disable notifications.

9. Create a notification e-mail message when an employee is hired or terminated. The e-mail message is sent to those employees who registered for notifications. This functionality requires additional setup and configuration of an e-mail server. The insert

30

Sybase Unwired Platform

Try It Out and delete triggers provided in EmpDir.sql are provided as examples. To simulate this process, use the Send a Notification wizard.

10. Provide the information to send to the device.

An e-mail notification now appears on the device.

Sample: Mobile Workflow Employee Directory

31

Try It Out

Running the Sample on a BlackBerry Simulator


Run the Workflow application to try out the Employee Directory sample on your BlackBerry simulator. 1. Launch the BlackBerry simulator. In the Messages section, the workflows are listed, and server notifications appear as e-mail messages.

2. Select Workflows. 3. Select the empDir application. A help screen appears, followed by a credentials screen. 4. Provide the user ID and password. Your credentials are cached by the mobile workflow and are not requested again. 5. Search the employee directory in a variety of ways. Use the % symbol to represent wildcards. 6. In the Employee Details screen, do any of the following: View attachments such as images using the attachment viewer. Navigate through the company hierarchy by selecting the Manager or Direct Reports. 7. Add a commonly contacted employee to a favorites list, and request the list from the Search screen.

32

Sybase Unwired Platform

Try It Out Go to the Options screen, which allows you to enable or disable notifications. 8. Create a notification e-mail message when an employee is hired or terminated. The e-mail message is sent to those employees who registered for notifications. This functionality requires additional setup and configuration of an e-mail server. The insert and delete triggers provided in EmpDir.sql are provided as examples. To simulate this process, use the Send a Notification wizard.

9. Provide the information to send to the device.

Sample: Mobile Workflow Employee Directory

33

Try It Out

Running the Sample on an Android Emulator


Run the Workflow application to try out the Employee Directory sample on your Android emulator. 1. Launch the Android emulator.

2. Launch the Workflow application, and enter your password.

34

Sybase Unwired Platform

Try It Out

The workflows are listed in the next screen, and server notifications appear under the Sybase Workflows screen.

3. Select the empDir application. 4. Enter your user ID and password. Your credentials are cached by the mobile workflow and are not requested again.

You can search the employee directory in a variety of ways. Use the % symbol to represent wildcards:

5. Search the results for employees whose names begin with Jo.

6. Select one of the results to display Employee Details. Attachments such as images are displayed using the attachment viewer.

Sample: Mobile Workflow Employee Directory

35

Try It Out

7. Navigate through the company hierarchy by selecting the Manager or Direct Reports buttons. 8. From the Search screen navigate to the Options screen, which allows you to enable or disable notifications.

9. Simulate a notification e-mail message. When an employee is hired or terminated, an e-mail message is sent to those employees who registered for notifications. This requires additional setup and configuration of an email server. The insert and delete triggers provided in EmpDir.sql are provided as examples. To simulate this process, use the Send a Notification wizard.

36

Sybase Unwired Platform

Try It Out

The information you provide in the Send Notification to a Device User dialog is sent to the device:

A notification now appears on the device:

Sample: Mobile Workflow Employee Directory

37

Try It Out

Running the Sample on a Windows Mobile Emulator


Run the Workflow application to try out the Employee Directory sample on your Windows Mobile emulator. 1. Launch the Windows Mobile emulator. In Outlook E-mail the workflows are listed, and server notifications appear as e-mail messages.

2. Select Workflows. 3. Select the empDir application. A help screen appears, followed by a credentials screen. 4. Provide the user ID and password. Your credentials are cached by the mobile workflow and are not requested again. 5. Search the employee directory in a variety of ways. Use the % symbol to represent wildcards. The following are example search results for employees whose names begin with Jo.

38

Sybase Unwired Platform

Try It Out

6. Select one of the results to display Employee Details. 7. In the Employee Details screen, do any of the following: View attachments such as images using the attachment viewer. Navigate through the company hierarchy by selecting the Manager or Direct Reports. 8. Add a commonly contacted employee to a favorites list, and request the list from the Search screen. Go to the Options screen, which allows you to enable or disable notifications. 9. Create a notification e-mail message when an employee is hired or terminated. The e-mail message is sent to those employees who registered for notifications. This functionality requires additional setup and configuration of an e-mail server. The insert and delete triggers provided in EmpDir.sql are provided as examples. To simulate this process, use the Send a Notification wizard.

10. Provide the information to send to the device.

Sample: Mobile Workflow Employee Directory

39

Try It Out

Additional Modifications
Apply additional modifications to the sample, including the look and feel on the device, the device cache, adding a confirmation dialog, and debugging. Basic Look and Feel When you develop a workflow, it is recommended that you begin with a basic look and feel. This will enable you to generate a smaller workflow package that you can deploy, start, and debug easily. To use a basic look and feel, select Window > Preferences > Sybase, Inc > Mobile Development > Mobile Workflow Forms Editor:

40

Sybase Unwired Platform

Try It Out

When you generate the .zip file that is deployed to the device, all the contents under the html folder are included in that .zip file. When you use the basic look and feel, delete the previously generated contents if the sophisticated look and feel was previously selected. Customized Look and Feel You can further customize the look and feel by modifying the Custom.js file. For example, you could add a gradient background and footer by replacing the customBeforeWorkflowLoad and customAfterNavigateForward functions with the contents of the Customization\gradientAndFooter.txt file included in the EmpDir project. Then create an images folder under the generated html folder and copy EmpDirImages\gradient2.png into that folder. Ensure the look and feel setting is set to Basic for this example. Run the Package Generate wizard to redeploy the mobile workflow. Note that this change does not apply to iOS, since that platform already uses buttons instead of native menus.

If you prefer to replace menu items with buttons instead of adding a gradient background and footer, replace the contents of these same functions with the contents in Customization \menusToButtons.txt.

Sample: Mobile Workflow Employee Directory

41

Try It Out To make changes to the sophisticated look and feel, modify the html\css\jquery \jquery.mobile-1.0a3.css file. For example, you could modify the color-stop values in the following code:

For example, suppose you would like to modify this entry:


.ui-body-a { background-image: -webkit-gradient(linear,left top,left bottom, color-stop(0, #666666), color-stop(0, #FFFFFF));

To use a color-stop value of #B2CFDA and white, modify


color: #FFF;

with
color: black

Add a Confirmation Dialog To add a confirmation dialog, replace the contents of the customBeforeSubmit function in Custom.js with the contents in Customization\beforeSubmit.txt included in the EmpDir project, and run the Package Generation wizard to redeploy the mobile workflow:

42

Sybase Unwired Platform

Try It Out

Add Clickable Links You can add custom code to replace the location, phone number, and e-mail text fields with clickable links to open Google Maps, dial the phone, and open e-mail messages. In addition, you can replace the attachment viewer link with an img tag so the employee's image can be shown without navigating to another screen. To make these changes, replace the contents of the customBeforeShowScreen function in Custom.js with the contents in Customization\beforeShowScreen.txt included in the EmpDir project:

Improve Searches To improve your searches, set the On-device cache timeout property. For example, select the By First Name menu item on the Search page and enter a value of 240, which is equivalent to 4 minutes. This will result in faster results in subsequent searches, and the results will be available even when the device is not connected to the network if you invoke the search within 4 minutes of the previous search.

Sample: Mobile Workflow Employee Directory

43

Try It Out

Use a Debugger At times it is useful to be able to step through the customized code with a debugger. The simplest way to do this is to drag and drop the generated html file, such as workflow.html, onto a browser such as Chrome and press <Ctrl>-<Shift>-J to display the Java Script Console. Add a parameter to the URL to indicate the screen to be displayed. For example, add ?screenToShow=Search. To simulate the workflow message that would be passed into the workflow as a result of a menu action or a server notification, we can execute the menu action on a mobile device or simulator and then copy the workflow message that was sent to the device.

44

Sybase Unwired Platform

Try It Out 1. Modify the TraceConfig.xml file located at C:\Sybase\UnwiredPlatform \Servers\MessagingServer\Data\TraceConfig.xml and ensure that the WorkflowClient is set to debug:
<Module Name = "WorkflowClient" "WorkflowClient"/> Level = "Debug" Desc =

2. Restart the Sybase Messaging Service by running the following commands from a command prompt:
net stop Sybase Messaging Service net start Sybase Messaging Service

3. On the device, perform a search to return the favorite items. In the folder C:\Sybase\UnwiredPlatform\Servers\UnwiredServer \logs\WorkflowClient locate a .txt file that contains the device user name in it. Within that file, copy the returned message and paste it into a file named rmi.xml in the html folder. The message should appear as follows:
<XmlWidgetMessage> <Header></Header> <WidgetScreen>Favorites</WidgetScreen> <RequestAction>Favorites</RequestAction> <Values> <Value key="ListEmpFavorites" type="LIST"> <Values key="100010" state=""> </XmlWidgetMessage>

4. Copy the generated html folder to a Web server, such as the htdocs folder on Apache. 5. Open a desktop browser such as Chrome to the appropriate URL such as http:// servername/EmpDir_Sol/EmpDir/html/workflow.html? screenToShow=Search. 6. Click on Favorites to view the data, which is derived from the rmi.xml file that contains the workflow message with the data from a previous query. 7. Click on a favorites item to see the details screen. a. Press <Ctrl>-<Shift>-J to display the Java Script Console. b. Click the Scripts tab and select Custom.js. Now you can add a breakpoint, for example, in the customBeforeSubmit function. To use that breakpoint, in the workflows shown in the browser, select Favorites, select an employee, and click the Remove menu item.

Sample: Mobile Workflow Employee Directory

45

Try It Out

46

Sybase Unwired Platform

Learn More

Learn More
Learn about this sample, or get additional help on using Unwired Platform in your enterprise environment. For information about project artifacts, database schemas, and other detailed information on this sample, see Related Reference on page 47. For information on how to coordinate your self-directed exploration of Unwired Platform samples, tutorials, and documentation, see Learn More about Sybase Unwired Platform on page 49. To get help or more information, see Getting Help on page 50.

Related Reference
Review reference information to understand the implementational and architectural details of this sample.

Project Artifact Reference


Familiarize yourself with artifacts of this sample. All project artifacts are imported into Sybase Unwired Platform from the EmpDir.zip file. To explore the contents of the project, expand the project in WorkSpace Navigator. The toplevel folder structure of this sample is Folder
Mobile Business Objects

Contents
The source files for the MBOs used in this sample, as well as their required attributes (for example, the table and columns the MBOs access), and the operations they perform if any. The pointers to the data source used by the MBos in the sample. In this case, there is only one: PurchaseOrderDB. The roles defined for the project. The sample project has no roles defined. The personalization keys defined for the project. The sample project has no personalization keys defined. The database files used as the back-end repository for the sample. These files include the .BAT file that starts the database with all required properties, the database file itself, and its corresponding log file.

Data Source References

Roles

Personalization Keys

DB

Sample: Mobile Workflow Employee Directory

47

Learn More Folder


Deployment

Contents
The folder where all applicable deployment files are saved. The project contains some sample/test deployment files. You can add your own deployment files if you choose.

Troubleshooting Mobile Device Connectivity Issues


Provides troubleshooting information for mobile device connectivity issues to the Unwired Server. As a first step on the device or simulator choose Restart Client and then Show Log (not available on iOS). Viewing the device or simulator's log file can be helpful in determining connectivity problems. Cannot Connect to Server 1. Verify that the server name and port are correct. 2. Open a browser on the device or simulator or machine that is running the simulator to http://MACHINE_NAME_WHERE_SUP_IS_INSTALLED:5001 where 5001 is the messaging based synchronization port number shown in SCC under Servers > Server Name > Properties > Messaging Based Synchronization Port. This is also the port number used when creating the device user. An empty white page should appear. If it does not, configure your firewall settings to unblock port 5001. Out of Network This may indicate a network problem. Check the device or simulator's network settings and verify connectivity by opening a browser to a website such as google.com. On a Windows Mobile simulator, ensure that there is an Active Sync (Windows XP) or Windows Mobile Device Center (Windows Vista, Windows 7) Active Sync connection. Server Response Timeout This indicates that a networking problem exists. Check the device or simulator's network settings and verify them by opening a browser to a website such as google.com. If you are using a BlackBerry simulator, verify that MDS is running. Bad User Name or Code This indicates that the activation code or user name specified is incorrect. Recheck the settings on the device and in SCC. Wrong Device for Code This indicates that the user name specified is being used by another device. In SCC, create a new device user.

48

Sybase Unwired Platform

Learn More

Awaiting Server Notification After you deploy a workflow, if it does not appear on the device and this message is seen, try restarting the client. If this works and the device is a BlackBerry, you may need to modify the BlackBerry Push Configuration in SCC. Select Servers > Server Name > Server Configuration > Messaging > BlackBerry Push Configuration. Disabled: Low Storage This issue may occur on a Windows Mobile simulator. On the device check Settings > System > Memory. If necessary, browse to Device\Program Files\Sybase\Messaging \AMP and delete the sub folder. Redeploy your workflow after performing this action.

Learn More about Sybase Unwired Platform


Once you have finished, try some of the other samples or tutorials, or refer to other development documents in the Sybase Unwired Platform documentation set. Check the Sybase Product Documentation Web site regularly for updates: access http:// sybooks.sybase.com/nav/summary.do?prod=1289, then navigate to the most current version. Tutorials Try out some of the other getting started tutorials available on Product Documentation to get a broad view of the development tools available to you. Tutorial Projects Tutorial projects are available for download, if you want the finished tutorial without going through the steps. Download tutorial projects from: http://www.sdn.sap.com/irj/sdn/mobile? rid=/webcontent/uuid/40ea4956-b95c-2e10-11b3-e68c73b2280e. Samples Sample applications are fully developed, working applications that demonstrate the features and capabilities of Sybase Unwired Platform. Check the SAP Development Network (SDN) Web site regularly for new and updated samples: https://cw.sdn.sap.com/cw/groups/sup-apps. Online Help See the online help that is installed with the product, or the Product Documentation Web site. Developer Guides Learn about using the API to create device applications:

Developer Guide: BlackBerry Native Applications Developer Guide: iOS Native Applications

Sample: Mobile Workflow Employee Directory

49

Learn More

Developer Guide: Windows and Windows Mobile Native Applications Developer Guide: Mobile Workflow Packages

Customize and automate:

Developer Guide for Unwired Server Management API customize and automate system
administration features.

Developer Guide: Unwired Server customize and automate server-side implementations for device applications, and administration, such as data handling.

Javadoc and HeaderDoc are also available in the installation directory.

Getting Help
Each Sybase installation that has purchased a support contract has one or more designated people who are authorized to contact Sybase Technical Support. If you cannot resolve a problem using the online help or other technical documents, have the designated person contact Sybase Technical Support or the Sybase subsidiary in your area.

50

Sybase Unwired Platform

Index

Index
A
ActiveSync, installing and configuring 21 Android 19 Android emulator 34 applications generating code for device 24 articles 49 artifacts reference 47

I
installing Microsoft ActiveSync 21 synchronization software 21 interface design 12 iOS simulator 26

M
MBOs overview 10 Microsoft ActiveSync, installing and configuring 21 Mobile Application Diagram 11 mobile applications generating code for 24

B
BlackBerry simulator 32

C
consolidated database, exploring 9

D
debugging 40 deploying configuring ActiveSync for 21 deploying to Unwired Server 15 device applications generating code for 24

P
prerequisites 5 projects artifact reference 47

R
reference project artifacts 47

E
Emulator 15

S
sample learn more 47 samples 49 Screen Design 12 ServerDB, exploring 9 Simulator 15 SUPMessaging_Pro.cab 20 Sybase Control Center register application connection 6 Sybase Mobile Workflow 19 Sybase Unwired Platform getting help 50

F
Flow Design 12

G
generating code for a device application 24

H
help, getting 50

Sample: Mobile Workflow Employee Directory

51

Index
learning more about 49 Technical Support, contacting 50 synchronization software installing 21 tutorial projects 49 tutorials 49

T
tutorial configuring the Android emulator 19

W
Windows Mobile emulator 38

52

Sybase Unwired Platform

You might also like