You are on page 1of 410

Sybase Unwired Platform 2.

1 Mobile Application Development


Lab Workbook

Sybase Unwired Platform 2.1 Mobile Application Development


Lab Workbook Version 1.0 Part # SUP521-90-0211-10

Notice
Copyright 2012 Sybase, Inc. All rights reserved. Unpublished rights reserved under U.S. copyright laws. Sybase and the 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 Germany and in several other countries. All other trademarks are the property of their respective owners.

Sybase Trademarks
Sybase, SYBASE (logo), ADA Workbench, Adaptable Windowing Environment, Adaptive Component Architecture, Adaptive Server, Adaptive Server Anywhere, Adaptive Server Enterprise, Adaptive Server Enterprise Monitor, Adaptive Server Enterprise Replication, Adaptive Server Everywhere, Advantage Database Server, Afaria, Answers Anywhere, AppModeler, APT Workbench, APT-Build, APT-Edit, APT-Execute, APT-Translator, APT-Library, ASEP, Avaki, Avaki (Arrow Design), Avaki Data Grid, AvantGo,Backup Server, BayCam, Bit-Wise, BizTracker, Certified PowerBuilder Developer, Certified SYBASE Professional, Certified SYBASE Professional Logo, ClearConnect, ClientLibrary, Client Services, CodeBank, Column Design, ComponentPack, Connection Manager, Convoy/DM, Copernicus, CSP, Data Pipeline, Data Workbench, DataArchitect, Database Analyzer, DataExpress, DataServer, DataWindow, DataWindow .NET, DB-Library, dbQueue, Dejima, Dejima Direct, Developers Workbench, DirectConnect Anywhere, DirectConnect, Distribution Director, Dynamic Mobility Model, e-ADK, EAnywhere, e-Biz Integrator, E-Whatever, EC Gateway, ECMAP, ECRTP, eFulfillment Accelerator, EII Plus, Electronic Case Management, Embedded SQL, EMS, Enterprise Application Studio, Enterprise Client/Server, Enterprise Connect, Enterprise Data Studio, Enterprise Manager, Enterprise Portal (logo), Enterprise Work Architecture, Enterprise Work Designer, Enterprise Work Modeler, eProcurement Accelerator, eremote, Everything Works Better When Everything Works Together, EWA, ExtendedAssist, Extended Systems, ExtendedView, Financial Fusion, Financial Fusion (and design), Financial Fusion Server, Formula One, Fusion Powered e-Finance, Fusion Powered Financial Destinations, Fusion Powered STP, Gateway Manager, GeoPoint, GlobalFIX, iAnywhere, iAnywhere Solutions, ImpactNow, Industry Warehouse Studio, InfoMaker, Information Anywhere, Information Everywhere, InformationConnect, InstaHelp, Intelligent Self-Care, InternetBuilder, iremote, iScript, Jaguar CTS, jConnect for JDBC, KnowledgeBase, Logical Memory Manager, lrLite, M2M Anywhere, Mach Desktop, Mail Anywhere Studio, Mainframe Connect, Maintenance Express, Manage Anywhere Studio, MAP, M-Business Anywhere, MBusiness Channel, M-Business Network, M-Business Suite, MDI Access Server, MDI Database Gateway, media.splash, Message Anywhere Server, MetaWorks, MethodSet, mFolio, Mirror Activator, ML Query, MobiCATS, MySupport, Net-Gateway, Net-Library, New Era of Networks, Next Generation Learning, Next Generation Learning Studio, O DEVICE, OASiS, OASiS logo, ObjectConnect, ObjectCycle, OmniConnect, OmniQ, OmniSQL Access Module, OmniSQL Toolkit, OneBridge, Open Biz, Open Business Interchange, Open Client, Open ClientConnect, Open Client/Server, Open Client/Server Interfaces, Open Gateway, Open Server, Open ServerConnect, Open Solutions, Optima++, Partnerships that Work, PB-Gen, PC APT Execute, PC DB-Net, PC Net Library, Pharma Anywhere, PhysicalArchitect, Pocket PowerBuilder, PocketBuilder, Power++, Power Through Knowledge, power.stop, PowerAMC, PowerBuilder, PowerBuilder Foundation Class Library, PowerDesigner, PowerDimensions, PowerDynamo, Powering the New Economy, PowerScript, PowerSite, PowerSocket, Powersoft, PowerStage, PowerStudio, PowerTips, Powersoft Portfolio, Powersoft Professional, PowerWare Desktop, PowerWare Enterprise, ProcessAnalyst, Pylon, Pylon Anywhere, Pylon Application Server, Pylon Conduit, Pylon PIM Server, Pylon Pro, QAnywhere, Rapport, Relational Beans, RepConnector, Report Workbench, Report-Execute, Replication Agent, Replication Driver, Replication Server, Replication Server Manager, Replication Toolkit, Resource Manager, RFID Anywhere, RW-DisplayLib, RW-Library, SAFE, SAFE/PRO, Sales Anywhere, SAP, SAP Business Suite, Sybase Unwired Platform, Sybase Workflow for SAP Business Suite, SAP Mobile Sales CRM, Search Anywhere, SDF, Search Anywhere, Secure SQL Toolset, Security Guardian, ShareSpool, Sharelink SKILS, smart.partners, smart.parts, smart.script, SOA Anywhere Trademark,SQL Advantage, SQL Anywhere, SQL Anywhere Studio, SQL Code Checker, SQL Debug, SQL Edit, SQL Edit/TPU, SQL Modeler, SQL Remote, SQL SMART, SQL Toolset, SQL Station, SQLJ, Stage III Engineering, Startup.Com, STEP, SupportNow, S.W.I.F.T. Message Format Libraries, Sybase Central, Sybase Client/Server Interfaces, Sybase Development Framework, Sybase Financial Server, Sybase Gateways, Sybase IQ, Sybase Learning Connection, Sybase MPP, SyberLearning LIVE, Sybase SQL Desktop, Sybase SQL Lifecycle, Sybase SQL Workgroup, Sybase Synergy Program, Sybase Virtual Server Architecture, Sybase User Workbench, SybaseWare, Syber Financial, SyberAssist, SybFlex, SybMD, SyBooks, System 10, System 11, System XI (logo), SystemTools, Tabular Data Stream, The Enterprise Client/Server Company, The Extensible Software Platform, The Future Is Wide Open, The Learning Connection, The Model For Client/Server Solutions, The Online Information Center, The Power of One, TotalFix, TradeForce, Transact-SQL, Translation Toolkit, Turning Imagination Into Reality, UltraLite, UltraLite.NET, UNIBOM, Unilib, Uninull, Unisep, Unistring, URK Runtime Kit for UniCode, Unwired Accelerator, Unwired Orchestrator,Viafone, Viewer, VisualWriter, VQL, WarehouseArchitect, Warehouse Control Center, Warehouse Studio, Warehouse WORKS, Watcom, Watcom SQL, Web Deployment Kit, Web.PB, Web.SQL, WebSights, WebViewer, XA-Library, XA-Server, XcelleNet, and XP Server, XTNDConnect, XTNDACCESS, are trademarks of Sybase, Inc. or its subsidiaries.

Restricted Rights Legend Use, duplication or disclosure by the Government is subject to 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

Sybase Unwired Platform 2.1 Mobile Application Development Lab Workbook

Module 1: Introduction and Architecture


There are no labs in this Module

Module 2: Enterprise Development Edition Installation


Lab 2-1: Installing SAP Java Connector Files ............................................................................Lab 2-1 Lab 2-2: Starting Sybase Unwired Platform ...............................................................................Lab 2-5 Lab 2-3: Reviewing the Sybase Unwired Platform Development Edition Installation ...............Lab 2-13

Module 3: Introduction to the Unwired Workspace


Lab 3-1: Navigating the Unwired Workspace .............................................................................Lab 3-1 Lab 3-2: Creating an SAP Connection Profile .............................................................................Lab 3-25

Module 4: MBO Design, Development and Deployment


Lab 4-1: Creating SAP-based MBOs via JCO .............................................................................Lab 4-1 Lab 4-2: Creating a SOAP Web Service MBO ...........................................................................Lab 4-23 Lab 4-3: Creating a REST Web Service MBO ...........................................................................Lab 4-33 Lab 4-4: Creating a Database-driven MBO ................................................................................Lab 4-47

Module 5: Introduction to Mobile Workflow Application Development


Lab 5-1: Building the Vacation Request Mobile Workflow Application ....................................Lab 5-1 Lab 5-2: Building the Vacation Approval Workflow Application ..............................................Lab 5-74

Module 6: Advanced Mobile Workflow Application Development


Lab 6-1:Enhancing the Workflow Application ............................................................................Lab 6-1 Lab 6-2: Creating an Online Lookup Scenario ............................................................................Lab 6-27 Lab 6-3: Using the Attachment Viewer Control ..........................................................................Lab 6-32

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

TOC - 1

Lab Workbook

Module 7: Introduction to Native Mobile Application Development


Lab 7-1: Configure BlackBerry Eclipse Plug-in ..........................................................................Lab 7-1 Lab 7-2: Project Setup..................................................................................................................Lab 7-4 Lab 7-3: Preparing the Visual Studio Environment .....................................................................Lab 7-6 Lab 7-4: Preparing the Eclipse Environment ...............................................................................Lab 7-19

Module 8: Sybase Unwired Platform Client APIs


Lab 8-1: Using Sybase Unwired Platform APIs and Generated Code .........................................Lab 8-1

Module 9: Android Native Application Development


Lab 9-1: Developing an Android Native Application ..................................................................Lab 9-1

Module 10: Data Change Notification (DCN) and Push


Lab 10-1: Implementing Regular DCN with Payload .................................................................Lab 10-1 Lab 10-2: Implementing WF-DCN for Workflow Mobile Applications ....................................Lab 10-26

Appendix B: Administration for the Developer


There are no labs in this Module

TOC - 2

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 1: Introduction and Architecture

Module 1: Introduction and Architecture


There are no labs in this module.

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 1 - 1

Lab Workbook

Lab 1 - 2

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 2: Enterprise Development Edition Installation

Module 2: Enterprise Development Edition Installation

Lab 2-1: Installing SAP Java Connector Files


Objectives After completing this lab, you should be able to: Description Procedure Install the SAP Java Connector Files

In this lab, you will install the SAP Java Connector files onto your system. 1. The Sybase Unwired Platform (Unwired Server and Unwired Workspace) should not be running when you perform this lab. 2. Launch two File Explorer windows. Navigate the first window to this directory: C:\Sybase Courses\SUP521\Lab Resources and locate the SAP_JCO_Connector.zip file. 3. Extract the contents of this file to your Lab Resources folder. You should see two dll files and a jar file: sapjco.jar, librfc32.dll, and sapjcorfc.dll. 4. Copy librfc32.dll and sapjcorfc.dll to the C:\Windows\System32\ folder. 5. Copy librfc32.dll and sapjcorfc.dll to the C:\Sybase\UnwiredPlatform\Servers\UnwiredServer\lib folder. 6. Copy librfc32.dll and sapjcorfc.dll to the C:\Sybase\UnwiredPlatform\JDK1.6.0_24\bin folder:

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 2 - 1

Lab Workbook

7. Copy sapjco.jar to the C:\Sybase\UnwiredPlatform\Unwired_WorkSpace\Eclipse\sybase_workspace\mo bile\eclipse\plugins\com.sybase.uep.com.sap.mw.jco_<version>\lib" folder:

Lab 2 - 2

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 2: Enterprise Development Edition Installation

8. Copy sapjco.jar to C:\Sybase\UnwiredPlatform\Servers\UnwiredServer\lib\3rdparty\" folder:

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 2 - 3

Lab Workbook

NOTE: If you do not have access to the Student CD or want the latest release of the SAP Connector files, you can also visit the SAP Web site at http://service.sap.com/connectors and download the latest SAP JavaConnector files. For example, the latest connector files are: sapjco-ntintel-2.1.8. 9. This completes Lab 2-1.

Lab 2 - 4

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 2: Enterprise Development Edition Installation

Lab 2-2: Starting Sybase Unwired Platform


Objectives After completing this lab, you should be able to: Description Start Sybase Unwired Server Launch the Sybase Control Center

In this lab, you will start the Sybase Unwired Platform and become familiar with the installed components. You will start your servers and launch and explore the Sybase Control Center tool. 1. 2. Start Sybase Unwired Platform Services Start and Explore the Sybase Control Center

Task Outline

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 2 - 5

Lab Workbook

Detailed Instructions

Task 1: Start Sybase Unwired Platform Services


Objectives After completing this task, you should be able to: Description Procedure Start the Unwired Platform services

In this task, you will start the Unwired Server and other services. 1. Start Unwired Platform services from StartPrograms Sybase Unwired Platform Start Unwired Platform Services. As an alternative, use the Desktop icon if you wish. 2. A command prompt will appear indicating that the services are starting:

Lab 2 - 6

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 2: Enterprise Development Edition Installation 3. When completed, verify that your services have indeed started by checking all running services from Start Settings Control Panel Administrative Tools Services:

4. Note the following services and their status: a. Unwired Server service:

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 2 - 7

Lab Workbook

b. Consolidated Database service:

5. Sample Database service (database used in class exercises):

6. This completes Task 1.

Lab 2 - 8

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 2: Enterprise Development Edition Installation

Task 2: Start and Explore the Sybase Control Center


Objectives After completing this task, you should be able to: Description Launch the Sybase Control Center (SCC) Describe SCCs key features

The Sybase Control Center for Sybase Unwired Platform is a web-based administration console that offers server administration and device management capabilities. In this lab task, we will explore the administration console to control servers, view log files, modify personalization values, and view resources. 1. Before you can launch the Sybase Control Center, you must install the Flash plug-in. Using Explorer, navigate to: C:\SUP_install\3rdParty folder and double click on the install_flash_player_ax-10.exe file to install the Flash Player. 2. Launch the Sybase Control Center from Programs Sybase Sybase Control Center. As an alternative, use the Desktop icon to launch the SCC. 3. Enter the username and password: supAdmin and s3pAdmin

Procedure

4. The Sybase Control Center will authenticate the user and then launch the platforms administration environment. NOTE: Once logged in, the main page of the Administration console is displayed. From the Sybase Control Center, an administrator may configure a server, configure security,
2012 Sybase, Inc. Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0 Lab 2 - 9

Lab Workbook register and manage devices and application packages, add and view resources, and monitor the entire system. We can start by exploring the server log. The server log is the first place you look if you are experiencing any kind of runtime error. 5. Click ServersservernameLog in the left panel of the SCC to review server log, set log levels, and perform clean-up:

6. In the General tab, the log view can be changed between Text and Grid view, you can refresh the log, or delete the log contents. Change your log view to Grid View, select an item and click the View details button:

7. The log file will grow making it difficult to find information easily. The SCCs log viewer does have a filtering capability that helps find things easier. Enable the Show Filter Criteria checkbox to set your criteria. The window refreshes and exposes additional filtering options such as the log level. ALL provides the most verbose output. Other log level selections include TRACE, DEBUG, INFO, WARN, ERROR, CONSOLE. You may set the log level to ERROR to reduce the amount of data being displayed.

Lab 2 - 10

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 2: Enterprise Development Edition Installation

8. Select the Settings tab to view additional functionality such as how large the log file can grow, if backups are kept when the log file reaches its maximum size and how much detail is being placed into the log file:

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 2 - 11

Lab Workbook 9. Explore other items such as Servers Server Configuration, which will show you all of the ports being used by the platform:

10. This completes Task 2, Lab 2-2.

Lab 2 - 12

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 2: Enterprise Development Edition Installation

Lab 2-3: Reviewing the Sybase Unwired Platform Development Edition Installation
Objectives After completing this lab, you will be familiar with the Enterprise Development Edition installation, including: Description Directory structure Database and server log file location

In this lab, you will review the environment of the Sybase Unwired Platform Development installation. 1. Navigate to the installation directory (C:\Sybase\UnwiredPlatform). Note the location of the Unwired Platform directory and subdirectories:

Procedure

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 2 - 13

Lab Workbook 2. Open the UnwiredServer\Data directory to view the Data Tier databases. The consolidated database is called default.db. The sampledb.db database will be used as the EIS or enterprise database in the lab exercises:

3. Open the logs directory (C:\Sybase\UnwiredPlatform\Servers\UnwiredServer\logs) and locate the hostname-server log file:

Lab 2 - 14

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 2: Enterprise Development Edition Installation

4. This completes Lab 2-3.

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 2 - 15

Lab Workbook

Lab 2 - 16

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 3: Introduction to the Unwired WorkSpace

Module 3: Introduction to the Unwired WorkSpace

Lab 3-1: Navigating the Unwired WorkSpace

Lab setup Objectives

You must complete all previous tasks in Lab 2-1 before you begin this lab. After completing this lab, you should be able to: Start and explore Unwired WorkSpace Create a database connection profile Create an Unwired Server connection profile Add an existing project and identify mobile application artifacts Create a new project for the student application

Description

In this lab, you will be introduced to the Unwired WorkSpace, set up a database connection to a database, add an existing project to the Unwired WorkSpace and create a new project to be used for the remainder of the course. 1. Set Up the Student Development Directories 2. 3. 4. 5. Start and Explore Unwired WorkSpace Set up Database Connectivity Add an Existing Project and Explore Contents/Views Create a New Project for the Student Application

Task outline

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 3 - 1

Lab Workbook

Detailed Instructions

Task 1: Set Up the Student Development Directories


Description In this task, you will extract your student CD contents to create your WorkSpace development environment for the remainder of the course. If you are taking this course as a Sybase/SAP class, the Student CD files have already been pre-installed for you. 1. If you are using your assigned Virtual Machine to perform the labs, the student lab files have already been installed, for your convenience. Open Windows Explorer and navigate to C:\Sybase Courses\SUP521 to verify existence of the student files. NOTE: If you are performing labs on a physical machine instead of the Virtual Machine, locate the Student CD-ROM that came with your student kit and insert the CD-ROM into your drive. Double-click the SUP521_v1.0.exe file. This is a WinZip self-extracting executable. Double-click the .exe file and continue with steps 2-4 below. 2. When prompted for the extract location, enter your root drive C:\ - and the WinZip extraction program will unzip create your directory structure. WinZip will create the C:\Sybase Courses\SUP521\ directory structure. 3. Upon completion, WinZip notifies you as to the number of files extracted. Click OK. Close the WinZip application. 4. Launch Windows Explorer and verify that you have a directory called Sybase Courses\SUP521\... and associated sub-directories on your C drive. 5. This completes Task 1.

Procedure

Task 2: Start and Explore Unwired WorkSpace


Description In this task, you will start Unwired WorkSpace and become more familiar with the different views and features of this product. 1. Start the Unwired WorkSpace from StartPrograms Sybase Unwired Platform Unwired WorkSpace. If you prefer, you can use the Desktop icon to start Unwired WorkSpace. 2. Upon startup, browse to change the default location for your local workspace to C:\Sybase Courses\SUP521\Student. This will become you development folder for the lab exercises. Also check the box to use this location as your default workspace folder.
Lab 3 - 2 Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0 2012 Sybase, Inc.

Procedure

Module 3: Introduction to the Unwired WorkSpace 3. When Eclipse launches, the IDE displays a Welcome page. Review the links provided on the Welcome page to get a general overview of the Unwired WorkSpace:

4. Close the Welcome page. You should now be in the Mobile Development perspective:

WorkSpace Navigator View

Diagram Editor

Problems View

Enterprise Explorer View

Properties View

5. Now, we will explore the Mobile Development perspective. There are 5 key views of the Unwired WorkSpace: a. WorkSpace Navigator View b. Enterprise Explorer View c. Diagram Editor
2012 Sybase, Inc. Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0 Lab 3 - 3

Lab Workbook d. Properties View e. Problems View 6. Click the WorkSpace Navigator view to give it focus. Right-click anywhere in the view to bring up the context menu:

7. The WorkSpace Navigator is the focal point of mobile application development. This view is where projects and their resources are created and organized. This view will be used to create application artifacts such as Projects, Mobile Business Objects (MBO), Roles, etc. It also provides functionality to review existing application components in various editors such as the Diagram Editor (where MBOs are defined). You may also import or export existing projects via the WorkSpace Navigator. 8. Now, click anywhere in the Enterprise Explorer view to give it focus. This view is where design-time connection profiles are created allowing you to connect to the various enterprise back-ends including enterprise database servers, SAP Servers, Web and REST Web Services. You can also use this view to explore the contents of the repository of an Unwired Server. For Sybase databases it provides database exploration capabilities such as viewing data, inserting, deleting and updating data as well as the ability to create/edit tables, stored procedures, etc. 9. Expand the Unwired Servers folder.

Lab 3 - 4

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 3: Introduction to the Unwired WorkSpace 10. My Unwired Server is a default connection profile to your Unwired Server. You may use this default profile or create your own. Let us review this profile by selecting Properties from the context menu:

11. When the properties page appears, select the Unwired Server Connection Properties item in the list:

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 3 - 5

Lab Workbook

12. Note the ports that the Unwired Server and RBS are using: 2000 and 2480 respectively. These ports were specified during the installation process. 13. Explore some of the other items in this profile. You may also test the profile by clicking the Test Connection button, which pings the server and returns a successful or failed message. If your test fails, you can then investigate probable causes such as incorrect port number or IP domain. 14. Click Cancel and return to your Enterprise Explorer view. 15. Right-click the Unwired Server profile again and this time select Connect. A connection to the server will be established for the duration of your project development session. 16. Note that upon a successful connection to the server, the Enterprise Explorer view displays more information about your Unwired Server. You will understand more about these folders (Domains, Packages, Workflows) and their contents as the class progresses:

Lab 3 - 6

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 3: Introduction to the Unwired WorkSpace

17. This completes Task 2.

Task 3: Set up Database Connectivity


Description In this task, you will make a new connection profile for a SQL Anywhere database server. This database server will represent what is referred to as an Enterprise Information System (EIS). 1. My Sample Database is a connection profile provided during the installation of Sybase Unwired Platform. You can connect to the sample database without creating your own custom connection profile. Simply expand the Database Connections folder in the Enterprise Explorer, right-click My Sample Database and select Connect from the context menu:

Procedure

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 3 - 7

Lab Workbook

2. You should have successfully connected to the sample database provided with the installation. 3. Review the database tables, table relationships, primary and foreign keys, etc. for a few minutes and then collapse the profile tree.

Lab 3 - 8

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 3: Introduction to the Unwired WorkSpace

4. For your own development projects, you will need to create additional connection profiles. The next several steps will lead you through the creation of a connection profile to a different database on your computer. If you are not using a system provided by Sybase Education, you may choose to create a connection profile for any available database. Remember that you can connect to any enterprise database on the network as long as you have the appropriate connection requirements. 5. First, lets go to Windows Explorer and navigate to your C:\Sybase Courses/SUP521/Lab Resources folder. We have created a batch file that will start another database. In the Lab Resources folder, right-click the file easdemo_db_start.bat and select edit. 6. Note the following batch file details:

start "EASDemo" "C:\Sybase\UnwiredPlatform\Servers\SQLAnywhere12\BIN32\ dbeng12.exe" -n EASDEMO -x tcpip(port=7777) -c 8M "C:\SUP521_DB\easdemodb.db"

a. What is the database name: ______________________________________________ b. What is the port number being used? ______________________________________________ c. What is the database file name on the system? ______________________________________________ Answers can be found at the end of this lab. 7. You will use this information shortly when you create your connection profile. 8. Close Notepad. 9. Double-click the same batch file to execute the startup script. This batch file only starts the database. It does not connect to it. You should see the following screen appear and then automatically minimize. An icon that looks like an orange/yellow lightning bolt, appears in the Windows notification area (where the clock is, bottom right of the screen.)

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 3 - 9

Lab Workbook

10. Return to your Unwired WorkSpace. 11. Right-click on Database Connections and select New from the context menu. The New Connection Profile window should appear. 12. Select Sybase ASA as the database type. 13. Enter EASDemoConnProfile for your profile name. 14. Enter a description of your choice:

Lab 3 - 10

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 3: Introduction to the Unwired WorkSpace

15. Click Next. 16. Select the appropriate driver. In this case, it will be the ASA version 12 driver for Unwired Server. 17. Click the Refresh button to the right of Discovered Servers, so that Unwired Server can discover all ASA version 12 database servers. 18. Select easdemo:7777 from the dropdown list. Recall that the batch file assigned port number:7777 to the database server. 19. Check Save Password and leave the rest of the options at their default values, including the Host name. You may elect to connect every time the workbench starts or you may manually connect by right-clicking the profile and selecting Connect. Lets leave this option unchecked for now:

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 3 - 11

Lab Workbook

20. Click the Test Connection button and you should get a successful connection message. 21. Click Finish. 22. You should now have a second connection profile listed in your Enterprise Explorer:

Lab 3 - 12

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 3: Introduction to the Unwired WorkSpace

23. This completes Task 3.

Task 4: Add an Existing Project and Explore Contents/Views


Description In this task, you will add an existing project to your workspace and explore additional Unwired WorkSpace views and the objects of an existing application. We will review a project called SalesForceAutomation. 1. Open Windows Explorer and navigate to C:\Sybase Courses\SUP521\Lab Resources\SalesForceAutomation. 2. Verify that your folder contains the following:

Procedure

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 3 - 13

Lab Workbook

3. Close Windows Explorer and return to your Unwired WorkSpace. 4. We will be importing a project into our existing workspace. To do so, right-click anywhere in your WorkSpace Navigator and select Import. The following window appears. Expand the General folder:

5. Select Existing Projects into Workspace. 6. Click Next.

Lab 3 - 14

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 3: Introduction to the Unwired WorkSpace 7. Browse to the Sales Automation projects root directory: C:\Sybase Courses\SUP521\Lab Resources\SalesForceAutomation. 8. Make sure that the SalesForceAutomation project is checked and select to Copy projects into workspace:

9. Click Finish. You have just imported an existing project into the Unwired WorkSpace.

NOTE: In the previous steps, you were asked to extract the project folders directly from disk. Notice, in the dialog above, that Sybase Unwired Platform gives you the option to import a project from a directory or an archive file. In short, you do not have to extract an archive for Sybase Unwired Platform to successfully locate all the required files to import. It is intelligent enough to read an archive and import all necessary artifacts for you. SPECIAL NOTE This demo project was created using Sybase Unwired Platform 1.5.5. As soon as you attempt to work with any of the key project files, Unwired WorkSpace will require that you migrate your project to the most current release. Follow the migration step.

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 3 - 15

Lab Workbook 10. Expand the project folders to view all of the artifacts associated with the imported project:

11. Note that the project icon has an error indicator. Explore the Problems view to determine what may be the probable cause of this error (s). 12. Look at the last error:

13. The imported project is using a connection profile to an SAP Application Server named PuneSAPVM. In order to resolve this error, you would have to create the PuneSAPVM connection profile. This is not necessary at the present time. Later you will be instructed on how to create an SAP connection profile.

Lab 3 - 16

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 3: Introduction to the Unwired WorkSpace 14. The first three errors are occurring because Unwired WorkSpace is looking for certain libraries, which are installed on your system but in different directories. Right-click over the project and select Properties. 15. Select the Java Build Path node in the treeview on the left. Then select the Libraries tab. This application was originally created using Sybase Unwired Platform version 1.5.5. The directories for the two JAR files needs to be updated to reflect version 2.1 sub-directories. Click the Edit button and update the folders to the current directory names. Errors will not stop you from continuing with this particular lab. If you prefer, you can ignore them:

16. Right-click over the SalesForceAutomation project in the WorkSpace Navigator and select Open in Diagram Editor from the context menu:

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 3 - 17

Lab Workbook

17. If you are asked to migrate the application to Sybase Unwired Platform, click Yes:

18. The Migration progress window appears:

19. Click OK to view the Migrating Results window:

Lab 3 - 18

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 3: Introduction to the Unwired WorkSpace 20. The Mobile Application Diagram will open in the Diagram Editor:

21. The above diagram is displaying three MBOs. You will not be able to correct connection or BAPI definition errors at this time. This exercise is specifically designed to introduce you to more views of the Unwired WorkSpace. 22. Select the Material MBO. 23. Activate the Properties view. This view is where you will spend the majority of your time when designing objects that make up your mobile application. It should be evident the source of this MBO being an SAP BAPI:

24. Explore the other tabs of the Properties view of an MBO.

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 3 - 19

Lab Workbook 25. Select the Outline view (tab). Even though the Mobile Application Diagram only seems to show three MBOs, the Outline view shows there are more MBOs in the diagram. Notice the light blue box in the Outline view. You can, with your mouse, drag that blue box to easily navigate to other areas of the diagram. Try this now:

Drag this and see what happens to your diagram

26. Click on the Outline View icon on the toolbar (shown below).

27. Double-click on the Approval MBO and see the impact to the Diagram Editor.

Lab 3 - 20

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 3: Introduction to the Unwired WorkSpace 28. Review the contents of the Palette view (upper right). This view contains other entities that can be added to the Mobile Application Diagram:

29. Look at the WorkSpace Navigator. Notice the folders that appear directly under the mobile application project (SalesForceAutomation):

30. In a null area of the Diagram Editor, right-click and select Switch Developer ProfileAdvanced. A dialog will appear confirming your choice to change the view. Enable the checkbox that will stop this dialog from appearing. 31. Now, look at the Palette view. You have an additional item (Local Business Object):

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 3 - 21

Lab Workbook 32. Look at the WorkSpace Navigator. You should see additional folders:

33. Select the Material MBO in the diagram. Look at the Properties view. You will see more tabs and sub-tabs since you are now using the Advanced Developer Profile. You will make use of these additional tabs/features in later labs:

34. This task allowed you to experience some project migration issues and served as a means by which you had the opportunity to explore the Unwired WorkSpace. This task was not designed to make the application functional at this time. 35. This completes Task 4.

Task 5: Create a New Project for the Student Application


Description In this task, you will create your own project which we will call Sales_Order_Entry. This project will contain all your application files created in the next few labs. 1. In the Unwired WorkSpace menu select File Close All. If prompted to save changes, answer yes. All editors and diagrams will disappear.
Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0 2012 Sybase, Inc.

Procedure

Lab 3 - 22

Module 3: Introduction to the Unwired WorkSpace 2. Right-click over the SalesForceAutomation project and select Close Project from the context menu. 3. Using the menu, select FileNewMobile Application Project. 4. Enter Sales_Order_Entry for your class project name. Keep the default folder checked so that the project and files are saved to your Student folder:

5. Click Finish. Your WorkSpace Navigator should appear as follows:

6. You now have a project that will be used in future labs. 7. This completes Task 5.

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 3 - 23

Lab Workbook

Answers

Task 3: Step 5 - Answers

a) EASDemo ( the n option in the batch file) b) 7777 c) easdemodb.db

Lab 3 - 24

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 3: Introduction to the Unwired WorkSpace

Lab 3-2: Creating an SAP Connection Profile


Description In the labs for the previous module, you installed the SAP Java Connector (JCO) files into your environment. In this lab, you will create an SAP Connection Profile. The profile cannot be successfully created without having installed the JCO. The SAP Connection Profile is used the same way the earlier database connection profiles were used, only instead of connecting to a back-end database, we will now connect to a back-end SAP system. The connection profile will be used in development to connect and display all available SAP objects (BAPIs) that you can use for your development activities. 1. In the Enterprise Explorer view, right-click on the SAP Servers folder and select New:

Procedure

2. The Connection Profile wizard will launch. Enter SAP4_Connection for the connection name and add a Description (optional) if you like and click Next. 3. On the Connection Profile properties page, enter the following properties (if these properties have changed due to a change in the location of the SAP Server, the instructor will give you the new properties to enter. Otherwise, assume that these are correct): Property Name Application server: System ID: System number: Client ID:
2012 Sybase, Inc.

Value sap4.sybase.com D04 00 900

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 3 - 25

Lab Workbook User name: Password: TRAININGUSER traininguser

NOTE: If you cannot connect to the SAP Server, please let the instructor know immediately and he/she will provide a new address for your class lab.

4. Click the Test Connection button. 5. Click Next. The Summary page appears. 6. Click Finish. 7. Right-click your SAP Connection Profile and select Connect:

Lab 3 - 26

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 3: Introduction to the Unwired WorkSpace

8. Your connection should have been successful. 9. Expand the SAP connection profile to explore the contents of the SAP database by expanding each of the folders. It will take a few minutes for the SAP repository to be visible in the Enterprise Explorer:

10. Explore all the different modules, BAPIs and operations available on the SAP backend. This will help you later when you need to navigate to specific areas in the SAP ECC. 11. This completes Lab 3-2.
2012 Sybase, Inc. Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0 Lab 3 - 27

Lab Workbook

Lab 3 - 28

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 4: MBO Design, Development and Deployment

Module 4: MBO Design, Development and Deployment Lab 4-1: Creating SAP-based MBOs via JCO
Lab Setup Before you begin: Objectives Please complete all previous labs Confirm that Unwired Server is up and running

After completing this lab, you should be able to: Use the Unwired Workspace BAPI/RFC Search feature Create an MBO that reads data from a SAP ECC system Create an MBO that updates a SAP system Understand how to deal with SAP structures Deploy MBOs to the Unwired Server

Description

In this lab, you will create your first MBOs. These MBOs will be based on SAP BAPI operations. You will also be taught how to deploy MBOs to an Unwired Server. 1. Create a MBO that Reads SAP Data 2. 3. Create a MBO that Updates SAP Deploy MBOs to the Unwired Server

Task Outline

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 4 - 1

Lab Workbook

Detailed Instructions Task 1: Create a MBO that Reads SAP Data


Description In this task, you will create your first MBO. This MBO will read data from the SAP ECC via the Java Connector (JCO). You will be able to test your work at the end of the lab, but you will not be creating the UI portion of the application at this time. 1. If not already started, start the Unwired WorkSpace development IDE from StartPrograms Sybase Sybase Unwired Platform Unwired WorkSpace. 2. Use the WorkSpace Navigators context menu to close the Sales_Order_Entry project. You should have no projects opened in the workspace. 3. Create a new Mobile Application Project named: ProjectSAP. This will open a new, blank Mobile Application Diagram. 4. If not already connected to the SAP ECC, use the Enterprise Explorer/SAP connection profile you already created to connect. 5. If not already connected to the Unwired Server, use the Enterprise Explorer/Unwired Server connection profile to connect. 6. In the Palette view, click on Mobile Business Object and then click again in the diagram editor. This begins the New Mobile Business Object wizard.

Procedure

Lab 4 - 2

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 4: MBO Design, Development and Deployment 7. Give the MBO the name FlightList and click Next.

8. Choose the SAP data source and your SAP4_Connection profile as the source of this MBO and click Next:

9. When asked to choose the BAPI/RFC operation, click the Browse button. It will take a few minutes to read the SAP repository:

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 4 - 3

Lab Workbook

10. On the Browse screen, enter Flight in the search box. This will show all of the SAP modules/BAPI that contain the word Flight. Choose the Flight BAPI (as shown below). This will display the BAPIs operations at the bottom of the dialog. Choose the GetList operation and click OK to close the Browse dialog:

Lab 4 - 4

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 4: MBO Design, Development and Deployment

11. Always watch the headings of your wizard dialogs. They help you in many ways by providing you with next steps:

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 4 - 5

Lab Workbook 12. Using the checkboxes, you define the inputs/outputs to this MBO. For this example, choose DESTINATION_FROM and DESTINATION_TO as the two inputs. These are structures, as seen by the ability to expand them. Select FLIGHT_LIST as the output from this MBO. If you expand FLIGHT_LIST you will see all of the attributes that will be coming back from the SAP BAPI call:

13. Click the Preview button after defining the inputs/outputs. When viewing the Preview dialog, it will again become apparent that the inputs, DESTINATION_TO/FROM are structures and have variable input. To understand which of these variables within the structure are required is knowledge you must possess about your SAP system and its BAPIs. An easy way to provide the input is to click in the Value column where you will see an ellipse button. Click that button:

Lab 4 - 6

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 4: MBO Design, Development and Deployment

14. For this particular structure, the only required input is AIRPORTID. Enter JFK as the value. This particular BAPI contains only minimal test data. Do not try to get a list from any TO/FROM combination.

15. Repeat the above process for the DESTINATION_FROM input. Use SFO as the AIRPORTID for this variable. After providing your inputs, and closing the Edit Values dialogs, your Preview dialog should look as follows:

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 4 - 7

Lab Workbook

16. Enable the Save as Default Values checkbox. Then click the Preview button on the dialog. You can safely ignore the warning dialog that appears since we are only doing a preview, that warning is immaterial. You should see the following list of flights.

17. Click OK to close the Preview dialog which will place you back in the wizard on the SAP Definition screen. 18. Click Next. 19. On the Parameters screen, you see the input parameter mappings have been automatically created. No action is necessary on this screen. Notice how the default values were copied to the input parameters (towards the bottom of the dialog). Click Next:

Lab 4 - 8

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 4: MBO Design, Development and Deployment

20. Again, on the Attributes Mapping dialog, no action is necessary. Recall that an MBO is a container of Attributes and Operations. We defined the output of this BAPI operation call as FLIGHT_LIST. We saw earlier that FLIGHT_LIST was a container of many elements. Here, we see how those elements are mapped, one-for-one, into the attributes of the MBO:

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 4 - 9

Lab Workbook

21. Click the Finish button. 22. The diagram editor shows one MBO and two structures. Note the icon in the titlebar of the FlightList MBO. It looks like a cell phone. This indicates you are looking at an MBO. Now look at the icon in the titlebar of the DESTINATION_TO. This indicates you are looking at a structure. You should always distinguish between the two:

Lab 4 - 10

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 4: MBO Design, Development and Deployment

23. Right-click over the FlightList MBO in the diagram editor. The context menu has an option to Preview, which works the same as we saw earlier. This is just another way for you to test your work:

24. On the menu click FileSave All. 25. This completes Task 1.

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 4 - 11

Lab Workbook

Task 2: Create a MBO that Updates SAP


Description In this task, you will create a new MBO that updates an SAP system. This MBO will allow the application to create a new Flight Customer in our SAP ECC. 1. Using the steps from Task 1, add a new SAP-based MBO (use the item on the Palette) and name it: FlightCustomer. 2. When prompted, search for Flight, like before, but this time choose the FlightCustomer BAPI and the CreateFromData operation:

Procedure

3. Click OK on the Browse dialog.

Lab 4 - 12

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 4: MBO Design, Development and Deployment 4. On the SAP Definition dialog, expand the CUSTOMER_DATA section and enable the following inputs: CITY, COUNTR, CUSTTYPE, PHONE, POSTCODE, REGION and STREET. Define CUSTOMERNUMBER and RETURN as output from this operation call.

5. Click the Preview button. 6. On the Preview dialog, click under Value, click the ellipse button, and enter some values, like you did in Task 1:

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 4 - 13

Lab Workbook 7. Click OK to close the Edit Values dialog and then click the Preview button. You can ignore the warning message. 8. When you preview, it should be evident that a required input was not specified Customer Name:

Earlier it was stated that you must know what is required on the SAP side. If you do not, you can use the Preview feature as a trial-and-error since it will show you what was expected. Click OK to close the Preview dialog. You should be back on the SAP Definition dialog of the wizard. Under CUSTOMER_DATA, enable the CUSTNAME input. 9. Click Preview again. You will have to re-enter the values. Put in a company name of your choosing along with all of the other inputs like last time. Be sure to enable the option to save as defaults. Try to preview again. It should fail, but this time with a different error:

Lab 4 - 14

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 4: MBO Design, Development and Deployment 10. Fix the above error by providing a CUSTTYPE value of B. Try the preview again. You should now be successful. In the Preview dialog you should get the new customer number returned to you:

11. Having received back a new customer number means you have successfully updated your SAP system. 12. Click OK to close the Preview dialog. 13. Click Finish to compete the creation of your new MBO. 14. The Mobile Application diagram should now show two additional MBOs (FlightCustomer and Return) and a structure representing the inputs to our BAPI operation:

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 4 - 15

Lab Workbook

15. Save your work by clicking FileSave All. 16. Click on the FlightCustomer MBO in the Mobile Application diagram. 17. Go to the Properties view. 18. Select the Attributes tab and the Definition sub-tab. 19. Click the Edit button.

Lab 4 - 16

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 4: MBO Design, Development and Deployment 20. Notice in the Change definition dialog, towards the bottom, that all calls to updatable SAP operations are automatically committed. You do have the option to disable autocommit if you want to code that yourself:

21. This completes Task 2.

Task 3: Deploy MBOs to the Unwired Server


Description Procedure In this task, you will deploy your MBOs to the Unwired Server. You will save the deployment information in a package profile so that subsequent deployments will be quicker. 1. To deploy MBOs, right-click in a null area of the Mobile Application Diagram and select Deploy Project:

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 4 - 17

Lab Workbook

2. The Deploy Mode and Target Version dialog appears. 3. For our class project, we will choose the Replace Deploy Mode and Replication-based synchronization. Well use the defaults for the remaining options:

Lab 4 - 18

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 4: MBO Design, Development and Deployment

4. Click Next. 5. The Contents dialog appears. We will deploy all the object selected:

6. Click Next.
2012 Sybase, Inc. Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0 Lab 4 - 19

Lab Workbook 7. You have no User-defined classes (Result Set Filters or Result Checkers) to deploy. Click Next. 8. The Target Server dialog appears. Select our Unwired Server as the target. The Unwired Server is already connected; if the server is not connected, click Connect to ensure that we are connected to the Unwired Server selected for deployment. 9. Leave Domain and Security configuration at their defaults. 10. Click Next. The Server Connection Mapping dialog appears. 11. Click in the Server Connection column field for a dropdown list and create a new server connection:

12. The properties from the SAP4_Connection connection profile will be automatically copied to the server connection. Simply click OK on the following screen:

Lab 4 - 20

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 4: MBO Design, Development and Deployment 13. Click Next on the Server Connection Mapping screen:

14. Enable the option to save the deployment settings as a deployment profile. Creating a profile is what will make future deployment easier:

15. Click Finish. 16. You will see a progress bar appear while the deployment is occurring. Afterwards, you should see a success message dialog.
2012 Sybase, Inc. Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0 Lab 4 - 21

Lab Workbook 17. Click OK to close that dialog. If the deployment is not successful, look at the Problems view in order to troubleshoot. 18. Select the Enterprise Explorer and navigate to the packages folder in Unwired Server. Your deployed MBOs should appear as follows:

19. In the WorkSpace Navigator, open the file ProjectSAP.profile. This was one of the artifacts created by enabling the checkbox in the previous steps above. Go to the configuration tab of the editor. There you will see what packages are to be deployed and to which Unwired Server they are to be deployed. Notice the buttons to the right that allow you to Add Package(s) and Add Target(s) (Unwired Servers) to be deployed in the future. Also notice the button at the top named Deploy Packages. In the future, instead of walking through all of the wizard screens to deploy these components, all you have to do is open ProjectSAP.profile and click Deploy Packages. Close the editor. 20. In the WorkSpace Navigator, right-click on the ProjectSAP.pkg file. This was also created per the checkbox in the steps above. Notice that you can choose Deploy Packages from the context menu. We are just pointing out different, and easier ways, to deploy your MBOs to the Unwired Server. 21. Close the ProjectSAP project. 22. This completes Lab 4-1.

Lab 4 - 22

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 4: MBO Design, Development and Deployment

Lab 4-2: Creating a SOAP Web Service MBO


Objectives After completing this lab, you should be able to: Description Task outline Create a connection profile to a web service Create a web service MBO

In this lab, you will create a connection profile to a Web Service and a Web Service MBO. 1. 2. 3. Create a SOAP Web Service Connection Profile Create and Test a SOAP Web Service MBO Create and Test an Updatable SOAP Web Service

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 4 - 23

Lab Workbook

Detailed Instructions Task 1: Create a SOAP Web Service Connection Profile


Description As you already know, a Connection Profile is used to access the supported back-end systems (Databases, SAP, Web Services, etc.). Connection profile information is used by the Unwired Workspace to connect to the backend and show objects, in this case a Web Services operations to be used by an MBO. In this task, you will use Unwired WorkSpace to create a connection profile to a Web Service. You will use a publicly available web service. An Internet connection will be required for this lab/task.

NOTE: Understand that public Web Services and REST Web Services (later lab) can be put offline at any time. The important aspect of this lab is to perform and practice the creation of Web Services Mobile Business Objects. It may come to be that the Web Service used in this lab will be decommissioned from a public web site. If this becomes the case, the instructor of this class will direct you to another Web Service to use as the data source for your lab. The techniques and processes are the same, regardless of the Web Service used. If needed, the instructor will first demonstrate the creation of a Web Service MBO using what is currently available publicly. Procedure 1. In the Enterprise Explorer view, right-click the Web Services folder and select New. 2. The Connection Profile wizard appears. Enter StockWS for the name of the connection profile:

3. Click Next. 4. Select From URL: and enter the stock service WSDL URL: http://www.restfulwebservices.net/wcf/StockQuoteService.svc?wsdl. 5. Do not select to authenticate.

Lab 4 - 24

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 4: MBO Design, Development and Deployment 6. Click Test Connection. You should get a successful message box returned:

7. If connection does not succeed, make sure you have connectivity to the internet or that the URL is spelled correctly. Try again and then click Next. The Summary page appears. 8. Click Finish. 9. The new connection profile shows in the Web Services folder of the Enterprise Explorer view. Right-click on the connection profile and select Connect.

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 4 - 25

Lab Workbook 10. You should now see the Web Service and its methods listed and therefore available:

11. Expand the service and view its contents for a few minutes to get familiar with the services operations. You can always modify connection properties by right-clicking the name of the connection profile and selecting the Properties option. 12. This completes Task 1.

Task 2: Create and Test a SOAP Web Service MBO


Description In this task, you will create and test a Web Service MBO. You will use a function in a Web Service to allow the user to enter a Stock Symbol (String) code, whereby the Web Service returns a complex structure containing many elements such as last price, high, low, etc. 1. Now that you have successfully created the Web Services connection profile and can connect to the service, you will begin building the web service-based MBO. Make sure that you have your Diagram Editor project opened. 2. Create a new Mobile Application Project named ProjectSOAP.

Procedure

Lab 4 - 26

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 4: MBO Design, Development and Deployment 3. In the Enterprise Explorer view, highlight the GetStockQuote operation and drag it to an open area in the Diagram editor. The MBO creation wizard starts. The first window prompts for one of two choices: Attributes or Operation. The returned values from the Web Service will populate the attributes of your MBO. Select Attributes:

4. Click OK. 5. The wizard will now take you through the steps of defining all the attributes in the Web Service. Note that you can change the method you want to use in the New Attributes dialog. You can specify the binding as well and change the URL. Expand the Result Set Filters arrow and click the Preview button:

6. A Preview window appears. Enter a stock symbol of your choice (e.g. SAP, BAC, INTC) and click Preview. Ignore the warning message that is displayed. 7. Click OK.

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 4 - 27

Lab Workbook

8. As you can see, the Web Service returns data pertaining to the stock symbol entered. Review the data. There are some columns (eg. MBO attributes) that we will remove as part of this exercise. In the next steps, you will learn how to remove attributes from the Web Services response. Click OK to close the preview dialog. 9. On the New Attributes window, select the existing XSLT item:

10. Click Edit. It will launch the Define XSLT window. XSLT is a powerful extension of the XML technology language that is used to transform XML data. XSLT gives you quite a bit of flexibility in terms of what data you want displayed and how the data can be displayed. 11. You will now streamline the response data by removing unwanted attributes. 12. Click the Generate XSLT from response. Radio button.

Lab 4 - 28

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 4: MBO Design, Development and Deployment 13. Disable the following message elements: a. High b. Low c. MktCap d. PreviousClose e. AnnRange f. Earns g. PE

14. On the above dialog, notice that you can also edit the XSLT document manually. However, it is much easier and quicker to use the graphical method to add or remove MBO attributes. Click OK. 15. Before completing, test preview your response again. The attributes displayed should only include those attributes you specified in the XSLT document. 16. Click OK to close the Preview window. 17. Click Next. The Parameter Mapping window appears. There is nothing you should perform here. Leave at the defaults. 18. Click Next. The Attribute Mapping window appears. Leave the defaults. Click Next. The Roles Assignments window appears. We will not be assigning specific roles in this class. 19. Click Finish. You should now have a new Web Services MBO in your project:

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 4 - 29

Lab Workbook

20. Save your work.. 21. Deploy the MBO as you were shown in lab 4-1. Deploy as Replication-based. You will have to create a new server connection mapping as part of the deploy process. 22. Click OK when deployment successful message box appears. Your new MBO is now running on the Unwired Server, ready to be used by a mobile application. 23. This completes Task 2, Lab 4-2.

Lab 4 - 30

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 4: MBO Design, Development and Deployment

Lab 4-3: Creating a REST Web Service MBO


Lab setup Objectives You must complete all previous labs. After completing this lab, you should be able to: Description Create a REST Web Service Connection Profile Create a REST Web Services MBO

In this lab, you will begin by creating a REST Web Service Connection Profile. Then, you will use the connection profile to create a REST Web Services MBO. 1. 2. Create a REST Web Service Connection Profile Create and Test a REST Web Service MBO

Task outline

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 4 - 31

Lab Workbook

Detailed Instructions Task 1: Create a REST Web Service Connection Profile


Description In this task, you will begin by creating a REST Web Service Connection Profile for your REST MBO. 1. Create a new Mobile Application Project by selecting File New Mobile Application Project. 2. Name your project: Yahoo_LocalSearch. 3. Go to the Enterprise Explorer view and right-click the REST Web Services folder. 4. Select New. The Connection Profile wizard appears. 5. Enter the name Yahoo_LocalSearch and add a description (optional):

Procedure

6. Click Next. 7. In order to get a valid URI, you will need to convert the sample URL provided by Yahoo. Navigate to: http://developer.yahoo.com/search/local/V3/localSearch.html (Case sensitive). The web site appears as follows:

Lab 4 - 32

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 4: MBO Design, Development and Deployment

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 4 - 33

Lab Workbook 8. Scroll down to the sample Request URL:

9. Back on the Connection Profile wizard screen, enter http://local.yahooapis.com as the Resource base URL. At the top of the dialog, you will see an error message stating that a Resource URI template is missing. 10. Click Add to create a Resource URI template. You will create the URI template location for the referenced Resource base URL noted above. Enter the following for the Resource URI template (no spaces): /LocalSearchService/V3/localSearch?appid={myAppID}&query={query}& zip={zip}&results={results}

11. Click Next. The Summary screen appears:

Lab 4 - 34

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 4: MBO Design, Development and Deployment

12. Click Finish. A new REST Web Services profile listed in your Enterprise Explorer:

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 4 - 35

Lab Workbook 13. Right-click the Yahoo_LocalSearch profile and select Connect. When connected, the Enterprise Explorer should look similar to the following:

14. This completes Task 1.

Task 2: Create and Test a REST Web Service MBO


Description In this task, you will learn how to create a REST Web Services MBO using the profile you have just completed. We will use a different approach to the creation of the MBO by using the Palette. 1. Create a new Mobile Application Project and call it Yahoo_LocalSearch. Open the Mobile Application Diagram Editor. 2. Go to your Palette and select the Mobile Business Object icon, then click on an empty area anywhere in your Diagram Editor. This launches the MBO Creation wizard.

Procedure

Lab 4 - 36

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 4: MBO Design, Development and Deployment 3. Enter mboYahoo_LocalSearch for the name. Add a comment if you like:

4. Click Next. The Data Source window appears. 5. Specify REST Web Service. If you had several profiles created for a REST Web Services, all profiles would be listed. In our case, we have only the Yahoo_LocalSearch connection profile, so it is automatically selected:

6. Click Next. The Definitions window appears. 7. Make sure that the base URL is: http://local.yahooapis.com. 8. Make sure that the Resource URI template uses: /LocalSearchService/V3/localSearch?appid={myAppID}&query={query}&zip= {zip}&results={results} 9. The HTTP Method should be set to GET. 10. Leave the Expected status code as 200.
2012 Sybase, Inc. Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0 Lab 4 - 37

Lab Workbook 11. Click the Response checkbox, leave the Response name as responseRep and click the Edit button. The Define Representation window opens. 12. Select XSD URL and enter: http://local.yahooapis.com/LocalSearchService/V3/LocalSearchResponse.xsd

13. Click the Load Elements button. 14. Select the Root Element from dropdown list and an XSLT1 definition will be created, as shown in the screen shot above.

Lab 4 - 38

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 4: MBO Design, Development and Deployment

15. You can double-click the XSLT1 item to view its properties:

16. Note that you have a choice to create the style sheet manually or visually by selecting the desired elements. Click OK to close the properties page when you finish reviewing the contents. 17. Click OK again to get back to the Definitions window. 18. Click the Preview button and enter the following values: a. pizza (for query) b. YahooDemo (for myAppID)
2012 Sybase, Inc. Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0 Lab 4 - 39

Lab Workbook c. 2 (for results) d. 94568 (for zip) 19. Enable Save as default values (Must enable this so that the service MBO completes)

20. Click the Preview button and then OK to the warning dialog. The results will appear:

Lab 4 - 40

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 4: MBO Design, Development and Deployment

21. Click OK to close the Preview dialog. 22. Click Next to review your Parameter Mappings:

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 4 - 41

Lab Workbook 23. Note that the default values carried across. There is nothing else you need to do here. Click Next. Your Attribute Mapping window appears:

24. All the mappings have been completed for you. Take a look and then Click Next.

Lab 4 - 42

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 4: MBO Design, Development and Deployment

25. Click Finish. The completed MBO should look as follows:

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 4 - 43

Lab Workbook

26. Save your work. 27. This completes Task 2, Lab 4-3.

Lab 4 - 44

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 4: MBO Design, Development and Deployment

Lab 4-4: Creating a Database-driven MBO


Objectives Description Task outline After completing this lab, you should be able to: Create a MBO based from a relational database In this lab, you will create MBOs that are based on a relational database 1. 2. 3. 4. Create Database-driven MBOs Create Relationships between MBOs Create Personalization Keys Use Load and Synchronization Parameters

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 4 - 45

Lab Workbook

Detailed Instructions Task 1: Create Database-driven MBOs


Description Procedure In this task, you will use the provided Sample Database to create some MBOs. 1. If you are still connected to My Sample Database, skip this step. In the Enterprise Explorer view, right-click on the My Sample Database connection profile and select Connect. 2. Expand the sampledb database and browse down to the Tables folder. 3. Locate the customer table. You will create this MBO using the Quick Create option drag and drop the customer table to the Mobile Application Diagram editor. It will then display a dialog with a default SQL Statement and gives you options (checkboxes) to build create, update, and delete operations. 4. Name your MBO mboCustomer:

5. Note that the generated SQL statements are based on the customer table schema definition. You can customize the SQL statements and other MBO properties after the MBO is created.

Lab 4 - 46

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 4: MBO Design, Development and Deployment 6. In the Definitions column, select the DELETE FROM operation definition. Operation parameters are mapped to arguments in the INSERT, UPDATE, and DELETE statements for create, update, delete operations. Click the ellipsis button and take note of the generated DELETE statement used for the MBO:

7. You may want to view the other definitions to become acquainted with the syntax being used to execute any of the three operations. 8. When finished, click OK. 9. The Mobile Application Diagram view will display the newly created MBO called mboCustomer. 10. However, the MBO Creation wizard created a perfectly matching MBO to the database table. We want the capability for the device user to see only customers for a given state, one that the device user specifies. To do this, we will need to add a WHERE clause to the SQL and also use a Personalization Key, so that only records specified by user input will display on the device. First, we will need to add an argument, which we will call State_Code, in a WHERE clause. To do so, click the Attributes tab in the Properties page and select the Definition sub-tab. Then click the Edit button. This will launch the Change Definition dialog:
2012 Sybase, Inc. Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0 Lab 4 - 47

Lab Workbook

11. You have two ways in which you can add your WHERE clause and the argument. You may code in the WHERE clause manually or use the graphical tool Visual SQL. You will use the graphical tool. 12. Click the Visual SQL button. 13. In the WHERE clause section (tab at the bottom) of the Visual SQL editor, select the state column and the equals operator. Well be using an argument as the Value, so we will need to enter the appropriate syntax using the colon keyword: :State_Code

Lab 4 - 48

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 4: MBO Design, Development and Deployment 14. Review your code in the Preview section of the dialog and then click OK.

15. You should now see your completed WHERE clause in the SQL Query textbox. 16. Click OK. Since you have changed your MBO definition, Unwired WorkSpace will prompt you to refresh or remap your MBO. Select Yes. 17. You are now ready to create another MBO called mboSales_Order. 18. This time, go to the Mobile Application Diagram Palette, click on Mobile Business Object and click again on the diagram to begin the process/wizard:

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 4 - 49

Lab Workbook

19. The MBO wizard will appear. Name your MBO mboSales_Order and add a comment, if you prefer:

20. Click Next.

Lab 4 - 50

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 4: MBO Design, Development and Deployment 21. Select JDBC for the data source type:

22. Change the data source to My Sample Database.

23. Click Next.

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 4 - 51

Lab Workbook

24. At this point, you may elect to enter a SELECT statement manually or call a stored procedure using the SQL Query textbox. We will be using the Visual SQL graphical tool to build our SQL query. Click the Visual SQL button. This will launch a graphical query builder that will assist you in creating the SELECT statement for the MBO data extraction:

Lab 4 - 52

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 4: MBO Design, Development and Deployment 25. Select the sales_order table and click Open. This will launch the SQL Editor:

26. Select all the columns listed in the sales_order table. This action will add each to the returned result of the query. Note that the order in which you select the column affects the order in which the column appears in the SELECT statement. 27. Lets add another table to our MBO to illustrate the possibility of using joins inside a single MBO. NOTE: You can create a third MBO for the data in a third table. Creating a unique MBO per table data is the preferred method, since you can use relationships (to be seen later in this lab) to join the three MBOs later. From the perspective of data synchronization after updates and deletes, creating an MBO to represent a single table works best. But for the purposes of illustrating the capability, we will create an MBO with a join to two tables. 28. Go to the Design menu and choose Select tables 29. Select the sales_order_items table. 30. Click Open.

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 4 - 53

Lab Workbook

31. Note that the join between the two tables was automatically created. Add the quantity and ship_date columns to your query. Also note that the wizard has thus far created the following SQL Query: SELECT sales_order.id, sales_order.cust_id, sales_order.order_date, sales_order.fin_code_id, sales_order.region, sales_order.sales_rep, sales_order_items.quantity, sales_order_items.ship_date FROM sales_order, sales_order_items WHERE ( sales_order_items.id = sales_order.id )

Lab 4 - 54

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 4: MBO Design, Development and Deployment 32. To test and display the data retrieved from your query, go to the Design menu and select Execute. This will display the result set in the Results tab in your Preview view:

33. You can add more complexity to your MBO by adding more SQL to the query. We will be further manipulating this MBO later in the lab. For now, click OK. Your dialog box should appear as follows:

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 4 - 55

Lab Workbook

34. Click Validate Syntax or Preview to validate your syntax or see your results so far. 35. Click Next. 36. The next screen is the Parameters screen. If your MBO contains a parameter, it will be shown here. At this time, we will have no parameters defined. Click Next. 37. The Attributes Mapping screen contains all of the attributes in your select statement. Remember that an attribute in an MBO is a mapping to a data column in the table definition. Not all attributes map to an existing column, such as in the case of a computed attribute, etc. However, essentially an attribute maps to a table column:

Lab 4 - 56

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 4: MBO Design, Development and Deployment

38. If you had several result sets, they would be listed in the dropdown to be selected and their mappings displayed. This is also the area where you can add additional information to your MBO, such as allowing NULLs, etc. Leave the mappings as they were automatically generated by your SQL query and click Finish. Your new MBO appears as follows:

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 4 - 57

Lab Workbook

39. Your mboSales_Order MBO does NOT have any operations assigned to it. At this stage, how would you add the update( ), delete( ) and create( ) operations? _________________________________________________________________ _________________________________________________________________ _________________________________________________________________ _________________________________________________________________ _________________________________________________________________

40. Add the create, update and delete operations to the mboSales_Order. Once you have added the three operations, your MBOs should appear as follows:

Lab 4 - 58

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 4: MBO Design, Development and Deployment

41. This completes Task 1.

Task 2: Create Relationships Between MBOs


Description In this lab, you will create relationships between your two MBOs. The purpose of a relationship is to associate related data, so that relevant data is synchronized together to the device. 1. To define a relationship between mboCustomer and mboSales_order, click the Relationship tool in the tool palette in the Mobile Application Diagram and then click on mboCustomer. While keeping the left mouse button pressed, drag the link from mboCustomer to join to the mboSales_order. The Relationship diagram appears.

Procedure

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 4 - 59

Lab Workbook 2. In the relationship dialog, click the id attribute in mboCustomer. Drag to the cust_id attribute in mboSales_order. Make sure that you have selected a one-to-many relationship and define the relationship as Bi-directional:

Lab 4 - 60

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 4: MBO Design, Development and Deployment 3. Click Finish. You should see the one-to-many relationship symbol in your diagram:

4. You have just completed the relationship between your MBOs. 5. This completes Task 2.

Task 3: Create Personalization Keys


Description In this lab, you will create a Personalization key for the customer state attribute. This key will be used later as a means by which the device can get input from the user and retrieve only those records that satisfy a condition. You will see that personalization keys are closely associated with a WHERE clause in the SQL query. 1. Right-click the Personalization Keys folder in your WorkSpace Navigator. Select New Personalization Key:

Procedure

2. The Personalization Key Creation wizard appears. 3. Name the key p_State_Code.
2012 Sybase, Inc. Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0 Lab 4 - 61

Lab Workbook 4. Set the key to type: STRING(2) and uncheck Nullable. 5. Set a default value of CA. This will allow you to see data (CA customers) as soon as you start your application. 6. You have three choices for Storage: Client, Server, or Transient. Set the Storage type to Server:

7. Click Finish. 8. You have just completed your first Personalization Key. 9. This completes Task 3.

Lab 4 - 62

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 4: MBO Design, Development and Deployment

Task 4: Use Synchronization / Load Parameters


Description In this lab, you will learn how to create Synchronization and Load parameters by using your newly created Personalization Key. If you recall, Synchronization and Load Parameters are created in the Properties view of the MBO. These parameters give you the means by which you can define how data is loaded to the device and synchronized. 1. Select mboCustomer and view the MBOs properties sheet. NOTE: If you do not see the Synchronization tab, switch to the Advanced Developer profile by right-clicking anywhere in the Diagram Editor and then selecting Switch Developer Profile:

Procedure

2. You should be able to see the Properties view for the mboCustomer MBO. In the properties view, make sure you are in the Attributes tab. 3. Next, select the Load Parameters sub-tab. If you recall, State_Code is a parameter that was defined and used in the WHERE clause. The load parameters are automatically created when an MBO has something like a WHERE clause with dynamic values.

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 4 - 63

Lab Workbook 4. The load parameter will need to be given a value via a Personalization Key, a Synchronization Parameter, or a default value. Use the p_State_Code Personalization key for the value:

5. Make sure the data types (including length) and null-ability match. 6. Now, we will add a Synchronization parameter. 7. Select the Synchronization tab and click Add. 8. Name your synchronization parameter sync_param and assign its value to the p_State_Code personalization key:

9. Make sure that the data type and null-ability match. 10. Map your Synchronization parameter to the state column. Remember that the goal of our Synchronization parameter is to receive the value in our Personalization Key by way of user input and pass it to the state columns parameter in the underlying query. 11. Check Query Limiting so that every time the device synchronizes, your data will be limited to the input value in the p_State_Code Personalization Key. 12. This completes Task 4. Go to your menu and select File Save All.

Lab 4 - 64

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 4: MBO Design, Development and Deployment

Optional:

13. If you want to synchronize the Synchronization and Load Parameters, you can do so easily by pairing the Load Parameter State_Code with the Synchronization Parameter sync_param. This will indicate to the MBO that the user will supply values for this parameter over time. The result of this technique is that, the aggregate set of data, based on the values provided over time by the user, will be synchronized with the device. In other words, youll get a running list of customers by the states requested by the user up to any point in time. 14. To do this, connect the sync_param Synchronization Parameter to the State_Code Load Parameter as follows:

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 4 - 65

Lab Workbook

15. Notice that as soon as you associate the Synchronization parameter with the Load parameter, the Personalization Key association is removed. Obviously, you can not implement both methods on the same object you must choose which is best for your needs. If you decide to do these optional steps, recall during the testing of the application on the device that your data will be aggregated over time. In other words, youll see CA customers and then any other customers filtered by the state code entered on the device. 16. Go to your menu and select File Save All. 17. This completes Task 4, Lab 4-4.

Lab 4 - 66

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 5: Introduction to Mobile Workflow Application Development

Module 5: Introduction to Mobile Workflow Application Development

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

Lab setup

Make sure that your BlackBerry simulator software and Sybase Unwired Platform is successfully installed, and that all services running on your system before you begin this lab. After completing this lab, you should be able to: Create the Device-initiated workflow application database and workflow associated objects in the database Set up database connectivity using a connection profile Create a Mobile Workflow Form Use the Flow Designer to create the workflow screens Create custom screens using UI elements from the palette, and bind keys to MBO attributes Generate and test the workflow application on a BlackBerry device simulator

Objectives

Labs Use Case Scenario

The courses Hybrid Web Container-based mobile workflow application is designed to support employees by giving them a mobile workflow that allows them to request vacation time and have their managers approve the time. You will be using a BlackBerry simulator device as the target for the mobile workflow. Business requirements: Reduced vacation request turnaround time by supporting remote vacation requests, sybCompany can decrease vacation request approval wait times and thereby offer superior employee support. Reduced maintenance and simplicity the workflow must easily deploy with little or no employee intervention. The employee user base is not tech-savvy and does not like to spend time troubleshooting or self-supporting. Secure transactions care must be taken to authenticate not only the employee, but also to secure the transmission of confidential internal data across the wireless network by the approving manager.

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 5 - 1

Lab Workbook Dual mode operation employees occasionally travel to remote areas as part of their daily routine. Consequently, mobile network access can be unreliable. Employees should be able to create and/or approve vacation requests offline and then have the request creation/approval sent to the corporate servers when online access becomes available using built-in Sybase Unwired Platform technology. Server-initiated notification Managers designated to approve vacation requests should receive approval request notifications via email as part of their normal, day-today process of checking e-mail, they should not be required to check a separate location for approval requests.

Description

In this lab, you will be introduced to Sybase Unwired Platform mobile workflow application development. There are several tasks that you must perform as a designer e.g. database tables and email trigger creation before you begin actual mobile application development to satisfy the requirements above. In this first lab, you will learn the basics of a mobile workflow application by creating the device-initiated workflow application to be deployed to a user of a BlackBerry 9800 device (simulator in class). The following lab will introduce you to the development of a serverinitiated mobile workflow application, whereby you will use a Windows Mobile emulator set up with client email in order to receive the server-initiated workflow notification. In order for the email notification process to be complete, you will also create mailbox accounts for your application using a free email server: MailEnable Standard. Before and after deploying both the MBOs and the Workflow application to Sybase Unwired Server, you will administer the email server and the user devices in the Sybase Control Center. Both these labs are designed to be completed together so as to give you a broad view of the Sybase Unwired Platform mobile workflow application development capabilities.

Task outline

1. 2. 3. 4. 5. 6. 7. 8.

Review the Vacation Request Use Case and Add Email User Accounts Set Up Ancillary Lab Components BlackBerry Simulator Start and Configure Sybase Control Center for Workflows Create the Device-Initiated Project and Workflow Database Tables and Trigger Create the Vacation Request Workflow Project MBOs Deploy Mobile Workflow Application MBOs Create the Device-Initiated Mobile Workflow Application Interface Generate and Test the Device-Initiated Mobile Workflow Application

Lab 5 - 2

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 5: Introduction to Mobile Workflow Application Development

Detailed Instructions

Task 1: Review the Vacation Request Use Case and Add Email User Accounts
Description Whenever you set out to perform development, you should always have all the ancillary components prepared and functioning. To this end, we will need to review the general requirements for the Vacation Request use case and create mailbox user accounts for the server-initiated portion of the workflow using a free Email Server Mail Enable. 1. Make sure to review the business requirements above for the Vacation Request workflow application. 2. Sybase Education uses Mail Enable Standard Edition, a free Email Server product for this lab. The server is already installed on your system. You will need to launch the server administration console to configure three mailbox users for the next two labs: employee, boss, and trafficcop. 3. To insure that the Mail Enable Server does not conflict with other SMTP services, you should stop the standard SMTP services by going to the Services applet in Administrative Tools. Stop all SMTP services currently running:

Procedure

Mail Enable Email Server Mailbox Account Creation

4. Then, go to Start Programs Mail Enable MailEnable Administrator.

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 5 - 3

Lab Workbook 5. Once the administration application is launched, expand the Messaging Manager node and navigate to the Mailboxes folder:

6. Right-click the Mailboxes folder. Select New Mailbox or simply click the Create Mailbox link:

7.
Lab 5 - 4

We will first create the employee mailbox. In the General tab, enter employee for the Mailbox Name.
Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0 2012 Sybase, Inc.

Module 5: Introduction to Mobile Workflow Application Development 8. Enter a Password of sybase. 9. Leave the rest of the General tab properties at their defaults. Make note of the user name:

10. Click the Addresses tab.

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 5 - 5

Lab Workbook 11. Enter a Friendly name: employee. Make note again of the full email alias stem for these accounts ( [name]@education.sybase.com):

NOTE: Take note of the SMTP email address for each of the accounts. This information will be necessary when you set up a custom trigger in the database in the Unwired WorkSpace.

Lab 5 - 6

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 5: Introduction to Mobile Workflow Application Development 12. Click the Messages tab and note that there will be a default email already in the mailbox sent by the mail server. This is a welcome email and can be used later to test email connectivity on the device emulators:

13. Click OK. You have just completed your first email user account to be used by the Vacation Request mobile workflow application (requester of vacation time approvals). 14. Repeat the previous steps to create the boss mailbox. Your General tab should look like the following. Mailbox password should be sybase and friendly name should be boss:

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 5 - 7

Lab Workbook

15. Click OK when you have completed defining the boss mailbox. 16. Repeat the previous steps again to create the trafficcop mailbox account. Your general tab should appear as follows. Mailbox password should be sybase and friendly name should be trafficcop:

Lab 5 - 8

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 5: Introduction to Mobile Workflow Application Development

17. Click OK when you have completed defining the trafficcop mailbox. 18. Your Mailboxes folder should appear as follows (Postmaster is a default mailbox and will not be used in the lab):

19. Exit the Mail Enable Administration Console or minimize it.


2012 Sybase, Inc. Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0 Lab 5 - 9

Lab Workbook 20. This completes Task 1.

Task 2: Set Up Ancillary Lab Components BlackBerry Simulator


Description In this task, you will set up any pre-requisites for this first lab - such as the BlackBerry simulator setup.

Procedure

1. Let us begin by insuring that all required services are running on your system. Check to verify that the Sybase Control Center Service has been started by accessing the Services utility in Windows Administrative Tools.

BlackBerry Simulator

2. Next, set up and start the BlackBerry 9800 simulator. To install and configure the mobile workflow hybrid web container files you will later generate onto a BlackBerry device or simulator, you must first perform the following: Locate required Unwired Platform files Copy required files to appropriate device/simulator folder Load MDS and the BlackBerry simulator

Lab 5 - 10

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 5: Introduction to Mobile Workflow Application Development 3. Launch Windows Explorer. 4. Browse to the following directory: <UnwiredPlatform_InstallDir>\UnwiredPlatform\ClientAPI\ MBS\BB\MoMessaging 5. Locate the following five BlackBerry .cod files: CommonClient.cod MessagingClientApp.cod MessagingClientSettings.cod MocaClient.cod WorkflowResources.cod

6. Copy these files to the following Research In Motion folder: c:\Program Files\Research In Motion\BlackBerry JDE 6.0.0\simulator

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 5 - 11

Lab Workbook 7. Now, let us launch the MDS services. Go to Start Programs Research In Motion BlackBerry JDE 6.0.0 MDS-CS:

8. The MDS service should have started and is waiting for messages:

9. Now, launch the actual BlackBerry 9800 simulator. Select Start Programs Research In Motion BlackBerry JDE 6.0.0 Device Simulator. Allow a few minutes for the simulator to launch and load all the required files. The first launch of the BlackBerry simulator may take a few minutes approximately 5 minutes. 10. Click OK to the license agreement you may have to scroll the text to see the OK button. You should see a Setup window similar to the following:

Lab 5 - 12

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 5: Introduction to Mobile Workflow Application Development

11. Go ahead and exit the setup application by selecting the Menu button and selecting Close:

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 5 - 13

Lab Workbook

12. Click the Dont show again option and then click Exit. Your home screen should appear as follows:

Lab 5 - 14

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 5: Introduction to Mobile Workflow Application Development

13. For now, minimize your simulator. We will return to it later after you complete your device-initiated mobile workflow application. 14. This completes Task 2.

Task 3: Start and Configure Sybase Control Center for Workflows

Description

In this task, you will use the Sybase Control Center to create the two device users for the mobile workflow application, enable workflow Inbox Notification for the next lab and then return to Unwired WorkSpace to develop your device-initiated part of the mobile workflow application. 1. Start Sybase Control Center by double-clicking the Sybase Control Center desktop icon or by navigating Start Programs Sybase Sybase Control Center. Log into the Sybase Control Center using the default administrator login credentials: User Name: supAdmin Password: s3pAdmin
Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0 Lab 5 - 15

Procedure

2012 Sybase, Inc.

Lab Workbook

2. In Sybase Control Center, select the Applications node and click the Application Connections tab:

3. Click the Register... button and specify the following properties for the device user: employee: Property User: Template: Server name: Value The device user name is employee Ensure default is selected. Enter the machine name where the Unwired Server is running on including the full domain name such as dev803[hostname].education.sybase.com Default value is 5001 Default value is 0. This is used when connecting through a proxy server. Select HWC to use the template for a Hybrid Web Container. Select admin. Select the domain for which the application connection should be registered. 3 Enter 72. This is the number of hours that the activation code is valid. Select and enter 123

Port: Farm ID: Application ID: Security Configuration: Domain: Activation Code Length: Activation expiration (hours): Specify activation code

Lab 5 - 16

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 5: Introduction to Mobile Workflow Application Development

4. Click OK to register an Application Connection and confirmation message appears on the Application Connection tab. You can filter Application Connections by User, Device Type, Device ID, etc. using the Search field:

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 5 - 17

Lab Workbook 5. Repeat the registration steps for the device user boss:

6. Click OK. 7. Now, let us prepare the boss device user with a Custom setting so that it can receive a notification email by the Mailbox Notification feature (Mailbox Notification setup to follow). Select the boss device user and click the Properties button.

Lab 5 - 18

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 5: Introduction to Mobile Workflow Application Development 8. Select the Custom Settings tab and set the value of Custom1 to boss as shown below:

9. Click OK. 10. Take note of the Workflows button by which you can assign a workflow to a device user:

11. At present, because we do not have any workflows deployed to the Unwired Server, this option is not useable. Well come back to this after the workflow development and deployment part of the lab is completed. 12. Lets configure the Notification Mailbox. In Sybase Control Center, select the Workflows node, and then select Notification Mailbox tab to specify the following properties:
2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 5 - 19

Lab Workbook

Property Enable Server

Value Click this checkbox and mailbox parameters are displayed. Enter the machine name where the e-mail server resides. Can use localhost or full host name, such as dev803.education.sybase.com The special e-mail address used when a mobile workflow e-mail message is sent. In this example the e-mail address is trafficcop The password for this e-mail account: sybase

User name

Password

13. Now, select Add in the Distribution Rules list area.

Lab 5 - 20

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 5: Introduction to Mobile Workflow Application Development 14. Define the Email attribute as TO, the operation will be Contains and the Device property will be Custom 1.

15. Click OK. 16. The above settings specify that every Vacation Request will go through the trafficcop Email Notification and an email notification will be sent by the Notification Mailbox to the device whose Custom 1 property matches the TO field in the Requesters original e-mail. In our case, request notifications will be sent to the boss device user email account. 17. Let us test our notification feature. Click the Test icon. You should receive a successful configuration message as follows:

18. Make sure that you save any required changes and then minimize your Sybase Control Center window.

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 5 - 21

Lab Workbook Activating the DeviceInitiated User: employee 19. Now that we have created our device users, we are ready to activate the user on the BlackBerry device simulator. Return to your BlackBerry simulator. 20. Click the main Menu on the simulator and select Open Tray:

21. Navigate to the Options application:

22. Click the Options application and then scroll down to select Third-Party Applications (Sometimes you may need to double-click the simulator buttons or press the mouse button very hard):

Lab 5 - 22

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 5: Introduction to Mobile Workflow Application Development 23. You should now see a Sybase Settings option:

24. Double-click Sybase Settings. The Sybase Connection screen appears. 25. In the Server Name field, enter your hostname + .education.sybase.com (ex. Dev906.education.sybase.com). 26. Server Port is defaulted to 5001. 27. Farm ID is 0. 28. Since we will start by generating a request, we will enter employee for the User Name. 29. Enter 123 for the Activation Code (Recall that you defined the device user and activation requirements in the previous task in the SCC):

30. Click the BlackBerry Main Menu icon and select Save. 31. Click Close:

32. Now, click the Main Menu icon and select Close to leave the Options application. This action returns you to the Tray again. 33. Click the Main Menu icon again and select Close Tray to return to your home screen. Minimize MDS and the BlackBerry simulator. DO NOT close or shutdown the MDS or the simulator.
2012 Sybase, Inc. Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0 Lab 5 - 23

Lab Workbook 34. This completes Task 3.

Task 4: Create the Device-Initiated Project and Workflow Database Tables and Trigger
Procedure 1. Return to Unwired WorkSpace. If the WorkSpace is opened for the first time, make sure that you select C:\Sybase Courses\SUP521\Student for your default project folder. 2. Close all existing projects from your workspace. This will help eliminate any confusion about which project you are currently developing, deploying and/or editing. 3. We will now create our overall mobile workflow project. From the File menu, select File New Mobile Application Project. 4. Name your project VacationRequestWorkflow:

5. Click Finish. 6. Expand your project folders, if they are not already expanded. 7. Lets make sure that you have a connection to the sampledb database using the default connection profile and the Unwired Server. NOTE: You may create your own connection profile specifically for this mobile workflow application, but we are going to use the My Sample Database connection profile for our labs. 8. Go to the Enterprise Explorer and Expand the Unwired Servers folder.
Lab 5 - 24 Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0 2012 Sybase, Inc.

Module 5: Introduction to Mobile Workflow Application Development 9. Right-click the My Unwired Server node and select Connect. You should now have a connection to the Unwired Server established:

10. Expand the Database Connections folder, if not already expanded. 11. Right-click on the My Sample Database connection profile and select Connect. You should be connected to the sampledb database. 12. Go to your WorkSpace Navigator view and expand your project folders, if they are not already expanded. 13. We will now need to import a SQL script that Sybase Education has prepared for you to create your database tables and a trigger for the server-initiated mobile workflow (the server-initiated mobile workflow application will be developed in the next lab). 14. Right-click on your new project folder and select Import.

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 5 - 25

Lab Workbook 15. Expand the General folder and select File System:

16. Click Next. 17. In the Import from File System window, click the Browse button. 18. Navigate to your c:\Sybase Courses\SUP521\Lab Resources folder: 19. Click OK.

Lab 5 - 26

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 5: Introduction to Mobile Workflow Application Development 20. Select the VacationRequests.sql file from the right-side pane:

21. Leave the rest of the dialog at their default settings and click Finish. 22. You should see the VacationRequests.sql file in your Unwired WorkSpace project. You will need to make an adjustment to the machine name in the script. Right-click on the file and select Open With SQL File Editor. The contents of the file should display on your workspace diagram view. 23. Make sure you are still connected to the sampledb via your connection profile. We will now associate the SQL file with our database connection. 24. In the Connection Profile settings in the Diagram view, select Sybase_ASA_12.x for Type, My Sample Database for the Name, and sampledb for the Database:

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 5 - 27

Lab Workbook NOTE: The SQL will create two tables and one trigger for use with your workflow. 99% of the code is written for you. You will simply need to change the code that identifies your machine name. 25. Click the Unwired WorkSpace Save All icon to save your work. 26. Scroll down to the end of the script and locate the following call in the code:
CALL xp_startsmtp('trafficcop@education.sybase.com', 'dev906.education.sybase.com'); /*smtp_sender, smtp_server*/

27. You will need to make one minor change to the email aliases used by the Mailbox Notification feature in the Sybase Control Center. Remember that the Email Notification account will be the workflow email account used as the traffic cop in the SCC. This notification feature will enable the forwarding of messages to the manager who will ultimately approve the request sent by the employee.

28. Change the dev906 machine name to your own machine name. That is all.
29. Below is the SQL script in its entirety as you should have it on your machine, albeit the machine name will differ:
IF EXISTS ( select 1 from sys.systable where table_name='VacationApprovers' and table_type in ('BASE', 'GBL TEMP') and creator=user_id('dba')) THEN BEGIN DROP TABLE dba.VacationApprovers END END IF ; CREATE TABLE dba.VacationApprovers ( appr_id INT NOT NULL, appr_name VARCHAR(100) NOT NULL, appr_email VARCHAR(100) NOT NULL ) ; ALTER TABLE dba.VacationApprovers ADD PRIMARY KEY CLUSTERED (appr_id) ; INSERT INTO dba.VacationApprovers (appr_id, appr_name, appr_email) VALUES (1, 'Boss', 'boss@education.sybase.com' );

IF EXISTS ( select 1 from sys.systable where table_name='VacationRequests' and table_type in ('BASE', 'GBL TEMP') and creator=user_id('dba')) THEN BEGIN DROP TABLE dba.VacationRequests END
Lab 5 - 28 Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0 2012 Sybase, Inc.

Module 5: Introduction to Mobile Workflow Application Development


END IF ; CREATE TABLE dba.VacationRequests ( req_id INT NOT NULL DEFAULT AUTOINCREMENT, requestor VARCHAR(100) NOT NULL, request_type VARCHAR(100) NOT NULL DEFAULT 'Vacation Request', start_date DATE NOT NULL, end_date DATE NOT NULL, total_days VARCHAR(4) NOT NULL, appr_id INT NOT NULL, request_status VARCHAR(10) NOT NULL DEFAULT 'Pending', request_comments VARCHAR(200) NOT NULL ) ; ALTER TABLE dba.VacationRequests ADD PRIMARY KEY CLUSTERED (req_id) ; ALTER TABLE dba.VacationRequests ADD CONSTRAINT FK_Approver FOREIGN KEY ( appr_id ) REFERENCES dba.VacationApprovers (appr_id); ; IF EXISTS ( select * from sysobjects where name='InsertVacationRequestTrigger' and type='TR') THEN BEGIN DROP TRIGGER dba.InsertVacationRequestTrigger END END IF ; CREATE TRIGGER InsertVacationRequestTrigger AFTER INSERT ORDER 1 ON VacationRequests REFERENCING NEW AS vacaRow FOR EACH ROW BEGIN DECLARE getEmailAddressCursor INSENSITIVE CURSOR FOR SELECT appr_email FROM VacationApprovers where VacationApprovers.appr_id = vacaRow.appr_id; DECLARE emailAddress VARCHAR(100); OPEN getEmailAddressCursor; FETCH FIRST getEmailAddressCursor INTO emailAddress; CLOSE getEmailAddressCursor; CALL xp_startsmtp('trafficcop@education.sybase.com', 'dev906.education.sybase.com'); /*smtp_sender, smtp_server*/ CALL xp_sendmail(recipient=emailAddress, cc_recipient='trafficcop@education.sybase.com', subject='Vacation request (' + CONVERT(CHAR(10), vacaRow.req_id) + ') is ready for approval.',); CALL xp_stopsmtp(); END;

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 5 - 29

Lab Workbook IMPORTANT NOTE: Mobile Workflow applications do not support NULL values. You cannot send NULL values from the client to the server. If you attempt to retrieve NULL values from the server, the attempt will fail. Recommend using a default values. We will perform this later, but make sure that all columns in a database are defined as NOT NULL, so that you enforce this requirement on all levels of your application.

30. Note that we are only defining the boss and the trafficcop email aliases in this script. Since the employee account will not receive email notifications to his/her own requests, there is no need to add it to the list. Also note the email alias is a typical email alias and does not include the machine name, but simply the domain name. 31. Save your changes by right-clicking anywhere in the right-side Diagram view (contents of the file) and select Save File or press Ctrl + S:

32. Now, run the revised sql script by right-clicking again in the right-side view and selecting Execute All from the context menu. You will only need to do this ONCE. 33. To verify that your database now contains the two new tables, expand your sampledb Tables folder and look for the following tables: VacationApprovers VacationRequests

Lab 5 - 30

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 5: Introduction to Mobile Workflow Application Development 34. You will note that the database server will also contain and a new trigger object in the VacationRequests table. This trigger will automatically fire whenever a new request is added to the table:

35. Close your SQL Editor. 36. This completes Task 4.

Task 5: Create the Vacation Request Workflow Project MBOs


Description In this task, you will create the MBOs needed for both the device- and server-initiated mobile workflow applications. You will then review what relationships can be created between them, and deploy the MBOs to the Unwired Server before creating the device screens. 1. In WorkSpace Explorer, make sure that you have your sampledb Tables folder expanded. 2. Locate the VacationRequests table. Select the table and drag and drop the table onto the Mobile Application Diagram. 3. In the Quick Create wizard, remove the three operations by un-checking the operations check boxes. You will create the two operations required from scratch, so that you can practice the creation of operations. Accept the rest of the defaults and click OK. 4. You should now see a new MBO in the diagram without operations. You will note immediately that the MBO name and attributes match the table and column names in the database:

Procedure

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 5 - 31

Lab Workbook

5. You will need CREATE and UPDATE operations for this MBO. Lets create the first operation CREATE. Select the operation tool in the toolbox and click on your MBOs operations area. Note that the Operation Definition window appears. 6. Enter create for the Operation name and select the CREATE Operation Type from the dropdown list. 7. Make sure that your Data Source Type is JDBC and lets use the default Connection Profile My Sample Database:

8. Click Next.

Lab 5 - 32

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 5: Introduction to Mobile Workflow Application Development 9. Enter the following SQL into the SQL Query text box:
INSERT INTO VacationRequests ( req_id, requestor, request_type, start_date, end_date, total_days, appr_id, request_status, request_comments ) VALUES ( :req_id, :requestor, :request_type, :start_date, :end_date, :total_days, :appr_id, :request_status, :request_comments)

NOTE: There is a text file Lab-5-1-INSERT_OPERATION_CODE.txt in your Lab Resources folder in C:\Sybase Courses\SUP521\Lab Resources that contains the SQL code. Copy and paste the code into the SQL Editor if you do not wish to type the statement.

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 5 - 33

Lab Workbook 10. Lets validate the SQL by clicking the Validate Syntax button:

11. If syntax validation is successful, click Next.

Lab 5 - 34

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 5: Introduction to Mobile Workflow Application Development 12. Your Parameters mappings should appear as follows and does not require that you make any additional changes:

13. Click Finish. That completes your first manually created MBO Operation. Your MBO Operations section should now appears as follows:

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 5 - 35

Lab Workbook 14. Repeat the previous steps to create the UPDATE operation. Click the Operation tool item again and then click in the Operations area of the VacationRequests MBO. 15. Enter update for the Operation Name and UPDATE for the Operation Type. 16. Select JDBC and My Sample Database for the Data Source Type and Connection Profile, respectively:

17. Click Next. Your Definition window should appear. 18. Enter the following SQL into the SQL Query text box:
UPDATE VacationRequests SET req_id=:req_id, request_type=:request_type, start_date=:start_date, end_date=:end_date,
Lab 5 - 36 Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0 2012 Sybase, Inc.

Module 5: Introduction to Mobile Workflow Application Development


total_days=:total_days, appr_id=:appr_id, request_status=:request_status, request_comments=:request_comments WHERE (req_id = :req_id) AND (request_type = :old.request_type) AND (start_date = :old.start_date) AND (end_date = :old.end_date) AND (total_days = :old.total_days) AND (appr_id = :old.appr_id) AND (request_status = :old.request_status) AND (request_comments = :old.request_comments)

NOTE: There is a text file Lab-5-1-UPDATE_OPERATION_CODE.txt in your Lab Resources folder in C:\Sybase Courses\SUP521\Lab Resources that contains the SQL code. Copy and paste the code into the SQL Editor if you do not wish to type the statement..

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 5 - 37

Lab Workbook 19. Click Next. Your Parameters window should appear as follows:

Lab 5 - 38

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 5: Introduction to Mobile Workflow Application Development 20. Click Finish. Your new Operation should be listed in your VacationRequests MBO Operations section:

21. Now, let us create the MBO for the VacationApprovers table. Since the approvers table is essentially serving as a lookup table for the Boss and his/her email address, we will not need to create any operations for this MBO. 22. Make sure that you are still in your diagram view. In your Enterprise Explorer, expand your Tables folder for your sampledb database.

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 5 - 39

Lab Workbook 23. Locate the VacationApprovers table:

24. Drag and drop the table to your Mobile Application Diagram. The Quick Create window appears.

Lab 5 - 40

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 5: Introduction to Mobile Workflow Application Development 25. Uncheck the CREATE, UPDATE, and DELETE operations that the wizard would otherwise generate for you:

26. Click OK.

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 5 - 41

Lab Workbook 27. In the blank area of your Flow Diagram view, right-click and select Arrange All, so that your MBOs are more neatly arranged:

28. Your Mobile Application Diagram view should now contain a new MBO and appear as follows:

Lab 5 - 42

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 5: Introduction to Mobile Workflow Application Development

Creating the Relationships between MBOs

29. Let us now create a one-to-many relationship between the two MBOs one manager receives many requests. Select the relationship tool in the toolbox and then click on the VacationApprovers MBO while keeping the mouse button down drag the relationship line into the VacationRequests MBO. 30. Release the mouse button and the New Relationship dialog window appears. Select the One to Many relationship radio button we want multiple requests to be approved by a single manager. 31. Check Composite and check Bi-directional. 32. Now, select the little orange box to the right of the appr_id attribute in the VacationApprovers table, and then click in the appr_id attributes orange box on the right-hand side. You will note that a blue line will become visible as you begin to drag it to the right-hand side. 33. Click Finish. You have just created your relationship between the two MBOs:

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 5 - 43

Lab Workbook

34. Save your changes. You have completed the MBO development portion of the labs. 35. This completes Task 5.

Task 6: Deploy Mobile Workflow Application MBOs


Description In this task, you will deploy the VacationRequestWorkflow MBOs to the Unwired Server. You will then finalize the administration of the Workflow application using the Sybase Control Center. 1. Right-click the VacationRequestWorkflow project folder and select Deploy Project:

Procedure

Lab 5 - 44

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 5: Introduction to Mobile Workflow Application Development

2. Make sure the package namespace is set to VacationRequestWorkflow. Recall that there cannot be any conflicts between an MBO name and the package name. 3. Set the package to Message-based. 4. Select the Replace radio button. At this stage, since its the first deployment, it doesnt have an impact. However, you cannot have two packages by the same name and version deployed to the Unwired Server, so this makes sense if you are testing your package:

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 5 - 45

Lab Workbook

5. Click Next. 6. Select all checkboxes to deploy all MBOs:

Lab 5 - 46

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 5: Introduction to Mobile Workflow Application Development

7. Click Next. 8. Click the Refresh button and then select My Unwired Server. Make sure that your Domain and Security configurations are appropriate:

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 5 - 47

Lab Workbook 9. The Server Connection window appears. Select the My Sample Database connection profile for the sampledb database. 10. Click anywhere in the Server Connections Properties area to display the database connection properties:

11. Click Next. The Deployment Profile window appears.

Lab 5 - 48

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 5: Introduction to Mobile Workflow Application Development 12. Click Finish. Deployment execution dialog appears:

13. When deployment is completed, you will see a status dialog:

14. Click OK to the Status dialog which will complete the deployment process. If there are errors generated and reported, you will need to investigate by carefully reviewing all the previous tasks and steps. Save your work, if necessary. Special Note: 15. Now, return to the SCC and select the Applications node and click the Application Connections tab. 16. From the list of device users, note the status of each of the devices:

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 5 - 49

Lab Workbook 17. If this were a production environment, you would have set in the SCC that each device user has 72 hours to activate the device with Sybase Unwired Server. If a user does not activate the device within the allocated period of time, the administrator of the application would have to re-register the device in the SCC. Once the device user is activated again, its status will become pending again and then active when activation occurs from the device itself via the Sybase Messaging Client utility. 18. This completes Task 6.

Task 7: Create the Device-Initiated Mobile Workflow Application Interface


Description In this task, you will explore the creation of mobile workflow application screens using the Mobile Workflow Forms Editor. The device-initiated workflow will use a BlackBerry simulator. Later, you will build the server-initiated workflow and you will use a Windows Mobile 6 Professional emulator, so that you can have both the deviceinitiated and the server-initiated workflows running at the same time. This is very useful when testing the entire workflow process from request to approval. 1. In the WorkSpace Navigator, right click on your project folder and select New Mobile Workflow Forms Editor:

Procedure

2. Name your workflow VacationRequest and make sure that your parent folder is selected and set to VacationRequestWorkflow:

Lab 5 - 50

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 5: Introduction to Mobile Workflow Application Development

3. All workflow applications have a file extension of xbw. Click Next. 4. Since we are only going to create a device-initiated workflow, select the Can be started, on demand, from the client:

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 5 - 51

Lab Workbook

5. Click Finish. The Unwired WorkSpace generates a shell for your mobile workflow application. 6. Click the Flow Design view and explore the flow of the generated screens. You can also see the screens themselves by selecting the screen in the Flow Design view and switching to the Screen Design view (tab). Alternately, you can switch to the Design view and use the dropdown box in the menu toolbar to select which screen youll like to view and edit:

7. As you can see, we have a Start screen for the Client-initiated Starting Point. However, we do not have any of our primary screens e.g. the create Vacation Request screen. There are a few options available: a. Option 1 - drag and drop the MBO or an Operation for which you want to create a screen from the WorkSpace Navigator to your Flow Design view.
Lab 5 - 52 Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0 2012 Sybase, Inc.

Module 5: Introduction to Mobile Workflow Application Development b. Option 2 - create the screen(s) from scratch using the Screen Designers toolbox. 8. Lets use Option 1, the drag and drop method. In the WorkSpace Navigator, locate your Vacation Requests MBO and expand it, so that you clearly see its operations. Select the Create Operation of the VacationRequests MBO and drag and drop it into your Flow Design view:

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 5 - 53

Lab Workbook 9. You should now see a new screen automatically generated for you in the Flow Design:

10. Explore each of the screens before proceeding. Take into consideration what your business requirements are for the device-initiated workflow: a user will create a vacation request and then send it to his/her manager. Even though our MBO contains an UPDATE operation (useful for the approval process), it is NOT required by the employee application requesting vacation time. This is the reason we chose only the CREATE operation when generating a screen instead of the entire MBO. At least, in our business use case, we are not allowing employees to update their own requests. Therefore, lets delete the screen(s) relating to updating requests. 11. At this time, you will need to create either a menu item (or Navigation this will be explained later) to allow the user to navigate to the VacationRequests_create screen from the Start screen.

Lab 5 - 54

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 5: Introduction to Mobile Workflow Application Development 12. Select your Start screen and click the Screen Design tab. You should see a menu with a Cancel item and an empty screen:

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 5 - 55

Lab Workbook 13. Select the Menuitem control in the Palette and then click the item into the menu control. Enter Create Vacation Request into the Name property directly in the screen viewer and press ENTER:

14. Note that a key is automatically generated for you. 15. With the menu item still selected, you will need to change the Type to Open so that the workflow application knows that when a user selects this menu item, a new screen should be opened. Go to the Properties tab and select Open from the Type dropdown list:

Lab 5 - 56

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 5: Introduction to Mobile Workflow Application Development

16. Now, in the Screen dropdown list, select your VacationRequests_create screen, as seen below:

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 5 - 57

Lab Workbook

17. Save your work. 18. Return to the Flow Design view by clicking the Flow Design tab. 19. Note that there is a new navigation line joining your Start screen with the Vacation Request main screen. a. QUESTION: Could you have reached the same results by simply using the Navigation control in the Palette in the Flow Design view? Yes. 20. Before we complete this task, let us add some messaging to the user. Select your VacationRequest_create main screen and click the Screen Design tab. 21. In the Screen Design view, select the Create menu item and go to its Properties. 22. Review all the properties to get familiar with the processes that are to occur when the user click the Create menu item on the actual application. Then, scroll down to the Submit confirmation message property setting and enter Your Request has been submitted.
Lab 5 - 58 Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0 2012 Sybase, Inc.

Module 5: Introduction to Mobile Workflow Application Development 23. In the Resubmit confirmation message property, enter Please resubmit your Vacation Request:

24. You can go ahead and explore some of the other visual properties for your main screen. For instance, change the background color of the screen. Click some of the controls to change some of their visual properties, such as text color, etc. 25. Save your work. 26. Go back to your Flow Design view. Right-click in a white area on the view and select Arrange All from the context menu. 27. This completes Task 7.

Task 8: Generate and Test the Device-Initiated Mobile Workflow Application


Description In this task, you will generate and test your simple mobile workflow application. Make sure that the BlackBerry simulator is running and ready with MDS. 1. If you are no longer in your project, return to Unwired WorkSpace. 2. Make sure that your VacationRequest.xbw file is open in the flow diagram view.
Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0 Lab 5 - 59

Procedure

2012 Sybase, Inc.

Lab Workbook 3. Right-click anywhere in the white space of your diagram and select Generate Mobile Workflow Package:

4. Select the options that are appropriate for your device initiated mobile workflow application: Setting Generate Value Select: Generate into the project Select: My Unwired Server For our purposes, select the radio button to generate into the project. Note - You can decide where to place a copy of the generated code on your local drive. You can generate into the existing project or a new folder on your local drive. To generate into a folder, click Browse and then create a new Folder under your project name called My Workflow Packages in your Student folder. Unwired WorkSpace will create a solutions folder with all the required files. Deploy to an Unwired Server Select: Replace. Note This setting takes the result of the package generation, a .zip file and installs it as a mobile
Lab 5 - 60 Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0 2012 Sybase, Inc.

Module 5: Introduction to Mobile Workflow Application Development workflow on the selected Unwired Server. You will only need to deploy to Unwired Server once. If you make changes to the workflow application, and elect not to replace the existing one, then you will need to insure that the new version is deployed to the same Unwired Server with a new version number. Assign workflow to user(s) Click the Get Users button to get a list of assigned users. Select the employee user.

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 5 - 61

Lab Workbook 5. Click Finish. When completed, verify that there is a deployed Workflow in your Sybase Unwired server. To verify, go to the Enterprise Explorer Unwired Servers My Unwired Server Workflows folder:

6. You can also check in the SCC. 7. Now, go to the BlackBerry simulator. The Mobile Workflow application should have been loaded successfully to the simulator. You should have also configured its settings for employee already in the previous tasks. Again, the settings on the simulator can be accessed via BlackBerry Main menu Open Tray. Select from the Tray, Options Third-Party Applications Sybase Settings. Again, here are the settings again:

Lab 5 - 62

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 5: Introduction to Mobile Workflow Application Development

Property Server Name Server Port Farm ID: User Name: Specify activation code

Value Enter the machine name where the Unwired Server is running: Example dev906.education.sybase.com Default value is 5001 Default value is 0. This is used when connecting through a proxy server. The device user name: employee A number you specified in creating the user in the SCC: 123

8. From the simulator menu, select Save and reconnect the client using the appropriate menu item. Then, navigate back to your emulators start screen.

Creating a Vacation Request 9. Once the simulator has the Sybase Messaging Client restarted, the status of the employee user device should indicate Online in the SCC. 10. Return to your employee simulator. Click the simulators Text Messaging client application:

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 5 - 63

Lab Workbook 11. Click the BlackBerry Main menu button icon. The item Workflows should be available now:

12. Select the Workflows menu item. The Vacation Request workflow icon should appear:

13. Click the icon to launch the application. The Start Screen appears:

Lab 5 - 64

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 5: Introduction to Mobile Workflow Application Development 14. Go to your menu and select Create Vacation Request:

15. Enter the following: a. ID: 123 b. Requestor: Employee Joe c. Request Type: Summer Vacation d. Start Date: Todays Date e. End Date: 3 days later f. Total Days: 3 g. Appr_id: 1 h. Request Status: Pending (or leave blank recall that the default value is set to Pending)

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 5 - 65

Lab Workbook i. Request Comments: Anything you wish

16. Recall that Mobile Workflow application attributes cannot contain any NULL values. So, make sure that each field contains a value. We could have set up default values in the MBO for each field, but that could be frustrating for users. 17. Click the menu and select Create:

Lab 5 - 66

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 5: Introduction to Mobile Workflow Application Development

18. The application should have generated a message to the user indicating that the request was submitted and then brought you back to the workflow start screen:

19. Click the Vacation Request workflow icon again and create another vacation request of your choice.

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 5 - 67

Lab Workbook 20. Return to your Unwired WorkSpace and confirm that your request(s) has been generated in the database. Right-click the VacationRequests table and select Edit Data:

Lab 5 - 68

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 5: Introduction to Mobile Workflow Application Development 21. The Table Data Filter dialog window appears:

22. Click OK. You should see your row entered as such:

23. You have just created a simple device-initiated mobile workflow for entering vacation requests made by an employee user. 24. That Start screen is a bit sparse of information. Lets use that screen to create an informational screen for the application. Go to your Unwired WorkSpace Flow Design view and select the Start screen. 25. Go to its Properties view and select the Keys tab.
2012 Sybase, Inc. Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0 Lab 5 - 69

Lab Workbook 26. Add a new key by clicking the New button (we will use this key as the key for an HTMLView control). 27. Enter StartInformation for the Name field and select String for Type. We will use this key to display static text in html format, so do not specify anything in the Sent by server area:

28. Click OK. You should see a new key in your Keys listing:

29. Make sure you have your Start screen selected and click the Screen Design tab.
Lab 5 - 70 Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0 2012 Sybase, Inc.

Module 5: Introduction to Mobile Workflow Application Development 30. Select the HTMLView control from the Palette and click anywhere in the screen layout to add it. Recall that you cannot have any other controls on a screen when the HTMLView control is selected. Your screen should appear as follows:

31. Now, go to the Properties view of the HTMLView control by selecting it. 32. In the Key dropdown list, select the StartInformation key you just created. 33. In the Default Value text box, enter the following: <H1> Welcome to the Vacation Request Mobile Application</H1><P></P> To begin, select Create Vacation Request from the menu. 34. Recall that the control will accept all valid HTML tags. 35. Save your work.

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 5 - 71

Lab Workbook 36. Return to the Flow Design view and re-generate the mobile workflow to test your revised application. Dont forget to regenerate everything so that you replace what is on the Unwired Server and the device. You new Start Screen should appear as follows:

NOTE: Troubleshoot by verifying that the employee is assigned the VacationRequest workflow in the Sybase Control Center. Also, you may need to wait a few minutes for the Unwired Server to remove and replace the workflows on the device simulator itself. BB Simulator Troubleshoot ing There may be a chance that you will encounter some issues with your BlackBerry Simulator corrupting the Sybase Unwired Platforms .cod files you installed into the simulator folder earlier. The indication of a problem begins with the following JVM Error 545 message on the simulator itself:

Lab 5 - 72

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 5: Introduction to Mobile Workflow Application Development To correct this issue, follow the instructions below: 37. Shut down the BlackBerry Simulator and MDS. 38. Go to the c:\Program Files\Research In Motion\BlackBerry JDE 6.0.0\simulator and locate the batch file clean.bat. 39. Double-click the clean.bat file to run the clean up program. This will take approximately 10 minutes to run. Once the clean up is complete, it will have deleted all your .cod files (i.e. your Sybase Messaging Client files) and you will need to reinstall them into the simulator directory. 40. Assuming that clean.bat is complete, return to the following Unwired Platform directory: <UnwiredPlatform_InstallDir>\UnwiredPlatform\ClientAPI\MBS\BB\MoMessaging 41. Locate the following five BlackBerry .cod files: a. CommonClient.cod b. MessagingClientApp.cod c. MessagingClientSettings.cod d. MocaClient.cod e. WorkflowResources.cod 42. Copy these files to the following Research In Motion folder: c:\Program Files\Research In Motion\BlackBerry JDE 6.0.0\simulator 43. Unfortunately, the Device User you created in the SCC is closely associated with the previous Messaging Client via activation. Therefore, you will have to delete the employee User Device in the SCC and recreate it by following the exact same steps as you performed to create it in the first place. 44. When the employee User Device is created and ready in pending mode, load the BlackBerry MDS utility (same steps as before) and the BlackBerry 9800 Simulator. Recall that the simulator will take a few minutes to load the Sybase Messaging Client files. 45. Activate the Messaging Client using the Sybase Options utility on the simulator. 46. Regenerate the mobile workflow keep in mind that you do NOT have to redeploy or regenerate the code, just Assign the workflow to the employee user. 47. Test your mobile workflow application again several times to get data into the EIS. 48. This completes Task 8, Lab 5-1.

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 5 - 73

Lab Workbook

Lab 5-2: Building the Vacation Approval Workflow Application

Lab setup

You must complete all previous labs and tasks in all previous labs in this module before you begin this lab. After completing this lab, you should be able to: Create a server-initiated mobile workflow application

Objectives

Description

In this lab, you will develop a simple server-initiated workflow application. To begin the workflow application, you will first set up the Windows Mobile emulator. You will then create and generate the mobile workflow application screens and flow. 1. 2. 3. Setup the Windows Mobile Emulator Create the Server-Initiated Mobile Workflow User Interface Generate and Test the Mobile Workflow Application

Task outline

Lab 5 - 74

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 5: Introduction to Mobile Workflow Application Development

Detailed Instructions

Task 1: Setup the Windows Mobile Emulator

Procedure

1. Before you begin to create the server-initiated mobile workflow application, you should prepare and set up the Windows Mobile emulator. First, you must start ActiveSync. 2. Go to Start Programs Windows Mobile Device Center:

3. Once Windows Mobile Device Center opens, click Mobile Device Settings Connection Settings. This will launch the Connection Settings window. Check the Allow connections to one of the following checkbox and select DMA:

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 5 - 75

Lab Workbook

4. Click OK. 5. Go to Windows Explorer and navigate to the following directory: C:\Program Files(x86)\Microsoft Device Emulator\1.0. 6. Double-click the Device Emulator Manager program called: dvcemumanager.exe. You may want to create or use the shortcut on your desktop for this. Well be using this manager frequently in the labs:

Lab 5 - 76

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 5: Introduction to Mobile Workflow Application Development 7. Scroll down to the Windows Mobile 6 Professional Emulator:

8. Right-click and select Connect from the context menu. This should launch the emulator:

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 5 - 77

Lab Workbook 9. Return to your Device Emulator Manager and right-click on that Windows Mobile 6 Professional emulator and select Cradle:

10. Return to the Windows Mobile Device Center to verify that the device is now connected:

Lab 5 - 78

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 5: Introduction to Mobile Workflow Application Development 11. In the Device Emulator Manager, the icon will show that the device is cradled:

12. Now we will set up email on the emulator for the boss account. Go to your Windows Mobile 6 Professional emulator. 13. On the emulator start screen, click Start Messaging. 14. Click the New E-mail Account option:

15. In the Email Setup screen, Enter boss@[machine Name].education.sybase.com (example: boss@dev803.education.sybase.com).
2012 Sybase, Inc. Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0 Lab 5 - 79

Lab Workbook 16. Uncheck Try to get e-mail.:

17. Click Next. 18. Select Internet e-mail for your e-mail provider:

19. Click Next.


Lab 5 - 80 Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0 2012 Sybase, Inc.

Module 5: Introduction to Mobile Workflow Application Development

20. Enter Boss for Your Name, and leave the Account display name at the defaulted name:

21. Click Next. 22. For the Incoming mail server, enter: [machine Name].education.sybase.com (example: dev906.education.sybase.com) and select POP3 account type:

23. Click Next.


2012 Sybase, Inc. Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0 Lab 5 - 81

Lab Workbook 24. Enter boss for the User Name and sybase for the password. This is the account name you configured in the MailEnable server:

25. Click Next. 26. For the Outgoing (SMTP) mail server, enter: [machine Name].education.sybase.com (example: dev906.education.sybase.com ) and leave other options at default, as seen below:

27. Click Next.

Lab 5 - 82

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 5: Introduction to Mobile Workflow Application Development 28. Set your automatic send/receive interval at every five minutes, as seen below:

29. Click Finish. The emulator will take you to the Boss users Inbox. You will see at first a few messages, some of which are Mobile Workflow Notification messages. Do NOT open these messages until we complete the mobile workflow application. Installing Sybase Messaging Runtime 30. In case you took a break, start the Device Emulator Manager and your ActiveSync synchronization software, connect and cradle the device 31. We will now install Sybase Messaging Runtime on to the emulator. Go to C:\Sybase\UnwiredPlatform\ClientAPI\MBS\WM\MoMessaging and copy the SUPMessaging_Pro.zip file to your Student folder. 32. Return to your emulator. 33. On the Windows Mobile 6 Professional emulator main menu, select File Configure. We will add the cab file to the storage card feature of the emulator, so as to access the Sybase Messaging Runtime client cab file. 34. Make sure you are in the General tab. 35. Enter the following path in to the Shared folder text box: C:\Sybase Course\SUP521\Student (you may also browse to this location if you do not want to type the path). This will allow the emulator to search a folder using its storage card feature:

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 5 - 83

Lab Workbook

36. Click OK. NOTE: You could have simply pointed the folder to the C:\Sybase\UnwiredPlatform\ClientAPI\MBS\WM\MoMessaging folder instead. Copying the CAB file to your student folder just simplified the path for you and insured that you load the correct version of the CAB file for the emulator you are using. 37. Now, go to the emulators File Explorer:

Lab 5 - 84

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 5: Introduction to Mobile Workflow Application Development

38. From the dropdown list, select Storage Card (a.k.a. the shared folder you just defined):

39. You will see that there are files listed in the Storage Card. Click on the CAB file this will automatically initiate the installation of the cab file. 40. Select to install the file on the device:

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 5 - 85

Lab Workbook

41. Click Install. The installation process begins:

Lab 5 - 86

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 5: Introduction to Mobile Workflow Application Development 42. When the installation is complete, you should see the following message indicating that the installation was successful:

43. Click the OK button on the top right to close the installation screen. 44. Exit the File Explorer. 45. Now, you will want to configure the Sybase Messaging Client. If you are not there already, go to the emulators Programs screen and select Sybase Settings:

46. The Sybase Connection settings screen appears.

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 5 - 87

Lab Workbook 47. Enter the following connection information (recall that you are configuring a device for the boss user): a. Server Name: dev906 [e.g. your machine name].education.sybase.com b. Server Port: 5001 (default) c. Farm ID: 0 d. User Name: boss e. Activation Code: 123 (you defined the activation code in the SCC)

48. Click Done. This will return you to the connection settings screen:

Lab 5 - 88

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 5: Introduction to Mobile Workflow Application Development

49. Click Done. Now, exit out of all the programs to return to your emulators start screen. 50. Now, go to your Sybase Control Center to take a look at the user device boss. Note that the device is now online and has pending workflows:

51. This completes Task 1.

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 5 - 89

Lab Workbook

Task 2: Create the Server-Initiated Mobile Workflow User Interface


Description In this task, you will create the Server-Initiated mobile workflow application using the Mobile Workflow Forms Editor. 1. Go to Unwired WorkSpace and close your client-initiated VacationRequest.xbw file. 2. Right-click your VacationRequestWorkflow project and select New Mobile Workflow Forms Editor:

Procedure

Lab 5 - 90

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 5: Introduction to Mobile Workflow Application Development 3. In the wizard dialog, select your VacationRequestWorkflow folder and name your form file ApprovalRequest.xbw:

4. Click Next. 5. Select the Responds to server-driven notifications Starting Point:

6. Click Next. The MBO selection screen appears. 7. Click the Search button. The Search for Mobile Business Object screen appears.
2012 Sybase, Inc. Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0 Lab 5 - 91

Lab Workbook 8. Click Search again and select the VacationRequests MBO from the List:

9. Click OK. 10. In the Object Query dropdown, select findByPrimaryKey query. 11. Click in the Parameters text box and it should return the Primary Key associated with the VacationRequests table:

12. Click Next. The Specify Sample Notification dialog window appears.
Lab 5 - 92 Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0 2012 Sybase, Inc.

Module 5: Introduction to Mobile Workflow Application Development 13. Enter the following: a. From: employee b. Received: defaults to current date and time c. To: boss d. cc: blank e. Subject: Vacation Request (999) is ready for approval.

14. Click Next. The Matching Rule dialog window appears. 15. With your mouse in the Subject field, highlight Vacation Request ( NOTE: Dont forget that a Matching Rule is not the same as an Extraction Rule. All we need for the Matching Rule is enough of the STATIC text of the subject line for Unwired Server to determine where to route the email. You will be performing the Extraction Rule in a few minutes to determine the unique ID that Unwired Server will use to send the correct workflow instance to the approving user.

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 5 - 93

Lab Workbook 16. Then right-click on the highlighted text and select Select as Matching Rule. This will create the start tag of your matching rule.

17. Click Next. The Identify Parameter Values dialog window appears. 18. Select your Key, which will then enable the Extraction Rules properties area. Matching Rule helps Unwired Server determine to whom to forward the workflow, while the Extraction Rule allows Unwired Server to determine which workflow instance to serve to the user. 19. Define the Field property as the Subject field of the email notification.

Lab 5 - 94

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 5: Introduction to Mobile Workflow Application Development 20. For the Start Tag property, click the ellipsis button to open a dialog window containing your Matching Rule sample. Again, highlight the text Vacation Request (, as seen in the screenshot:

21. Click OK. 22. In the End Tag field, click the ellipsis button to open your sample. 23. This time, highlight the following part of the text: ) is ready for approval. (dont forget the period at the end of the sentence):

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 5 - 95

Lab Workbook 24. Dont forget that you need the open and closed parenthesis when defining Start and End tags. Click OK. Your dialog should appear as follows:

25. Well leave Format blank, since we are not dealing with date/time formats and such. 26. Click Finish.

Lab 5 - 96

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 5: Introduction to Mobile Workflow Application Development 27. Click the Flow Design tab and note the screens and starting point generated by the wizard:

28. Go ahead and delete the two un-associated screens that the wizard generated. 29. Now, lets verify our Matching Rule in the Server-initiated Starting Point. To begin, lets look at the Extraction Rule associated with the starting point. In the Flow Design view, select the Server-initiated starting point. In the General Properties view, select the notification extraction rule:

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 5 - 97

Lab Workbook 30. Select the Extraction Rule and click the Edit button. Note that the Start and End tags wrap around the req_id primary key. This is what you want extract the value (e.g. primary key value 999 or whatever) between these two tags:

31. Click OK to close the Extraction Rule dialog box. 32. You may also edit the entire Server-Initiated Starting Point by right-clicking and selecting Edit Server-initiated starting point from the context menu:

33. Note the Object Query and parameter being used in the first dialog window. 34. Click Next and so on. You are essentially following the wizard prompts again. This is quite useful in the case you made a mistake and need to make quick changes without having to wade through thousands of properties in your Properties viewer. 35. Click Cancel to leave the wizard.
Lab 5 - 98 Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0 2012 Sybase, Inc.

Module 5: Introduction to Mobile Workflow Application Development 36. Now, let us review the Matching Rule. Matching rules determine how notification messages are redirected at runtime. To see the Matching Rules section of the Properties view, make sure that there are no objects selected in the Flow Design page (click a white space in the Flow Design diagram). In the Properties view, click the Matching Rules tab:

37. Note that our matching rule is correct: Vacation Request \(.* 38. Save your work. Always save your work every 10 or so minutes. 39. In our workflow, we are using Static Credentials, meaning that the credentials or authentication to use the workflow are set in the connection profile. To view the current authentication properties, in your Flow Design Diagram, select a white space (meaning that no objects are selected) and click on the Authentication tab in the Properties view:

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 5 - 99

Lab Workbook 40. Note that your workflow is using Static Credentials from the connection profile authentication. There are several choices with Static Credentials: Connection Profile; Hard-coded and finally the use of certificate-based credentials. We will keep our credentials SUP Server Connection Profile based. 41. Also note that you can define the Unwired Server Domain. Since we are using the default domain, there is no need to change this property. 42. This completes Task 2.

Task 3: Generate and Test the Server-Initiated Mobile Workflow


Description In this task, you will generate and test the Server-initiated mobile workflow application using the Windows Mobile 6 Professional emulator. 1. Before we generate the application, return to your Windows Mobile 6 Professional emulator and make sure that it is started, connected and cradled:

Procedure

2. Note the messages (depending on how many requests you created via the requestors application) displayed in the messaging indicator. 3. Now, return to your Unwired WorkSpace. 4. There are several ways you can test your server-initiated workflow. We will use two methods Send a Notification and the Notification Mailbox methods. The third method, Data Change Notification, will be covered later in the course. 5. Before you can use any of the available methods, you will need to Generate the package. Therefore, right-click an empty area in the Flow Design diagram and select Generate Mobile Workflow Package:
Lab 5 - 100 Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0 2012 Sybase, Inc.

Module 5: Introduction to Mobile Workflow Application Development

6. Select the following: a. Generate: Generate into the project b. Deploy to an Unwired Server: Replace c. Assign Workflows: click the Get Users button and select boss NOTE: If you make any changes to your Flow Design and object properties, you will need to regenerate your package. Otherwise, you perform this step only once per device user. Recall that you can use commas to generate and assign to multiple device users already registered in the SCC.

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 5 - 101

Lab Workbook

7. Click Finish and allow the deployment to complete. 8. Now, lets try the first method by right-clicking in an empty area in the Flow Design view. Select Send a notification from the context menu:

Lab 5 - 102

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 5: Introduction to Mobile Workflow Application Development

9. Enter the following: a. Unwired Server profile: My Unwired Server b. To: boss c. Subject: Vacation Request (1) is ready for approval. NOTE: The beginning of the subject line has to be EXACT, since it is a Matching Rule criterion. You sent 1 or 2 requests during the device- initiated mobile workflow lab, so the integer value for the primary key would be 1 or 2. If you are not retrieving any workflows, review the data in the VacationRequests table in the database to verify existing primary keys. 10. Click the Get Device Users button and boss will be populated in the fields:

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 5 - 103

Lab Workbook

11. Click the Send button. 12. Go to your Windows Mobile 6 Professional emulator and select the Messaging application. 13. Open your email notification in the boss email Inbox and read it. This is the notification email and is nothing other than an email message. Recall that mobile workflows reside in the generic Outlook container on Windows Mobile, so you will need to go to the generic Outlook Inbox. Select Menu Go To Outlook Email:

Lab 5 - 104

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 5: Introduction to Mobile Workflow Application Development

14. Note that there is now a workflow instance in the list (Note the icon):

15. Open the mobile workflow instance by double-clicking it.

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 5 - 105

Lab Workbook 16. Review the workflow and update the status to Approved by clicking the Open Vacation Request menu item. 17. Your approved request should appear as follows:

18. Click Update. You should return to your email client with the workflow listing. Now, click the workflow again and note that the status is showing Pending again. There is nothing wrong with your workflow to verify, go to your database and look at your record via the Unwired WorkSpace. Note that your workflow request row is indeed updated. What do you think is going on here? ___________________________________________________________________ ___________________________________________________________________ ___________________________________________________________________ ___________________________________________________________________ ___________________________________________________________________

Answer: Normally, server-initiated mobile workflows will retrieve the data from the EIS once before presenting the data to the user for updates. Upon update, the data is sent back to the EIS. The instance data of the workflow on the device is static. In order to perform a refresh of the data on the device, you will have to perform what is called a server-initiated Online Lookup. You will learn about Online Lookup later in the course.

Lab 5 - 106

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 5: Introduction to Mobile Workflow Application Development 19. If you want to verify on the device that the workflow Status is changed, you can easily use the Send a Notification feature to the approval device. 20. Now, lets perform a more real world scenario. Verify Device User Assignments 21. Go to your SCC and click on Device Users. 22. Select the boss user. 23. Click the Workflows button:

24. Verify that the boss user device is assigned the ApprovalRequest workflow:

25. Click OK. Everything appears to be in order.

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 5 - 107

Lab Workbook 26. Having already deployed the Vacation Request workflow to your BlackBerry device simulator, you should be able to simply create a new request, send it, and then go to the Windows Mobile 6 Professional emulator to approve the request following the same steps as you performed with the manual notification method. 27. Return to Unwired WorkSpace to verify that the data in the database is correct. Simple UI Customization

28. We will perform a very simple change to the applications icon and then a more involved change to the Status indicator control. 29. First, in the Flow Design view, click anywhere in the white space. 30. Go to the Properties view. 31. Note in the General tab, there is a Client Icon property. Select an icon of your choice from the list:

32. Save your work. 33. Now, lets change one of the controls in both screens. 34. In the Flow Design view, click to select the VacationRequestsDetails screen. 35. Click the Screen Design tab.

Lab 5 - 108

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 5: Introduction to Mobile Workflow Application Development 36. Select the Request Status Edit Box control on the screen:

37. Press the DELETE key to remove it. 38. Now, go to your Palette and select the Choice control:

39. Click in your device screen to add it to the end of the control list.

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 5 - 109

Lab Workbook 40. Enter Status: and press ENTER. Your screen should appear as follows:

41. Lets change the position of the control so that it is the second control on the screen. Select the Choice control on your device screen and drag and drop it between the Requestor and the Request Type controls. This may be tricky to get locked:

Lab 5 - 110

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 5: Introduction to Mobile Workflow Application Development 42. Select the Choice on your device screen and look at its properties. We will need to assign it the appropriate Key again. In the Input Data Binding area, select the Key drop down list and choose VacationRequests_request_status_attribKey:

43. Scroll down and select Read Only. This is the first screen that appears on the device. You cannot change the value here, but will perform most of the these steps again on the Update screen. 44. In the Options area, select Static.

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 5 - 111

Lab Workbook 45. Click Add and add the following:

46. Click OK. 47. Add the other two options: a. Approved b. Declined 48. Save your work. 49. Now, you will need to repeat the previous steps again for the Update screen. 50. Return to the Flow Design view and select your second screen the Update screen. 51. Click the Screen Design tab. 52. Remove the old status Edit Box control and replace it with a new Choice control. Enter Status for the label. 53. Move the Choice control on the screen to the same position as the other screen between Requestor and Request Type. 54. Assign the VacationRequests_request_status_attribKey Key to the control. 55. Now, do NOT check the Read Only check box. 56. Add your three options: a. Pending b. Approved c. Declined 57. Save your work and return to the Flow Design view.

Lab 5 - 112

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 5: Introduction to Mobile Workflow Application Development 58. Because you have made some significant changes to your Server-Initiated workflow application, you will need to regenerate it. Lets do some minor housecleaning first. Go to your Enterprise Explorer and locate the ApprovalRequest:1 workflow package in the Unwired Server:

59. Right-click and select Delete from the context menu to completely remove it. You do not have to delete your other device-initiated mobile workflow package, since we have not made any changes to it. 60. Save any work. 61. Now, regenerate and deploy your mobile workflow application by right-clicking in the Flow Design view Generate Mobile Workflow Package

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 5 - 113

Lab Workbook 62. Make sure that you treat this generate as a new generation, since you have deleted the previous workflow package:

63. Click Finish. 64. Test your new server-initiated mobile workflow using the Send a Notification feature first and then you can use the Notification Mailbox feature.

Lab 5 - 114

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 5: Introduction to Mobile Workflow Application Development 65. At first, note the workflow application icon has changed:

66. Then, note that your new initial screen is changed the status is a drop down and it is Read-Only:

67. Click the Open Vacation Request menu item to open an editable instance of the workflow. 68. Your screen should now allow you to select one of the three status indicators using the Choice control:

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 5 - 115

Lab Workbook

69. This completes Task 3, Lab 5-2.

Lab 5 - 116

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 6: Advanced Mobile Workflow Application Development

Module 6: Advanced Mobile Workflow Application Development

Lab 6-1: Enhancing the Workflow Application

Lab setup

Prior to starting this lab, you must have completed the labs in Module 5. These labs will build on the Vacation Request application you completed. After completing this lab, you should be able to: Make generic cosmetic changes to the Workflow application Add control validation rules via the Workflow Forms Editor Modify the generated Custom.js file by adding code to some of the function stubs Alter the look-and-feel of a Workflow application by coding some of the function stubs in Custom.js Alter the look-and-feel of a Workflow application by making changes to the generated CSS Use some of the provided API functions to read data and then use the information in the execution of custom business logic Test your changes to the Workflow application

Objectives

Description

In this lab, you will be see the types of changes that can be made to a Workflow application after it has been generated. 1. 2. 3. 5. Make General Cosmetic Changes Write Validation Rules Using the Editor Familiarize Yourself with Generated Files Add Custom Business Logic

Task outline

4. Alter Application Appearance

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 6 - 1

Lab Workbook

Detailed Instructions

Task 1: Make General Cosmetic Changes


Description A basic, functioning Workflow application was created in Lab 5. Now, using the Workflow Forms Editor, you will clean up some of the UI presentation of the application. 1. Open the Unwired WorkSpace, if not already opened. 2. Locate the VacationRequestWorkflow project in the WorkSpace Navigator. 3. Double-click the VacationRequest.xbw to open the Workflow Forms editor. 4. Go to the Flow Design view of the editor. 5. Double-click the Start Screen. 6. Once in the Screen Design view, notice there is a menu item named Cancel Screen. This menu item was automatically generated, but is worded poorly. Click the Cancel Screen menu item and go to the Properties view. 7. Rename the item Close Application. Do not worry about changing the name of the key. 8. Save your work and go back to the Flow Design view. 9. Single-click on the Vacation Request screen. 10. In the Properties view, change the name to Add Vacation Request. This will now be visible in the screens titlebar at runtime. 11. When you tab off of the Name property, notice that the Key property is automatically updated accordingly. This is expected. 12. Save your work. 13. Double-click the Add Vacation Request screen, taking you to the Screen Design. 14. Notice how some of the EditBox labels, like Request Type, are truncated? Fix those labels by changing the Label Position property to a value of TOP. 15. Click the Appr id: EditBox. 16. Change the Label property to be Approver ID: and also set the Label Position property to TOP. 17. Your screen should now look as follows:

Procedure

Lab 6 - 2

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 6: Advanced Mobile Workflow Application Development

18. Again, on the Add screen, the generated menu items can be construed as poorly worded. Change the menu item Create to read Submit:

19. Save your work.


2012 Sybase, Inc. Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0 Lab 6 - 3

Lab Workbook 20. Delete the Request type EditBox control from the Add screen. 21. Using the Palette, add back in its place a Choice control with a Label of Request Type: and a Label Position of TOP. Note that the Choice was added at the bottom of the screen. 22. Drag the Request type Choice up so that it is below the Requestor EditBox. This is not as easy as you may think.

23. Still in Properties, re-map the Key for Request Type to VacationRequests_create_request_type_paramKey. Also, set a Default Value to a value of Vacation:

Lab 6 - 4

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 6: Advanced Mobile Workflow Application Development 24. Using the Add button, define the static options for the Choice as shown below:

25. Save your work. 26. Click the Approver ID EditBox. Provide a default value of 1. 27. Click the Request Status EditBox. Provide a default value of Pending. 28. Save your work. 29. Recall that when you tested your work in Lab 5, you saw the Sybase Messaging Client window and that it contained the icon to start the client-initiated workflow:

30. Notice, above, how the text of the icon is wrapping? Click a null area of the Flow Design view and go to Properties.

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 6 - 5

Lab Workbook 31. On the Application properties, change the Module display name to Vacation Request (add a space in between the two words), and the Client icon to Travel Suitcase:

*Note: It is not possible to use an image/picture file as your icon if the device platform is Windows Mobile or BlackBerry. For these platforms, you must choose from one of the built-in icons. It is possible for iOS devices because you have the Objective C source for the Sybase Messaging Client and can include your icons in the container and re-compile the application. 32. Using steps shown to you in Lab 5, re-generate the application and test using the BlackBerry simulator. 33. This completes Task 1.

Task 2: Write Validation Rules Using the Editor


Description In this task you will add some validation logic to controls of the workflow forms, using the built-in capabilities of the Workflow Forms Editior. Later, you will write validation logic using JavaScript and the provided API functions. 1. In the VacationRequest.xbw Flow Design, double-click the Add Vacation Request screen. 2. Select the Requestor EditBox control and then go to the Advanced tab in the Properties view. 3. Notice that this is where you can set the maximum length (for input) and the number of lines you want this control to span. 4. In the Validation groupbox, enable the Required property. 5. Save your work and generate the application out to the BlackBerry simulator.
Lab 6 - 6 Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0 2012 Sybase, Inc.

Procedure

Module 6: Advanced Mobile Workflow Application Development 6. After generating, run the application and add a new vacation request. 7. The cursor starts on the Requestor field. Click some other field on the screen, without entering any data. Focus should change. 8. As you just saw, setting the Required property alone may not be sufficient. 9. Close the running workflow application. 10. Re-generate, this time enabling the option that reads Validate controls as soon as the user tries to change focus away from them. 11. Test your work. Can you now just click away from the Requestor field without adding any data? 12. Close the running application. 13. Next, look at the Mobile Application Diagram for the VacationRequestWorkflow. Specifically, look at the VacationRequests MBO and the total_days attribute. Note that it is a STRING(4) type. 14. Now go back to the Workflow Forms Editor. The Add screen should still be visible. 15. Click a null area in the editor and look at the properties of the Screen. 16. Click the Keys tab. 17. Note the total_days key is also of type string. Data types must match. 18. Now, click on the Total Days EditBox control and look at the properties. On the General tab youll see the binding of the control to the key. 19. Go to the Advanced tab in the Properties view. 20. Change the Maximum Length property to a value of 2. This is one way to perform validation. 21. Enable the Required property for Total Days. 22. Enter the following Regular Expression and Validation message:

23. Generate the application to the simulator and test.

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 6 - 7

Lab Workbook 24. When testing, add a new request, enter a requestor name, click the Total days field and try to enter a value of 123. You should see an error message:

25. Close the running application and save your work in the Unwired WorkSpace. 26. This completes Task 2.

Task 3: Familiarize Yourself with Generated Files


Description Following the generation of a Workflow application, several HTML, JavaScript and CSS files are created and made available to the developer. This task will have you locate and evaluate what is provided. 1. Go to the Unwired WorkSpace. 2. Locate the VacationRequestWorkflow project in the WorkSpace Navigator.

Procedure

Lab 6 - 8

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 6: Advanced Mobile Workflow Application Development 3. Under the project, located the Generated Workflow folder and expand it. You will see two sub-folders for each of the workflow applications. This lab will focus on the VacationRequest application/folder:

4. Double-click to open manifest.xml and review its contents. 5. Expand the Client Workflows node. You will see the different supported platforms. Expand those platforms to see the File details:

6. Note that Windows Mobiles File reference points to VacationRequest.xml while BlackBerry6 points to VacationRequest_jQueryMobileLookAndFeel.xml. Explore the File settings for the other platforms. 7. Close manifest.xml.

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 6 - 9

Lab Workbook 8. In the WorkSpace Navigator, double-click to open VacationRequest.xml. Expand the nodes to see the details:

9. Notice the src attribute points to html/workflow.html. 10. Close VacationRequest.xml. 11. Open VacationRequest_jQueryMobileLookAndFeel.xml. Expand to see what html file the src attribute points to. 12. Close VacationRequest_jQueryMobileLookAndFeel.xml. 13. In the /html folder, open Workflow_jQueryMobileLookAndFeel.html. This is the file used by BlackBerry 6 and iOS devices. 14. Towards the top of the html file, notice how all of the script references point to JavaScript files in the /js folder.

Lab 6 - 10

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 6: Advanced Mobile Workflow Application Development 15. Also notice the link references and how they point to cascading style sheets in the /css folder, and specifically jquery.mobile-1.0a3.css.

16. Continuing to scroll down the html file, notice that there are html <DIV> sections that represent each screen of the mobile workflow application. Recall that in the VacationRequest.xbw, there are only two screens:

17. In the HTML, you should see two <DIV> sections for each of these screens:

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 6 - 11

Lab Workbook 18. Recall the design of the Add Vacation Request form of the workflow:

19. If you continue to look in the HTML, in the DIV section for the above screen, you will see DIV sections for each of the controls that you placed on that screen. You will also note the keys that these controls are tied to. This information will be of importance to you when you begin to write JavaScript code to dynamically manipulate the workflow application:

20. In addition to looking at the generated HTML to determine key values, you can also look at the Properties views of the screens and controls to get information you will need to write custom JavaScript. 21. As you are reviewing the HTML, notice how each screen will have a customTopOfFormStyle and customBottomOfFormStyle DIVs. Note the id values associated with those DIVs. Knowing that these DIVs exist will help you understand code you will see later:

22. Continue to scroll down the HTML. After all of the DIV sections, you will see a SCRIPT section. In that section you will notice some JavaScript code that includes some lines that start with a $. The statements with the $ sign are calling jQuery functions.
Lab 6 - 12 Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0 2012 Sybase, Inc.

Module 6: Advanced Mobile Workflow Application Development 23. Close Workflow_jQueryMobileLookAndFeel.html. 24. In the WorkSpace Navigator, locate the /html/js/API.js file and open it. Spend some time reviewing the functions that are provided for manipulating workflow applications. These functions are all commented. 25. Close API.js. 26. Take a few minutes to open and review, the remaining *.js files. Minimally read the comments at the top of these source files, noting which are editable and which arent. 27. In the WorkSpace Navigator, open the /html/css/jquery.mobile-1.0a3.css. Recall that this file was referenced in the html file you just reviewed. Review this cascading style sheet. The student guide gives an example of changing screen colors by editing the CSS file.

28. Close the style sheet. 29. In the WorkSpace Navigator, expand the /html/js folder(s) to see what was generated. These files were referenced in the html file you reviewed earlier. Later, you will be allowed to make changes to some of these JavaScript files. Recall that some of these JavaScript files should not be changed. Refer back to the Student Guide for which files you should not edit. 30. This completes the task of reviewing the artifacts that are automatically generated when you Generate a mobile workflow application from Unwired WorkSpace. 31. This completes Task 3.

Task 4: Alter Application Appearance


Description In this task, you will make some alterations to the physical look and feel of your mobile workflow application. These alterations will be made to some of the generated JavaScript and CSS files you learned of in the last task.

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 6 - 13

Lab Workbook Procedure 1. In Unwired WorkSpace, click the menu WindowPreferences and choose SybaseMobile DevelopmentMobile Workflow Forms Editor and set to Optimize for Performance.

2. Apply changes and close the Preferences dialog. 3. Using the WorkSpace Navigator, create a new folder named images under the generated /html folder. 4. From your C:\Sybase Courses\SUP520\Lab Resources folder, import SybLogo.png and blue_sky_and_clouds.jpg into the new images folder.

5. Open .../html/js/Custom.js. 6. Locate the customBeforeWorkflowLoad function. 7. Replace this function with the contents in customBeforeWorkflowLoad.txt. This file can be found in your Lab Resources folder. 8. Review the code you added to ensure your understand how to change the mobile workflow screen backgrounds.
Lab 6 - 14 Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0 2012 Sybase, Inc.

Module 6: Advanced Mobile Workflow Application Development 9. Locate the customAfterNavigateForward function. 10. Replace this function with the contents in customAfterNavigateForward.txt. This file can be found in your Lab Resources folder. 11. Review the code you added to ensure you understand how to add a custom footer at the bottom of each workflow screen. 12. Save the changes made to Custom.js. 13. From the VacationRequest.xbw, Flow Design view, Generate Mobile Workflow Package:

14. Test to see that the screens now have a different background and a footer at the bottom of each screen:

15. Enter a new Vacation Request as follows, being sure to input the phone number which will be used in subsequent lab steps:

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 6 - 15

Lab Workbook

16. Submit the above request. 17. Using the Data Explorer in Unwired WorkSpace, make sure that the new request was added to your sample database:

18. When done testing, go back to the Start Screen and click the BlackBerrys menu icon (at the bottom of the screen) and select Close Application:

Lab 6 - 16

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 6: Advanced Mobile Workflow Application Development

19. You should now be sitting on the Sybase Messaging Client main screen:

20. In Unwired WorkSpace, open the ApprovalRequest.xbw. Recall this is the serverinitiated workflow you created in Lab 5-2. This is the workflow the boss uses to approve or reject your request. 21. Generate the ApprovalRequest out to the BlackBerry device user.

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 6 - 17

Lab Workbook 22. In the Workflow Forms editor, generate a notification for the newly added request. Using the above scenario, my request was #2. Yours may vary. Use whatever req_id you saw when you viewed the information in the database:

23. Click on the message that is received in the simulator to open the approval workflow form:

Lab 6 - 18

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 6: Advanced Mobile Workflow Application Development

24. Close the above vacation request approval form. 25. In Unwired WorkSpace, if not already there, go to the Flow Design of the ApprovalRequest.xbw. Notice there are two screens in this workflow application. The second screen in the flow is the VacationRequest_update_instance:

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 6 - 19

Lab Workbook 26. Select the second screen and look at the Properties view. Note the name of the key associated with this screen as seen below:

27. Open VacationRequest_update_instance in the Screen Design. 28. Click on the Request Comments editbox.

Lab 6 - 20

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 6: Advanced Mobile Workflow Application Development 29. Looking at the Properties view, write the name of the key associated with the Request Comments editbox below: ________________________________________________________ 30. Also open the Custom.js file. Be sure you open the one for the ApprovalRequest workflow. Last time you were in the Vacation Requests Custom.js. 31. Locate the customBeforeShowScreen function. 32. Replace that function with the code found in the customBeforeShowScreen.txt file in your Lab Resources folder. 33. Review the code to understand how it will turn the phone number entered into the Request comments into a link the user can click on to dial the number. 34. Using information that was taught or is in the Student Guide, determine where the getCurrentMessageValueCollection( ) is defined. Open that source file and review the comments of that function. 35. What specifically are the removeChild( ), createElement( ) and appendChild( ) functions? Who owns (or defined) those functions? Besides learning JavaScript syntax and functions and the Sybase Unwired Platform Mobile Workflow APIs, what else must you learn to make these kinds of changes to a workflow application? 36. Save Custom.js. 37. Re-generate the ApprovalRequest workflow. Be careful, because it takes some time for the newly generated workflow application to be copied down to the simulator. A key is to watch the inbox. When you see the email from the first test disappear, you know the deployment is in process. Also watch the upper-right of the simulator screen for the NorthEast-SouthWest arrow that blinks during deployment. 38. After the device has received the new version of the workflow, you will have to send another notification. Right-click in the Workflow Forms Editor (null area) and select Send a Notification 39. The details from the last notification will still be in the dialog. 40. Click the Send button. 41. In the simulator, go to the inbox and find the new workflow notification email.

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 6 - 21

Lab Workbook 42. Click on the email to open the approval details form:

43. As shown above, click the menu icon on the simulator and then select Open VacationRequests_update_instance. 44. The update_instance screen appears with the phone number value that is in the Request Comments editbox as a link:

Lab 6 - 22

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 6: Advanced Mobile Workflow Application Development

45. Click the phone number link and you will be prompted to either call or cancel:

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 6 - 23

Lab Workbook 46. Review the materials in the Student Guide. This same template could be used to read an address and display a Google map, or read an email address and start the devices email client. Sample code for doing this was given in the Student Guide. 47. Close the screens of the ApprovalRequest workflow. 48. In the Unwired WorkSpace, close the ApprovalRequest.xbw as well as the Custom.js for that workflow. Close any other editors that may be open as well. 49. This completes Task 4.

Task 5: Add Custom Business Logic


Description This task will have you learn how to add some custom business logic to your workflow application. 1. Reopen the VacationRequest.xbw. 2. In the Flow Design, click on the Add Vacation Request screen and, looking in the Properties view, note the name of the key associated with this screen:

Procedure

3. Double-click to open the Add Vacation screen in the Screen Design view.
Lab 6 - 24 Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0 2012 Sybase, Inc.

Module 6: Advanced Mobile Workflow Application Development 4. Click on the Submit menu item. Looking at the Properties view, note the name of the key associated with this menu item:

5. Open the Custom.js that is associated with the VacationRequest workflow application. 6. Locate the customBeforeSubmit( ) function. 7. Replace customBeforeSubmit with the code in customBeforeSubmit.txt that can be found in the Lab Resources folder. 8. Save Custom.js. 9. Re-generate the workflow application and test. Remember, this is a client-initiated workflow.

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 6 - 25

Lab Workbook 10. Now, when you add a new request, and click the Submit menu, you should be prompted as follows:

11. If you click Cancel on the above screen, the request is not submitted because of the return false statement in the code you just added. 12. Close the application running in the simulator. 13. Close any editors opened in Unwired WorkSpace. 14. This completes Task 5, Lab 6-1.

Lab 6 - 26

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 6: Advanced Mobile Workflow Application Development

Lab 6-2: Creating an Online Lookup Scenario

Description

Currently the user must know and then enter an approver ID on the vacation request. You will now modify the client-initiated mobile workflow (VacationRequest) to display a list of approvers. This is a client-initiated online lookup. 1. Create a Client-initiated Online Lookup

Task outline

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 6 - 27

Lab Workbook

Detailed Instructions

Task 1: Create a Client-initiated Online Lookup


Description Create a client-initiated online lookup providing the user with a list of approvers and their ids which are needed to input the request. 1. Open VacationRequest.xbw. 2. Using the Palette, add a new screen named Approver List. 3. Double-click the Add Vacation Request screen, which opens the Screen Design view. 4. Add a new menu item named Display Approvers:

Procedure

5. In the Properties view for the Select Approver menu item, set the type to Online Request, search and associate the VacationApprovers MBO, invoke the MBOs findAll Object query and then set the Success screen to Approver List and click the button to Generate an Error screen:

Lab 6 - 28

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 6: Advanced Mobile Workflow Application Development

6. Go to the Output Keys tab in the menus Properties and note that a new key named VacationApprovers (of type list) has now been created because of the work done in the step above:

7. Go back to the Flow Design view. 8. In a null area of the Flow Design, right-click and select Arrange All. This cleans up the Flow Design. 9. Double-click the Approver List screen. 10. Add a Listview control to the screen.

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 6 - 29

Lab Workbook 11. Set the Listviews General properties as shown below:

12. On the Listviews Cell properties click the Cell Lines Add to add cell line 0. 13. Select cell line 0. 14. Click Add in the Fields for cell line 0 groupbox. 15. In the Field Definition dialog, choose the VacationApprovers_appr_id_attribKey and set the Field Width to a value of 20 and a Field Header Title of ID. 16. Click OK. 17. Again, click Add in the Fields for cell line 0 groupbox. 18. In the Field Definition dialog, choose the VacationApprovers_appr_name_attribKey and set the Field Width to a value of 80 and a Field Header Title of Name:

19. Save your work.

Lab 6 - 30

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 6: Advanced Mobile Workflow Application Development 20. Generate and test the mobile workflow application.

21. Stop the application running in the simulator. 22. Close any editors opened in Unwired WorkSpace. 23. (Optional exercise) In the ApprovalRequest mobile workflow, add functionality so that the manager can see a list of all vacation requests, showing the requestor, start and end dates for the request. 24. This completes Task 1, Lab 6-2.

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 6 - 31

Lab Workbook

Lab 6-3: Using the Attachment Viewer Control

Description Task outline

In this lab, you will add attachment capabilities to a mobile workflow application. 1. 2. 3. Setup the Database Create the Mobile Workflow Application Add an Attachment Viewer Control

Lab 6 - 32

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 6: Advanced Mobile Workflow Application Development

Detailed Instructions

Task 1: Setup the Database


Description To use the Attachment Viewer control, a database table will need to be created. This new table will need a column of type BLOB (or Long Binary, depending on your database vendor. This task will have you set up the table, add some sample data, and explore the contents. 1. In Unwired WorkSpace, create a new Mobile Application Project. Close any other projects you may have open. Name the new project AttachmentsDemo. 2. You should already be connected to the My Sample Database, but if not, connect now. 3. Drag emps.sql from your Lab Resources folder into the AttachmentsDemo project. 4. Drag the folder named empDirImages from your Lab Resources folder into the root C:\. 5. Open emps.sql in Unwired WorkSpaces SQL Editor. 6. Note that: a. You are creating a table named Emps. b. That the Emps table has a column named pic which is of type long binary. c. That the Emps table has a column named picType which will have a default value of image/jpeg. 7. Scroll to the right in the INSERT statements of the emps.sql and you will see reference to a Sybase SQL Anywhere stored procedure xp_read_file. This system stored procedure is going to open and read the provided images into the BLOB column named pic. 8. At the top of the SQL Editor, set the Connection Profile Type to Sybase_ASA_12.x, the Name to My Sample Database and the Database to sampledb.

Procedure

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 6 - 33

Lab Workbook 9. Save. 10. Click the toolbar icon to execute all SQL statements. 11. Verify that the SQL Results view contains no errors. 12. In the Enterprise Explorer, expand the sampledb inside of My Sample Database. Expand the Tables node. You may need to right-click over Tables and select Refresh from the context menu. 13. Locate the new Emps table, right-click over that table and select Edit Data from the context menu. 14. When the data is displayed, scroll to the right and make sure your pic column now has some binary data:

15. Close the tab displaying the Emps table data. 16. Close the tab containing the Emps.sql. 17. This completes Task 1.

Task 2: Create the Mobile Workflow Application


Description In this task, you will perform steps similar to those you have done several times in this course. You will create an MBO for the new Emps table. You will then create a new mobile workflow application, deploy and test. You will not be given detailed steps for this task as this should be review. 1. Create a new MBO for the Emps table you created in Task 1. Use all attributes, create all operations. 2. Deploy the MBO to the Unwired Server. There is a step in the deployment wizard that you must make the correct choice. Be careful.

Procedure

Lab 6 - 34

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 6: Advanced Mobile Workflow Application Development 3. Create a new Mobile Workflow application named EmployeeDirectory.xbw, with only a server-initiated starting point. Associated the workflow with the Emps MBO and when prompted, associated the workflow with the findByPrimaryKey Object Query. For the sample notification, put Edit Employee (test) in the subject line. Specify Edit Employee( as the matching rule. Configure the workflow so that test is the extracted value being passed to the findByPrimaryKeys userId parameter. Finish the wizard. 4. Delete all of the screens that were automatically created, leaving only the starting point in the editor. 5. Using the MBOs update operation, drag and create a new screen that will allow the mobile workflow user to edit an employee. Rename this screen Update Employee. 6. On the new update screen, remove the Notify of Hires and Notify of Departure checkbox controls. 7. Tie the new screen to the Start Screen that was provided. The resulting menu item in the Find screen can not be of type Open Screen. What will the correct type be? Make the appropriate change. 8. Save your work, deploy and test. In order to test, you will have to perform an additional step in the Mobile Workflow Forms editor. What is that? What is needed in order to test? Perform that step now to test. 9. During testing, you should see:

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 6 - 35

Lab Workbook Detail Window:

10. Close the application in the simulator. 11. This completes Task 2.

Task 3: Add an Attachment Viewer Control


Description You will now add the Attachment Viewer control to the Employee Update screen, testing your work so that you see the image of the employee. 1. Go to the EmployeeDirectory.xbw, Flow Design. 2. Double-click the Update Employee screen. 3. In Screen Design, add an AttachmentViewer control after the editbox containing the employees last name.

Procedure

Lab 6 - 36

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 6: Advanced Mobile Workflow Application Development 4. Give the AttachmentViewer a label of Picture:.

5. Map the AttachementViewer control to the key associated with the BLOB attribute (set the Input Binding property) as shown below:

6. Map the MIME type key to the key associated with the picType attribute:

7. Save your work, regenerate out to the BlackBerry simulator and test. You should see the following:

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 6 - 37

Lab Workbook

8. Close the application running in the simulator. 9. Close any editors opened in Unwired WorkSpace. 10. This completes Task 3, Lab 6-3.

Lab 6 - 38

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 7: Introduction to Native Mobile Application Development

Module 7: Introduction to Native Mobile Application Development

Lab 7-1: Configuring BlackBerry Eclipse Plug-in


Description Before you begin native mobile application development, we will first configure the BlackBerry Eclipse Plug in. Once this task is complete, the Sybase Unwired WorkSpace will contain the BlackBerry Java Plug-in for Eclipse and can be used to develop mobile BlackBerry applications directly from Unwired WorkSpace. 1. If open, close Unwired WorkSpace. You can leave Sybase Unwired Platform services running. 2. The BlackBerry Plug is installed to: C:\Eclipse. 3. First step is to copy files from the Eclipse install directory to the Sybase Unwired Platform directory so the BlackBerry Eclipse Plug in will be displayed in the Unwired WorkSpace. Navigate to this directory: C:\Eclipse Copy both the features and plugin directories:

Procedure

4. Now, paste these directories to this Sybase Unwired Platform directory, overwriting the existing features and plugins directories: C:\Sybase\Unwired_Platform\Unwired_Workspace\Eclipse\sybase_workspace\ mobile\eclipse
2012 Sybase, Inc. Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0 Lab 7 - 1

Lab Workbook

5. Next, we will copy files from Sybase Unwired Platform to the Eclipse install. Navigate to this directory: C:\Sybase\Unwired Platform\ClientAPI\RBS\BB 6. Copy these files: CommonClient.cod CommonClient.jar sup_client_rim.cod sup_client_rim.jar UltraliteJ.cod UltraliteJ.jar 7. Paste these files to this Eclipse directory: C:\Eclipse\plugins\net.rim.ejde.componentpack6.0.0_6.0.0.30\components\simulator 8. Start Unwired WorkSpace. 9. Confirm the BlackBerry Eclipse Plug in is installed correctly. From the Unwired WorkSpace Development IDE select Window Open Perspective Other

Lab 7 - 2

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 7: Introduction to Native Mobile Application Development

10. Select the BlackBerry Application Development Perspective and click OK.

11. This completes Task 1, Lab 7-1.

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 7 - 3

Lab Workbook

Lab 7-2: Project Setup


Overview Before you begin native mobile application development, we first need to create two Mobile Application Projects in Unwired WorkSpace. These projects will be used for back-end code for the native applications. 1. If not already started, start the Unwired WorkSpace Development IDE from StartPrograms Sybase Sybase Unwired Platform Unwired WorkSpace. 2. Switch perspectives to Unwired WorkSpace by selecting Window Open Perspective Mobile Development:

Procedure

3. Confirm that the sampledb and Unwired Server are connected, and connect to both if necessary. 4. Create the first Mobile Application Project and call it VSNative. 5. Create a customer MBO for the Visual Studio native application by dragging the customer table from the sampledb to the Mobile Application Diagram in Unwired WorkSpace:

Lab 7 - 4

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 7: Introduction to Native Mobile Application Development

6. Save the VSNative project. 7. Create a second Mobile Application Project and call it BlackBerryNative. 8. Create a Customer MBO for the BlackBerry native application by dragging the customer table from the sampledb to the Mobile Application Diagram in Unwired WorkSpace. 9. Save the BlackBerryNative project. 10. This completes Task 1, Lab 7-2.

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 7 - 5

Lab Workbook

Lab 7-3: Preparing the Visual Studio Environment

Lab setup

Before you begin: Please complete all previous labs

Objectives

After completing this lab, you should be able to: Generate code for a native Visual Studio application Create and define a Visual Studio Project Create a Test Form Deploy and Test the Application

Description

In this lab, you will create a test Visual Studio native application. The goal of this lab is to demonstrate how to setup the Visual Studio environment to enable further development using the Sybase Unwired Platform Client APIs. 1. Generate Code from Unwired WorkSpace 2. Create a Visual Studio Project 3. Configure the Visual Studio Project 4. Create the Test Form 5. Deploy and Test the Application

Task outline

Lab 7 - 6

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 7: Introduction to Native Mobile Application Development

Detailed Instructions

Task 1: Generate Code from Unwired WorkSpace


Description In this task, you will generate code for the Visual Studio project from Unwired WorkSpace. This code is the back-end code that will be imported into the Visual Studio project to develop the test application. 1. In Unwired WorkSpace right click over the VSNative project and select Generate Code

Procedure

2. Select the MBO on the first Generate Code window and click Next. Code Generation wizard starts. 3. Define Code Generation options: a. Language select C# for Visual Studio applications b. Platform .NET Compact Framework 3.5 for Windows Mobile c. Unwired Server select My Unwired Server d. Server domain default e. Namespace enter DaveCo for this test application f. Check Replication-based for the Visual Studio native application g. Leave all other options as the displayed default selections

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 7 - 7

Lab Workbook

4. Click Finish to complete the code generation process. 5. Deploy this Mobile Application Project to the Unwired Server by right clicking in a null area of the Mobile Application Diagram and select Deploy Project 6. This completes Task 1.

Task 2: Create a Visual Studio Project


Description In this task, you will create a Visual Studio project using the Visual Studio Smart Device Project template. 1. Launch Microsoft Visual Studio 2008 (Start Programs Microsoft Visual Studio 2008 Microsoft Visual Studio 2008) and select File New Project. 2. When Visual Studio starts for the first time, it may prompt for a project type. Select C#.

Procedure

Lab 7 - 8

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 7: Introduction to Native Mobile Application Development 3. In the New Project window, click the Smart Device Project and name the project VSNativeUI:

4. Click OK. 5. Complete the New Smart Project window: a. Target platform Windows Mobile 6 Professional SDK b. Framework version - .NET Compact Framework Version 3.5 NOTE: The target platform and the .NET framework version must be the same as the options selected during the code generation process in Unwired WorkSpace. 6. Click the Device Application icon and click OK and the framework of the project is built:

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 7 - 9

Lab Workbook

7. Project details are displayed in the Visual Studio Solution Explorer. 8. Expand the project to view its components. Expand the References folder to view the pre-defined assemblies:

9. This completes Task 2.

Task 3: Configure the Visual Studio Project


Description In this task, you will add reference files to the Visual Studio project and then configure these files. You will also add generated code to the project and delete unnecessary files. 1. In Visual Studio Solution Explorer, highlight the project name (VSNativeUI), right click and select Add Reference
Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0 2012 Sybase, Inc.

Procedure
Lab 7 - 10

Module 7: Introduction to Native Mobile Application Development 2. Click the Browse tab to add these .dll files to the project: a. sup-client.dll find at: C:\Sybase\UnwiredPlatform\ClientAPI\RBS\WM b. iAnywhere.Data.UltraLite.dll find at: C:\Sybase\UnwiredPlatform\ClientAPI\RBS\WM\Ultralite

3. In Visual Studio Solution Explorer, highlight the project name, right click and select Add Existing Item 4. Click the Browse tab to add these libraries to the project: a. ulnet11.dll find at: C:\Sybase\UnwiredPlatform\ClientAPI\RBS\WM\Ultralite (Select All Files on the browse window to see this file.) b. mlcrsa11.dll find at: C:\Sybase\UnwiredPlatform\ClientAPI\RBS\WM\ServerSync c. PUtilTRU.dll find at: C:\Sybase\UnwiredPlatform\ClientAPI\RBS\WM 5. Note where the files are copied in the Visual Studio Solution Explorer:

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 7 - 11

Lab Workbook

6. Next step is to configure the library files in the Properties Pane of the Visual Studio Solution Explorer. 7. Select the ulnet11.dll file and in the Properties pane, scroll to the Copy to Output parameter. Click the drop-down menu for this property and select Copy always.

Lab 7 - 12

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 7: Introduction to Native Mobile Application Development

8. Complete this process for the mlcrsa11.dll and PUtilTRU.dll libraries. 9. Now, you will return to Unwired WorkSpace to copy the code generated in Unwired WorkSpace to the Visual Studio project. 10. In the WorkSpace Navigator pane of Unwired WorkSpace, right click on the Generated Code folder of the VSNative project and select Copy. 11. In Visual Studio, right click on the VSNativeUI project and select paste. The Generated Code folder with Dlls and scr subdirectories should be displayed:

12. Delete the Dlls subdirectory in the Generated Code folder because the necessary files have already been copied and configured for this project. 13. Open the scr folder and delete the VSNative.csproj file. 14. This completes Task 3.
2012 Sybase, Inc. Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0 Lab 7 - 13

Lab Workbook

Task 4: Create the Test Form


Description Procedure In this task, you will create a Visual Studio form to test the project. 1. In the Visual Studio window, click the Toolbox tab on the left side of the window and the Device Controls menu is displayed. 2. Drag and drop two Label and two Textbox controls onto the upper portion of the form. 3. Drag and drop a Button control below the textboxes. 4. Add another Textbox below the button. 5. Adjust the layout of the Form to look similar to this:

6. Now, assign properties to the controls on the Form. Click the first Label control and enter User ID: in the text field. 7. Click the second Label control and enter Password: in the text field. 8. Click the Button control and enter Log in at the text field. Click the Textbox called Textbox3 and at the Multiline parameter select True. On the Form, drag the corner of this textbox to make it larger. This textbox will be used for a message back from SUP for connection success or failure. 9. On the Form1 graphic, double click the Login button to display the buttons code window (Form1.cs) 10. Add the following Using statements at the top of the source: using Sybase.Persistence; using DaveCo;

Lab 7 - 14

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 7: Introduction to Native Mobile Application Development NOTE: Sybase.Persistence is one of the core namespaces of the Sybase Unwired Platform Client API. DaveCo is the namespace identified during code generation in Unwired Platform. 11. In the same code window, add the following code to the Login Buttons clicked event: ConnectionProfile cp = VSNativeDB.GetSynchronizationProfile( ); cp.ServerName = dev902; cp.PortNumber = 2480; cp.Save ( ); NOTE: cp.ServerName is the address of the Sybase Unwired Platform Server. Change this port to match your VM assignment. Port number 2480 is used for RBS applications. 12. Next, add a try / catch block to the Login buttons clicked event to connect to the Unwired Server and to write status information to the multiline textbox: try { VSNativeDB.LoginToSync (textBox1.Text, textBox2.Text); textBox3.Text = Connected to SUP; } catch (Exception ex) { textBox3.Text = Error connecting to SUP \r + ex.Message; } 13. Click the Save icon to save this code. 14. This completes Task 4.

Task 5: Deploy and Test the Application


Description Procedure In this task, you will deploy and test the Visual Studio application. 1. Launch your Windows Mobile emulator and confirm that the emulator is connected and cradled. The cradled icon is displayed when the emulator is cradled and ready to accept deployment of the application:
Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0 Lab 7 - 15

2012 Sybase, Inc.

Lab Workbook

Cradled

2. From the Visual Studio menu select Build Build VSNativeUI 3. Check the output view to confirm that the application builds with no errors.

Lab 7 - 16

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 7: Introduction to Native Mobile Application Development 4. On the Visual Studio window click the Debug icon (green right-facing icon) or select Debug Start Debugging to start the test. 5. Deploy window is displayed. Select the Windows Mobile 6 Professional Emulator and click Deploy:

6. Go back to the Windows Mobile emulator and Form1 should be displayed:

7. Enter the login credentials: a. User ID: supAdmin b. Password: s3pAdmin 8. Click the Log in button and Connected to SUP will be displayed in the text box.

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 7 - 17

Lab Workbook This demonstrates that the Visual Studio environment is setup and ready for further development using the Sybase Unwired Platform Client APIs. 9. This completes Task 5, Lab 7-3.

Lab 7 - 18

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 7: Introduction to Native Mobile Application Development

Lab 7-4: Preparing the Eclipse Environment

Lab setup

Before you begin: Please complete Lab 7-2 Unwired Server is up and running

Objectives

After completing this lab, you should be able to: Generate code for a Native BlackBerry Application Create and define a BlackBerry Project Create a Test Application Run the Test Application

Description

In this lab, you will create a test BlackBerry native application. The goal of this lab is to demonstrate how to setup the BlackBerry environment to enable further development using Sybase Unwired Platform Client APIs. 1. Generate Code from Unwired Platform 2. Create a BlackBerry Project 3. Copy Files to the BlackBerry Project 4. Create a Test Application 5. Run the Test Application

Task outline

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 7 - 19

Lab Workbook

Detailed Instructions

Task 1: Generate Code from Unwired WorkSpace


Description In this task, you will generate code for the BlackBerry project from Unwired WorkSpace. This code is the back-end code that will be imported into the BlackBerry JDE to develop the test application. 1. In Unwired WorkSpace right click over the BlackBerryNative project and select Generate Code

Procedure

2. Select the MBO on the first Generate Code window and click Next. Code Generation wizard starts. 3. Define Code Generation options: a. Language select Java for BlackBerry applications b. Platform Java ME for BlackBerry c. Unwired server select My Unwired Server d. Package enter daveCo for this test application. Note that Java requires a lowercase letters for the first letter of the package name. e. Check Replication-based for this BlackBerry native application f. Uncheck the Generate JavaDoc option.

Lab 7 - 20

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 7: Introduction to Native Mobile Application Development

4. Click Finish to complete the code generation process. NOTE: An error icon will appear in the generated source code for the BlackBerryNativeDB.java file. This file calls the net_rim_api.jar file which is not yet in the projects build path. Ignore this error for now. 5. Deploy this Mobile Application Project to the Unwired Server by right clicking in a null area of the Mobile Application Diagram and select Deploy Project 6. In Unwired WorkSpace, close the BlackBerry Native project. 7. This completes Task 1.

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 7 - 21

Lab Workbook

Task 2: Create a BlackBerry Project


Description In this task, you will define the parameters of the BlackBerry project and copy required files to the BlackBerry Project directories. Before you can create a BlackBerry user interface, the BlackBerry Eclipse Plug in must be installed. Complete Lab 7-1 to install and configure the BlackBerry Eclipse environment. 1. From the Unwired WorkSpace Development IDE select Window Open Perspective Other:

Procedure

2. Select the BlackBerry Application Perspective and click OK:

3. In the BlackBerry Application Development perspective select File New BlackBerry Project. 4. Name the BlackBerry project BlackBerryNativeUI and select BlackBerry JRE 6.0.0:
Lab 7 - 22 Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0 2012 Sybase, Inc.

Module 7: Introduction to Native Mobile Application Development

5. Click Next to continue. 6. At the Java Settings page click the Libraries tab:

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 7 - 23

Lab Workbook

7. Click the Add External Jars button and navigate to this directory: C:\Sybase\Unwired Platform\ClientAPI\RBS\BB 8. Select these files: CommonClient.jar sup_client_rim.jar UltraLiteJ.jar 9. Click Finish to complete the wizard. If you are prompted to restart Eclipse, click Cancel. 10. Once the wizard completes, the BlackBerry Application Descriptor launches. Click the BlackBerryNativeUI tab to view the descriptor page:

Lab 7 - 24

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 7: Introduction to Native Mobile Application Development

11. Enter BlackBerry Native UI as the title. 12. (Optional): You can add a custom icon of your choice for the application by clicking Add External button and navigate to an icon file in this directory: C:\Sybase Courses\SUP521\Lab Resources\ *.png 13. Save the project. 14. This completes Task 2.

Task 3: Copy Files to the BlackBerry Project


Description In this task, you will use Windows Explorer to copy Unwired Platform files to the BlackBerry project. Open Windows Explorer and navigate to C:\Sybase\Unwired Platform\ClientAPI\RBS\BB. 1. Copy these files: CommonClient.cod sup_client_rim.cod UltraLiteJ.cod

Procedure

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 7 - 25

Lab Workbook

2. Paste these .cod files to these two directories: C:\Eclipse\plugins\net.rim.ejde.componentpackage6.0.0_6.0.0.30\ components\simulator and C:\Sybase\UnwiredPlatform\Unwired_Workspace\Eclipse\sybase_workspace\mobile\ eclipse\plugins\net.rim.ejde.componentpack6.0.0_6.0.0.30\components\simulator You paste these files to both directories because the BlackBerry simulator is different than the simulator used for the Windows Mobile applications. 3. Continuing in Windows Explorer, copy the daveCo directory with the individual *.java files from the Mobile Application source files generated in Unwired WorkSpace. Copy this directory: C:\Sybase Courses\SUP521\Student\BlackBerryNative\ Generated Code\src\daveCo.

4. Paste the *.java files to this directory: C:\Sybase Courses\SUP521\Student\BlackBerryNativeUI\src\daveCo

Lab 7 - 26

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 7: Introduction to Native Mobile Application Development 5. Next, open the BlackBerry Application Development perspective to confirm that the files have been copied correctly. In the BlackBerry project directory, you should not see any errors:

NOTE: The yellow exclamation points next to the .java files in this display indicate a warning in the code, not an error. 6. This completes Task 3.

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 7 - 27

Lab Workbook

Task 4: Create a Test Application


Description In this task, you will create an application to confirm that the BlackBerry environment is configured correctly for further UI development. 1. In the BlackBerry Package Explorer, navigate to the source folder of the BlackBerry project (BlackBerryNativeUI\src\mypackage). 2. Double click on the MyScreen.java file and the code will be displayed. 3. Add the following imports to this code:

Procedure

NOTE: The warning on import daveco.Customer; can be ignored it is a result of our sample code not yet making use of that object. 4. Scroll to the *Creates a new MyScreen object * section of the code and enter this connection code:

Lab 7 - 28

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 7: Introduction to Native Mobile Application Development

5. Click the Save button to save the project. 6. This completes Task 4.

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 7 - 29

Lab Workbook

Task 5: Run the Test Application


Description In this task, you will run the test application created in the previous step. If the application runs without error, then you can use this configuration as a basis for further UI development for a BlackBerry application. 1. From Eclipse select Run Run Configurations

Procedure

2. In the Run Configurations window, select the BlackBerryNativeUI project and click Run:

Lab 7 - 30

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 7: Introduction to Native Mobile Application Development 3. If the application runs successfully, the BlackBerry Simulator will launch. Click on the simulator and click the BlackBerry application icon:

4. If the BlackBerry application successfully connects to the Unwired Server, then the simulator screen will display Connected:

5. You can now use this configuration as a basis for further UI development of a BlackBerry application. 6. This completes Task 5, Lab 7-4.

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 7 - 31

Lab Workbook

Lab 7 - 32

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 8: Sybase Unwired Platform Client APIs

Module 8: Sybase Unwired Platform Client APIs

Lab 8-1: Using Sybase Unwired Platform APIs and Generated Code

Lab setup

Before you begin: Please complete all previous labs

Objectives

After completing this lab, you should be able to: Create a Mobile Application using the Sybase Unwired Platform Client APIs Use code generated from Sybase Unwired Platform as the application back-end source code Use Visual Studio to build Windows Forms to create the Application Deploy and Test the Application

Description

In this lab, you will import an existing Unwired Platform project as the basis of a mobile application. You will use Visual Studio to create a mobile application that uses the Sybase Unwired Platform Client APIs. 1. Import an Existing Project 2. Create a Visual Studio Project 3. Configure the Visual Studio Project 4. Create the Login Form 5. Create the Main Form 6. Create the Customers Form 7. Create the Customer Detail Form 8. Create the Contacts Form 9. Deploy and Test the Application

Task outline

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 8 - 1

Lab Workbook

Detailed Instructions

Task 1: Import an Existing Project


Description In this task, you will add an existing project to your workspace to use as the basis for the Mobile Application. We will be using a project called SUPSample. 1. Open Windows Explorer and navigate to C:\Sybase Courses\SUP521\Lab Resources\SUPSample. 2. Verify that your folder contains the following:

Procedure

3. Close Windows Explorer and open Unwired WorkSpace. 4. We will import the SUPSample project into the workspace. To do so, right click anywhere in the WorkSpace Navigator and select Import. The following window appears. Expand the General folder:

Lab 8 - 2

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 8: Sybase Unwired Platform Client APIs

5. Select Existing Projects into Workspace. 6. Click Next. 7. Browse to the Sample projects root directory: C:\Sybase Courses\SUP521\Lab Resources\SUPSample. 8. Make sure that the SUPSample project is checked and select to Copy projects into workspace:

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 8 - 3

Lab Workbook

9. Click Finish. You have imported the Sample project into the Unwired WorkSpace. 10. In Unwired WorkSpace, expand the project folders to view all of the artifacts imported with the imported project:

Lab 8 - 4

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 8: Sybase Unwired Platform Client APIs

11. Before we deploy this project, we need to confirm that the stored procedure called sp_calc_sales_tax is contained in the sampledb database. In Enterprise Explorer, click the sampledb icon and click the Stored Procedure folder. 12. If the sp_calc_sales_tax stored procedure is not displayed, locate the CreateSalesTaxSP.sql in the DDL folder of the project. Right click on this sql file and select Open With SQL File Editor. The SQL Editor window is displayed:

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 8 - 5

Lab Workbook

13. At the Type field, select Sybase_ASA_12.x. For the Name select My Sample Database and select the Database sampledb. 14. Right click in the SQL Editor window and select Execute All. 15. The stored procedure will execute and Succeed will be displayed in the SQL Results tab at the bottom of the Unwired WorkSpace window. 16. Now you can Deploy the SUP Sample project. Close the SQL Editor window and right click in the Mobile Application Diagram and select Deploy Project. 17. The project should deploy with no errors. 18. In the WorkSpace Navigator, highlight the SUP Sample project and select Generate Code. 19. Select all of the MBOs of the project and click Next. Code Generation wizard starts. 20. Define Code Generation options: a. Language select C# for Visual Studio applications b. Platform .NET Compact Framework 3.5 for Windows Mobile c. Unwired Server select My Unwired Server d. Server domain default e. Namespace enter DaveCo for this test application f. Check Replication-based for the Visual Studio native application g. Leave all other options as the displayed default selections

Lab 8 - 6

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 8: Sybase Unwired Platform Client APIs

21. If you get the error displayed at the top of this window, you can ignore it. 22. Click Finish to complete the code generation process. 23. This completes Task 1.

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 8 - 7

Lab Workbook

Task 2: Create a Visual Studio Project


Description In this task, you will create a Visual Studio project using the Visual Studio Smart Device Project template. 1. Launch Microsoft Visual Studio 2008 (Start Programs Microsoft Visual Studio 2008 Microsoft Visual Studio 2008) and select File New Project. 2. When Visual Studio starts for the first time, it may prompt for a project type; select C#. 3. In the New Project window, click the Smart Device Project and name the project SUPSampleProject:

Procedure

4. Click OK. 5. Complete the New Smart Project window: a. Target platform Windows Mobile 6 Professional SDK b. Framework version - .NET Compact Framework Version 3.5 NOTE: The target platform and the .NET framework version must be the same as the options selected during the code generation process in Unwired WorkSpace.
Lab 8 - 8 Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0 2012 Sybase, Inc.

Module 8: Sybase Unwired Platform Client APIs 6. Click the Device Application icon and click OK and the framework of the project is built.

7. Project details are displayed in the Visual Studio Solution Explorer. 8. Expand the project to view its components. Expand the References folder to view the pre-defined assemblies:

9. This completes Task 2.

Task 3: Configure the Visual Studio Project


2012 Sybase, Inc. Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0 Lab 8 - 9

Lab Workbook Description In this task, you will add reference files to the Visual Studio project and then configure these files. You will also add generated code to the project and delete unnecessary files.

Procedure

1. In Visual Studio Solution Explorer, highlight the project name (SUPSampleProject), right click and select Add Reference 2. Click the Browse tab to add these .dll files to the project: a. sup-client.dll find at: C:\Sybase\UnwiredPlatform\ClientAPI\RBS\WM b. iAnywhere.Data.UltraLite.dll find at: C:\Sybase\UnwiredPlatform\ClientAPI\RBS\WM\Ultralite

3. In Visual Studio Solution Explorer, highlight the project name, right click and select Add Existing Item 4. Click the Browse tab to add these libraries to the project: a. ulnet11.dll find at: C:\Sybase\UnwiredPlatform\ClientAPI\RBS\WM\Ultralite b. mlcrsa11.dll find at: C:\Sybase\UnwiredPlatform\ClientAPI\RBS\WM\ServerSync c. PUtilTRU.dll find at: C:\Sybase\UnwiredPlatform\ClientAPI\RBS\WM 5. Next step is to configure the library files in the Properties Pane of the Visual Studio Solution Explorer. 6. Select the ulnet11.dll file and in the Properties pane, scroll to the Copy to Output parameter. Click the drop-down menu for this property and select Copy always.

Lab 8 - 10

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 8: Sybase Unwired Platform Client APIs

7. Complete this process for the mlcrsa11.dll and PUtilTRU.dll libraries. 8. Now, you will return to Unwired WorkSpace to copy the code generated in Unwired WorkSpace to the Visual Studio project. 9. In the WorkSpace Navigator pane of Unwired WorkSpace, right click on the Generated Code folder of the SUPSample project and select Copy. 10. In Visual Studio, right click on SUPSampleProject and select paste. The Generated Code folder with Dlls and scr subdirectories should be displayed. 11. Delete the Dlls subdirectory in the Generated Code folder because the necessary files have already been copied and configured for this project. 12. Open the scr folder and delete the SUPSample.csproj file. 13. Now that the Project is configured, you will create the forms of the mobile application. 14. This completes Task 3.

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 8 - 11

Lab Workbook

Task 4: Create the Login Form


Description Procedure In this task, you will create the login form, the first form in the application. 1. From Visual Studio Solution Explorer, double click on Form1.cs and the form is displayed in the design window. In the Form1 properties window (lower right corner below Solution Explorer), make these changes: (Name) = FormLogin Text = SUP Sample Application Login 2. In the Visual Studio window, click the Toolbox tab on the left side of the window and the Device Controls menu is displayed. 3. Drag a Label control onto the form below the form title. Size this label to fit the horizontal width of the form. 4. In the Label properties window, make these changes: Text = Enter your login credentials below: 5. Drag and drop two Labels and two Textbox controls to the form, as shown:

6. In the Properties window for the Label1 and Label2 controls, modify the Text field: Text = User ID: Text = Password: 7. In the Properties window for the corresponding Textbox controls, modify the Name field: (Name) = textBoxUID (Name) = textBoxPWD 8. Next, drag and drop a Button control below the textboxes.

Lab 8 - 12

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 8: Sybase Unwired Platform Client APIs 9. In the Properties window for the Button control, change the (Name) property to btnLogin and Text to Log in. 10. Adjust the layout of FormLogin to look similar to this:

11. Next step is to code the logic behind the form. On the FormLogin graphic, double click the Login button to display the forms code window (FormLogin.cs). 12. Add Using statements at the top of the source: using Sybase.Persistence; using DaveCo; NOTE: Sybase.Persistence is one of the core namespaces of the Sybase Unwired Platform Client API. DaveCo is the namespace identified during code generation in Unwired Platform.

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 8 - 13

Lab Workbook 13. At the Click method of this form, you will add a new function to create a device local database. This function takes no arguments and returns nothing. Code this method to see if the device local database exists, and if not, create one. For this code, you will use methods of the SUPSampleDB.cs file that was generated in Unwired WorkSpace:
private void btnLogin_Click(object sender, EventArgs e) { Cursor.Current = Cursors.WaitCursor; // create device local database if (!SUPSampleDB.DatabaseExists()) { SUPSampleDB.CreateDatabase(); }

14. Code the connection to Unwired Server as follows: a. Declare a variable of type ConnectionProfile. This type is the Sybase.Persistence namespace that was added as a Using statement. Name this variable cp. b. Call the GetSynchronizationProfile( ) method. c. Set the ServerName to your host name and PortNumber to 2480 so these parameters match your environment. d. Encrypt the local database using the SetEncryptionKey( ) method. e. Call the Save ( ) method. f. Call LoginToSync, passing the user ID and password. Upon successful login, call and display the FormMain form. g. Write a login failed message to the textBox. 15. Your code for the Login operation should look as follows:
// connect to an Unwired Server ConnectionProfile cp SUPSampleDB.GetSynchronizationProfile(); cp.ServerName = "dev902"; cp.PortNumber = 2480; // setting key to encrypt the local database // must be called before first access

cp.SetEncryptionKey("NoNe0fY0UrBuS1NeSs"); cp.Save(); try { SUPSampleDB.LoginToSync(textBoxUID.Text, textBoxPWD.Text); FormMain fm = new FormMain();


Lab 8 - 14 Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0 2012 Sybase, Inc.

Module 8: Sybase Unwired Platform Client APIs


fm.Show(); } catch (Exception ex) { MessageBox.Show("Error connecting with " + ex.Message); } Cursor.Current = Cursors.Default; }

16. Close the form and delete the local device database. Your code should look like this:
private void FormLogin_Closing(object sender, CancelEventArgs e) { SUPSampleDB.DeleteDatabase(); }

private void FormLogin_Load(object sender, EventArgs e) {

} } }

17. This completes the coding of the FormLogin.cs for the SUP Sample Application. 18. This completes Task 4.

Task 5: Create the Main Form


Description In this task, you will create the Main form in the application that acts as a menu to call two other forms, the Customers and Contacts windows. The FormLogin calls this form. 1. From Visual Studio Solution Explorer, highlight the project name, right click and select Add Windows Form. 2. Select Windows Form on the template wizard screen and name the form FormMain.cs. 3. In the FormMain properties window (lower right corner below Solution Explorer), change the Text field to: Text = SUP Sample Application Menu

Procedure

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 8 - 15

Lab Workbook 4. You will add LinkLabel controls to the form that will link to the other forms of the application. Click the Toolbox tab on the left side of the window and the Device Controls menu is displayed. 5. Drag a Label control onto the form below the form title. Size this label to fit the horizontal width of the form. 6. In the Label properties window, make these changes: Text = Choose an option by clicking a link: 7. Drag four LinkLabel controls onto the form and place below each other on the form. 8. Define the properties for these LinkLabel controls as: Name = linkLabelCustomers Text = Customers Name = linkLabelProducts Text = Products Name = linkLabelContacts Text = Contacts Name = linkLabelExit Text = Exit 9. Your completed form should look like this:

10. Click Save to save the completed form design. 11. Next step is to create the code behind the form that will activate the click events for the link label controls. 12. Click the Exit link and the code is displayed, at the linkLabelExit click event. 13. First, add the Using statements at the top of the source:
using System.Text;
Lab 8 - 16 Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0 2012 Sybase, Inc.

Module 8: Sybase Unwired Platform Client APIs


using System.Windows.Forms; using Sybase.Persistence; using DaveCo;

14. At the linkLabelExit click event, enter code that will close the connection to the Unwired Server database:
public FormMain() { InitializeComponent(); } private void linkLabelExit_Click(object sender, EventArgs e) { SUPSampleDB.CloseConnection(); this.Close(); }

15. Next, enter the code to activate the linkLabelCustomer click event:
private void linkLabelCustomers_Click(object sender, EventArgs e) { FormCustomers fcList = new FormCustomers(); fcList.Show(); }

16. Enter the code block that can be used for future use for the Products linkLabel. As an optional exercise, you can code this form and this link. Enter this code block so the FormMain code will continue to work if the Products link is clicked:
private void FormMain_Load(object sender, EventArgs e) {

17. Finish the FormMain code by entering the linkLabelContacts click event:
private void linkLabelContacts_Click(object sender, EventArgs e) { FormContacts fCont = new FormContacts(); fCont.Show(); }
2012 Sybase, Inc. Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0 Lab 8 - 17

Lab Workbook
} }

17. Save your work. 18. This completes Task 5.

Task 6: Create the Customers Form


Description In this task, you will create the form in the application that retrieves customer information from the device local database. This customer information corresponds to the Customer MBO created in the Unwired WorkSpace. 1. Add another Windows Form to your project. (From Visual Studio Solution Explorer, highlight the project name, right click and select Add Windows Form.) 2. Name the form FormCustomers.cs. 3. In the FormCustomers properties window (lower right corner below Solution Explorer), change the Text field to: Text = Customers 4. Click the Toolbox tab and drag a ListView control onto the form. 5. Size the ListView box to fit the form. 6. Click in the menu bar, where it says, Type here, type Details. 7. Enter another button to the right of Details and name it Edit. 8. In the Properties window for the Details button, change the Name field to: Name = menuItemDetails 9. In the Properties window for the Edit button, change the Name field to: Name = menuItemEdit 10. Create sub-menu items for the Edit menu called: New and SalesTaxRate.

Procedure

Lab 8 - 18

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 8: Sybase Unwired Platform Client APIs

11. In the Properties window for the New sub-menu item, name this item newItemNew. Leave the name of the SalesTaxRate property at menuItem1. 12. Your completed Customers form should look like this:

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 8 - 19

Lab Workbook

13. Click Save to save the form design. 14. Double click the Details menu item to access the code behind the FormCustomers form. 15. Add the Using statements to the top of the source: using Sybase.Persistence; using DaveCo; 16. Before coding the Details click button event, we will create the code to load customer information that will display on the form. After the InitializeComponent( ); line, enter this code:
private void FormCustomers_Load(object sender, EventArgs e) { Cursor.Current = Cursors.WaitCursor; string[] custHdr = new string[3]; custHdr[0] = "ID"; custHdr[1] = "Company";

Lab 8 - 20

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 8: Sybase Unwired Platform Client APIs


custHdr[2] = "City";

SUPUtility.doSync();

SUPUtility.setUpListView(custHdr, listViewCust); List<Customer> custList = Customer.FindAll(); if (custList.Count > 0) { for (int i = 0; i < custList.Count; i++) { ListViewItem item = new ListViewItem(custList[i].Id.ToString()); item.SubItems.Add(custList[i].Company_name); item.SubItems.Add(custList[i].City); listViewCust.Items.Add(item); } } else { MessageBox.Show("No customers found for this request.", "Warning"); } Cursor.Current = Cursors.Default; }

17. Next, complete the Detail button click event with this code:
private void menuItemDetails_Click(object sender, EventArgs e) { FormCustomerDetail fcd = new FormCustomerDetail(custNumber); fcd.Show(); this.Close(); } private void listViewCust_ItemActivate(object sender, EventArgs e) { custNumber = Int16.Parse(listViewCust.FocusedItem.Text); }

18. Notice in this code, ItemActivate is used to retrieve customer information based on customer number.
2012 Sybase, Inc. Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0 Lab 8 - 21

Lab Workbook

19. Next, enter the code for the New and Sales Tax Rate button click events:
private void menuItemNew_Click(object sender, EventArgs e) { bool newCust = true; FormCustomerDetail fcd = new FormCustomerDetail(newCust); fcd.Show(); this.Close(); } private void menuItem1_Click(object sender, EventArgs e) { CustomerCalcSalesTaxRateOperation cst = new CustomerCalcSalesTaxRateOperation(); cst.City = "Houston"; cst.State = "TX"; cst.Save(); }

20. Finish the code:


private void listViewCust_SelectedIndexChanged(object sender, EventArgs e) {

} } }

21. Click Save to save the FormCustomers. 22. This completes Task 6.

Task 7: Create the Customer Detail Form


Description In this task, you will create the form in the application that retrieves customer detail information from the Unwired Server. This form is called from the FormCustomerDetails form in the application. 1. Add another Windows Form to your project. (From Visual Studio Solution Explorer, highlight the project name, right click and select Add Windows Form.)
Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0 2012 Sybase, Inc.

Procedure
Lab 8 - 22

Module 8: Sybase Unwired Platform Client APIs 2. Name the form FormCustomerDetail.cs. 3. In the FormCustomerDetail properties window (lower right corner below Solution Explorer), change the Text property to: Text = Customer Details 4. The completed form should look like the following. Directions to create this form will follow:

5. From the Toolbox tab, drag and drop eight Label controls and eight corresponding TextBox controls onto the form. 6. Name the Labels and corresponding TextBox controls as: Label Text Property Company First Last Address City State Zip Phone
2012 Sybase, Inc.

TextBox Name Property textBoxCo textBoxFirst textBoxLast textBoxAddress textBoxCity textBoxState textBoxZip textBoxPhone

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 8 - 23

Lab Workbook

7. Click in the menu bar, where it says, Type here, type Edit. 8. Enter another button to the right of Edit and name it Save. 9. In the Properties window for the Edit button, change the Name field to: Name = menuItemEdit 10. In the Properties window for the Save button, change the Name field to: Name = menuItemSave 11. Double click the Edit button to access the code behind the FormCustomerDetail form. 12. Add the Using statements to the top of the source: using Sybase.Persistence; using DaveCo; 13. Before coding the form buttons, we will first add code to create an integer and a Boolean. After the public partial class. line, enter:
public partial class FormCustomerDetail : Form { int custId; Customer custDet; bool isNewCust;

public FormCustomerDetail() { InitializeComponent(); }

14. Next, enter this code after the InitializeComponent ( ); method:


public FormCustomerDetail(bool isNewCust) { InitializeComponent(); if (isNewCust) { this.isNewCust = isNewCust; enableAllControls(); } }

15. The next block of code will initialize the component and call the Customer detail from Unwired Platform:

Lab 8 - 24

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 8: Sybase Unwired Platform Client APIs


public FormCustomerDetail(int custId) { InitializeComponent(); this.custId = custId; custDet = Customer.FindByPrimaryKey(custId); if (custDet != null) { textBoxCo.Text = custDet.Company_name; textBoxFirst.Text = custDet.Fname; textBoxLast.Text = custDet.Lname; textBoxAddr.Text = custDet.Address; textBoxCity.Text = custDet.City; textBoxState.Text = custDet.State; textBoxZip.Text = custDet.Zip; textBoxPhone.Text = custDet.Phone; }

16. The menuItemEdit_Click event should be the next block of text in the code. Add this line to this code:
private void menuItemEdit_Click(object sender, EventArgs e) { enableAllControls(); }

17. Next, code the menuItemSave_Click event, as follows:


private void menuItemSave_Click(object sender, EventArgs e) { if (isNewCust) { Customer newCust = new Customer(); newCust.Id = (int) KeyGenerator.GenerateId(); newCust.Company_name = textBoxCo.Text; newCust.Fname = textBoxFirst.Text; newCust.Lname = textBoxLast.Text;
2012 Sybase, Inc. Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0 Lab 8 - 25

Lab Workbook
newCust.Address = textBoxAddr.Text; newCust.City = textBoxCity.Text; newCust.State = textBoxState.Text; newCust.Zip = textBoxZip.Text; newCust.Phone = textBoxPhone.Text; newCust.Create(); // could also call Save()

newCust.SubmitPending(); SUPUtility.doSync(); this.Close(); } else { custDet.Company_name = textBoxCo.Text; custDet.Fname = textBoxFirst.Text; custDet.Lname = textBoxLast.Text; custDet.Address = textBoxAddr.Text; custDet.City = textBoxCity.Text; custDet.State = textBoxState.Text; custDet.Zip = textBoxZip.Text; custDet.Phone = textBoxPhone.Text; custDet.Update(); // could also call Save()

custDet.SubmitPending(); SUPUtility.doSync(); this.Close(); } }

18. Complete this form by enabling all Controls:


private void enableAllControls() { textBoxCo.Enabled = true; textBoxFirst.Enabled = true; textBoxLast.Enabled = true; textBoxPhone.Enabled = true; textBoxAddr.Enabled = true; textBoxCity.Enabled = true; textBoxState.Enabled = true;
Lab 8 - 26 Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0 2012 Sybase, Inc.

Module 8: Sybase Unwired Platform Client APIs


textBoxZip.Enabled = true; menuItemSave.Enabled = true; } private void textBoxCo_TextChanged(object sender, EventArgs e) {

} } }

19. Click Save to save FormCustomerDetail.cs. 20. This completes Task 7.

Task 8: Create the Contacts Form


Description In this task, you will create the form in the application that retrieves contact information. This form is called from the FormContacts form in the application. 1. Add another Windows Form to your project. (From Visual Studio Solution Explorer, highlight the project name, right click and select Add Windows Form.) 2. Name the form FormContacts.cs. 3. In the FormContacts properties window (lower right corner below Solution Explorer), change the Text property to: Text = Contacts 4. On this form, you will place three Label Controls with corresponding TextBox Controls and two Button controls. A ListView Control and menu items complete the form. The completed form design will look like this:

Procedure

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 8 - 27

Lab Workbook

5. From the Toolbox tab, drag and drop three Label controls and three corresponding TextBox controls onto the form. 6. Name the Labels and corresponding TextBox controls as: Label Text Property City State Last TextBox Name Property textBoxCity textBoxState textBoxLast TextBox Text Property Emeryville CA %

7. Add two buttons to the right of the text boxes. 8. In the Properties window, complete these parameters for the top button: Name = buttonRetrieve Text = Retrieve 9. In the Properties window, complete these parameters for the bottom button: Name = buttonFind Text = Find 10. Next, drag a ListView Control onto the form below the text boxes and Retrieve and Find buttons. Change the name of this control to ListViewContacts. 11. Click in the menu bar, where it says, Type here, type Edit. 12. In the Properties window, name the Edit button: menuItemEdit.
Lab 8 - 28 Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0 2012 Sybase, Inc.

Module 8: Sybase Unwired Platform Client APIs 13. Create a sub-menu item for the Edit menu called: Delete 14. In the Properties window for the Delete sub-menu item, name this item menuItemDelete. 13. Double click the Retrieve button to access the code behind the FormContacts form. 14. Add the Using statements to the top of the source: using Sybase.Persistence; using DaveCo; 15. Enter the code for the Retrieve button below the InitializeComponent ( ); method:
private void buttonRetrieve_Click(object sender, EventArgs e) { Cursor.Current = Cursors.WaitCursor; string[] custHdr = new string[3]; custHdr[0] = "Last"; custHdr[1] = "City"; custHdr[2] = "State";

SUPUtility.setUpListView(custHdr, listViewContacts);

PersonalizationParameters pp = SUPSampleDB.GetPersonalizationParameters(); pp.StatePersKey = textBoxState.Text; pp.Save();

ContactSynchronizationParameters csp = Contact.GetSynchronizationParameters(); csp.City_sync_parm = textBoxCity.Text; csp.Save();

SUPUtility.doSync();

List<Contact> contList = Contact.FindAll(); if (contList.Count > 0) { for (int i = 0; i < contList.Count; i++) { ListViewItem item = new ListViewItem(contList[i].First_name); item.SubItems.Add(contList[i].Last_name);
2012 Sybase, Inc. Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0 Lab 8 - 29

Lab Workbook
item.SubItems.Add(contList[i].City); item.SubItems.Add(contList[i].State); listViewContacts.Items.Add(item); } } else { MessageBox.Show("No contacts found for this request.", "Warning"); } Cursor.Current = Cursors.Default; }

16. Follow this code with the code for the Delete menu item:
private void menuItemDelete_Click(object sender, EventArgs e) { Contact delCont = Contact.FindByPrimaryKey(999); delCont.Delete(); delCont.SubmitPending(); SUPUtility.doSync(); }

17. Finish this form code with the Find button code:
private void buttonFind_Click(object sender, EventArgs e) { Cursor.Current = Cursors.WaitCursor; List<Contact> contList = Contact.FindByLastName(textBoxLast.Text); if (contList.Count > 0) { string[] custHdr = new string[3]; custHdr[0] = "Last"; custHdr[1] = "City"; custHdr[2] = "State";

SUPUtility.setUpListView(custHdr, listViewContacts);
Lab 8 - 30 Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0 2012 Sybase, Inc.

Module 8: Sybase Unwired Platform Client APIs


for (int i = 0; i < contList.Count; i++) { ListViewItem item = new ListViewItem(contList[i].First_name); item.SubItems.Add(contList[i].Last_name); item.SubItems.Add(contList[i].City); item.SubItems.Add(contList[i].State); listViewContacts.Items.Add(item); } } else { MessageBox.Show("No contacts found for this request.", "Warning"); } Cursor.Current = Cursors.Default; } } }

18. Save your work. 19. This completes all of the forms for the SUP Sample Project. The next step is to deploy and test the application. 20. This completes Task 8.

Task 9: Deploy and Test the Application


Description Procedure In this task, you will deploy and test the Visual Studio application. 1. Launch your Windows Mobile emulator and confirm that the emulator is connected and cradled. The cradled icon is displayed when the emulator is cradled and ready to accept deployment of the application. 2. From the Visual Studio menu select Debug Start Debugging. 3. Deploy window is displayed. Select the Windows Mobile 6 Professional Emulator and click Deploy:

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 8 - 31

Lab Workbook

4. Go back to the Windows Mobile emulator and the SUP Sample Application should be displayed:

5. Enter the login credentials: a. User ID: supAdmin b. Password: s3pAdmin 6. Click the Log in button and this window will be displayed.

Lab 8 - 32

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 8: Sybase Unwired Platform Client APIs

7. Double click the Customers link and a list of customers are retrieved from the database:

8. Double click Customer 103 and click the Details button. (If the Customer Details window appears blank, close the window and ensure that you double click the customer and single click the Details button.) 9. The customer detail for Customer 103 is displayed. Notice that the information is grayed out:
2012 Sybase, Inc. Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0 Lab 8 - 33

Lab Workbook

10. You can edit detail information on this window. Click Edit and change the name of the company to, Darling Company and click Save. The Main window is displayed. Click the Customers link again. 11. Scroll to the bottom of the customer list and Customer 103 is displayed with the new name of Darling Company. 12. Close the Customer Detail window. Back at the Main window, click the Contacts link and the Contacts window is displayed:

Lab 8 - 34

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 8: Sybase Unwired Platform Client APIs 13. Click the Retrieve button and all contacts in the City of Emeryville, CA are retrieved from the database:

14. (Optional Exercise): You can write code for the Delete button of the Edit menu to delete a contact. 15. This concludes Lab 8-1. Using the code samples provided in this lab, you should be able to write a mobile application that will run on a Windows Mobile device that will retrieve data from a database. 16. This completes Task 9, Lab 8-1.

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 8 - 35

Lab Workbook

Lab 8 - 36

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 9: Android Native Application Development

Module 9: Android Native Application Development Lab 9-1: Developing an Android Native Application
Lab setup Before you begin: Objectives Please complete all previous labs

After completing this lab, you should be able to: Import a Mobile Application using Unwired Platform Use code generated from Sybase Unwired Platform as the application back-end source code Install the Android ADT Eclipse Plugin into Unwired WorkSpace Use the Android ADT to build an Android Application Test the Application using an Android Virtual Device

Description

In this lab, you will import an existing Unwired Platform project as the basis of a mobile application. You will use the Android ADT to create a mobile application that uses the Sybase Unwired Platform Client APIs to extract data from Unwired Server. 1. Import a Project into Unwired WorkSpace 2. Create an Android Virtual Device 3. Install ADT into Unwired WorkSpace 4. Generate Java Object API 5. Create an Android Project 6. Define Application Properties 7. Create the User Interface 8. Launch and Test the Application

Task outline

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 9 - 1

Lab Workbook

Detailed Instructions Task 1: Import a Project into Unwired WorkSpace


Description In this task, you will add an existing project to your workspace to use as the basis for the Android Mobile Application. We will be using a project called MobileApp. 1. Open Unwired WorkSpace and select File Import. 2. At the Import Source screen, select General Existing Projects into Workspace. 3. Click Next. 4. Browse to the projects root directory: C:\Sybase Courses\SUP521\Lab Resources\MobileApp.zip. 5. Click Finish. You have imported the Sample project into the Unwired Workspace. 6. In Unwired Workspace, expand the MobileApp project folders to view all of the artifacts imported with the imported project. The MBO folder should display the Customer and Sales_Order MBOs:

Procedure

Lab 9 - 2

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 9: Android Native Application Development 7. The next step is to deploy the MobileApp project. Select the MobileApp project, right click in the Mobile Application Diagram window and select Deploy Project. 8. Deploy the project as an Update process and a Replication-based application. 9. When prompted for database information, select the sampledb. 10. Once the project deployment completes, confirm that the project package is displayed in the Enterprise Explorer. 11. The MobileApp.pkg is created and displayed in Enterprise Explorer:

12. Next step is to creat the mobile deployment package for the project. From WorkSpace Navigator, select the MobileApp project and select Create Mobile Application Package... 13. The completed MobileApp project will appear as this in the WorkSpace Navigator with the .package file displayed:

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 9 - 3

Lab Workbook

Task 2: Create an Android Virtual Device


Description Procedure In this task, you will create an Android Virtual Device to test the Android application. 1. From the Start menu select All Programs Android SDK Tools AVD Manager.

2. Click the New... button and name the virtual device Android Simulator and complete this window as: a. Target select Android 4.0.3 API Level 15 b. SD Card enter 96 MiB as the default c. Skin select Built-in Default WVGA800
Lab 9 - 4 Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0 2012 Sybase, Inc.

Module 9: Android Native Application Development d. Hardware values accept default settings

3. Click Create AVD and a confirmation message is displayed:

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 9 - 5

Lab Workbook

4. This completes Task 2.

Task 3: Install ADT into Unwired WorkSpace


Description In this task, you will install the Android ADT into Unwired WorkSpace. The Android ADT extends Eclipse functionality so an Android application can be created and deployed from within Unwired WorkSpace. 1. Launch Unwired WorkSpace. 2. Select Help Install New Software and the Available Software window is displayed. Click the Add button and the Add Repository dialog box is displayed:

Procedure

Lab 9 - 6

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 9: Android Native Application Development

3. Click the Archive button and navigate to: C:\Sybase Courses\SUP521\Lab Resources 4. Select the ADT_15.0.1.zip file and click Open. 5. On the Add Repository window, enter a name of Android Plugin. 6. Click the Developers Tools checkbox and click Next:

7. Developer tools that will be installed are displayed:

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 9 - 7

Lab Workbook

8. When ADT installation completes, close Unwired WorkSpace. 9. Launch Unwired WorkSpace again and this window appears:

10. Click the Use existing SDKs radio button and click Finish. 11. Notice the new Android icons that are installed as part of the Android ADT plug-in to Eclipse:

Lab 9 - 8

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 9: Android Native Application Development

12. This completes Task 3.

Task 4: Generate Java Object API


Description In this task, you will extract the JAR file from the deployed MobileApp project and then generate code for the Android application using the code generation utility provided with Sybase Unwired Platform. 1. First, locate the package file for the MobileApp project that was imported and deployed in Task 1. Using Windows Explorer, locate the default_package JAR file at: C:\Sybase Courses\SUP521\Student\MobileApp\Deployment\.pkg.profile\My_Unwired_Server 2. Copy the default_package.jar file to the C:\temp directory. 3. Open a Command prompt and navigate to the JDK directory at: C:\Sybase\UnwiredPlatform\JDK1.6.0_26\bin 4. At the command prompt, enter this command to extract the deployment_unit.xml file from the MobileApp default_package.jar : jar xf c:\temp\default_package.jar deployment_unit.xml

Procedure

5. When the jar utility completes, use Windows Explorer to navigate to the C:\Sybase\UnwiredPlatform\JDK1.6.0_26\bin directory to confirm that the deployment_unit.xml file was extracted. 6. Copy the deployment_unit.xml file to the C:\temp directory. 7. Create a new diectory at C: called C:\temp_code.

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 9 - 9

Lab Workbook 8. Next step is to use the code generation utility of Sybase Unwired Platform to generate the application object code. At a command prompt, navigate to: C:\Sybase\UnwiredPlatform\MobileSDK\ObjectAPI\Utils\bin 9. Enter this command: codegen.bat java client android ulj c:\temp\deployment_unit.xml output c:\temp_code 10. Ignore these warnings: Log4j: WARN No appenders could be found for logger.... Log4j: WARN Please initialize the log4j system properly. 11. Confirm that the ObjectAPI code was generated in the temp_code directory for the MobileApp project. The full directory of the temp_code directory is: C:\temp_code\genfiles\java\src\MobileApp

12. This completes Task 4.

Lab 9 - 10

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 9: Android Native Application Development

Task 5: Create the Android Project


In this task, you will create the Android project using the Android ADT within Unwired WorkSpace. 1. Open Unwired WorkSpace and select File New Project and select Android Android Project:

Description

Procedure

2. Click Next and name the project AndroidMobileApp. Confirm that the Use default location and Create new project in workspace items are checked:

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 9 - 11

Lab Workbook

3. Click Next and in the Select Build Target window, you will designate the Build Target by selecting the default that is installed in the classroom environment:

4. At the Application Information window enter: a. Application Name AndroidMobileApp b. Package Name com.sybase.sup.samples.objectapi c. Create Activity confirm this checkbox is check and the name of the activity is: AndroidMobileAppActivity

Lab 9 - 12

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 9: Android Native Application Development

5. Click Finish to create the AndroidMobileApp project. 4. View the completed Android project in the Package Explorer:

5. Next, we will add External Jar files to the project. From Package Explorer, select the AndroidMobileApp.
2012 Sybase, Inc. Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0 Lab 9 - 13

Lab Workbook 6. From the Eclipse menu, select Project Properties Java Build Path and select the Libraries tab:

7. Click Add External JARs button and navigate to this directory: C:\Sybase\UnwiredPlatform\MobileSDK\ObjectAPI\Android 8. Select these JAR files and click Open: ClientLib.jar sup-client.jar UltraLiteINI12.jar 9. Click OK at the Java Build Path window:

Lab 9 - 14

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 9: Android Native Application Development

10. In Package Explorer, expand Referenced Libraries to view the added JAR files. 11. Next step is to add a compiler resource to the project. Using Windows Explorer, naviagate to this directory: C:\Sybase\UnwiredPlatform\MobileSDK\ObjectAPI\Android 12. Copy the armeabi folder. 13. Return to Package Explorer and select the AndroidMobileApp project. 14. Right click and select New Folder to create a new folder in the project. 15. Label this folder libs. 16. Paste the armeabi folder into the libs folder. 17. This completes Task 5.

Task 6: Define Application Properties


In this task, you will modify the projects AndroidManifest.xml file to define user permissions and activities. You will also copy generated Object API code to the project. 1. From Package Explorer, expand the AndroidMobileApp project if not already open. 2. Double click the AndroidManifest.xml file and click the AndroidManifest.xml tab in the lower right corner of the window:

Description

Procedure

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 9 - 15

Lab Workbook

The AndroidManifest.xml file should open in the tab. 3. Modify the AndroidManifest.xml text as: Below this line: <uses-sdk android:minSdkVersion=8 /> Add these lines: <uses-permission android: name=android.permission.INTERNET></uses-permission> <uses-permission android:name=android.permission.READ_PHONE_STATE></usespemission> 4. Next, add Activity information to the project. Modify the AndroidManifest.xml file as: Below this line: </activity> Add these lines: <activity android:name=.DetailActivity android:label=@string/app_name> <intent-filter>
Lab 9 - 16 Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0 2012 Sybase, Inc.

Module 9: Android Native Application Development <action android:name=android.intent.action.MAIN/> <category android:name=android.intent.category.LAUNCHER/> </intent-filter> </activity> 4. Save changes to the AndroidMobileApp project:

If there are any errors in the AndroidManifest.xml file, the project will not save. Troubleshoot any errors to continue. 5. Click the Manifest tab:

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 9 - 17

Lab Workbook

NOTE: If you do not see a tab at the bottom of this window, click the >>1 button to display additional tabs. 6. On the Android Manifest tab, confirm that the Package address is: com.sybase.sup.samples.objectapi 7. Now we will copy the generated ObjectAPI code in the MobileApp directory into the AndroidMobileApp project. Using Windows Explorer, navigate to this directory: C:\temp_code\genfiles\java\src\MobileApp 8. Copy the MobileApp directory and all files. 9. In Package Explorer, paste these files to the src folder of the AndroidMobileApp project. The AndroidMobileApp project should now look like this in Package Explorer:

Lab 9 - 18

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 9: Android Native Application Development

5. Select File Save to save the project. 6. This completes Task 6.

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 9 - 19

Lab Workbook

Task 7: Create the User Interface


Description Procedure In this task, you will use sample code files to create an Android application user interface. 1. From Windows Explorer, navigate to this directory: C:\Sybase Courses\SUP521\Lab Resources 2. Locate the file AndroidMobileAppActivity.java file and right click on the file and select Edit with Notepad + +. 3. Scroll down to this line in the file: //public static string HOST = 4. Change the HOST port to the IP address of your individual VM. You can find this IP address by clicking on the WinIPConfig icon on your desktop. 5. Save the changes to the AndroidMobileAppActivity.java file. 6. Now, copy these java files: CustomerListAdapter.java DetailActivity.java AndroidMobileAppActivity.java 7. Back in the Android Package Explorer, paste these java files into the Project src folder: src\com.sybase.sup.samples.objectapi 4. When prompted, select Copy over existing files. 5. The next step is to copy XML layout files to the project. Navigate to C:\Sybase Courses\SUP521\Lab Resources 6. Copy these files: Customer.xml Detail.xml Main.xml 7. In Package Explorer, paste these files into the AndroidMobileApp project at this folder: res\layout 8. Save the AndroidMobileApp project. 9. This completes Task 7.
Lab 9 - 20 Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0 2012 Sybase, Inc.

Module 9: Android Native Application Development

Task 8: Launch and Test the Application


Description In this task, you will launch the Android Virtual Device Simulator to test the application. You will also modify data on the mobile applicaiton and review the changes. 1. From Package Explorer, right click the AndroidMobileApp project and select Run As Run Configurations and the Run Configurations window is displayed:

Procedure

New button

2. Click Android Application and click the New button (in the upper left corner) to create a new Android Application configuration. 3. In the Run Configurations window, enter AndroidMobileApp for the name. Click Browse to navigate to the AndroidMobileApp:

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 9 - 21

Lab Workbook

4. Click the Launch Default Activity radio button. 5. Click the Target tab and select Automatic and AVD for a Deployment target:

6. Click Apply and Close on the Run Configurations window.


Lab 9 - 22 Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0 2012 Sybase, Inc.

Module 9: Android Native Application Development 7. Now we are ready to run the application. From Package Explorer, select the AndroidMobileApp project and select Run As Android Application. 8. After a few moments the Android Virtual Devices home screen will be displayed:

9. After a few minutes, the emulator will display and the AndroidMobileApp program will launch. 10. If the Apps window is not displayed on the emulator, click the MENU button in the right pane and the Apps window is displayed, with the AndroidMobileApp application displayed on the emulator:

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 9 - 23

Lab Workbook

11. Double click an entry in the list and change the name and click Submit:

10. Review the updated customer list:

Lab 9 - 24

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 9: Android Native Application Development

11. This completes Task 8 and Lab 9-1.

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 9 - 25

Lab Workbook

Lab 9 - 26

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 10: Data Change Notification (DCN) and Push

Module 10: Data Change Notification (DCN) and Push Lab 10-1: Implementing Regular DCN with Payload
Objectives After completing this lab, you should be able to: Description Implement a regular Data Change Notification with Payload

In this lab, you will create and deploy a simple DCN project with just one MBO based on a database table within the sample database. You will connect to the CDB and identify which table will be used to store your MBO data. After creating an update Data Change Notification in a text editor, you will send the Data Change Notification to the Unwired Server using Internet Explorer. After receiving the message from the Unwired Server, you will check the CDB to verify that your data has changed.

Lab scenario and assumptions

The scenario and assumptions for this lab are as follows: You will create a Data Change Notification with Payload. You will execute the DCN manually via a browser. This will simulate that a change to the backend data has occurred and a process in the backend has executed the DCN to update the CDB. The lab will not have you configure any backend EIS customizations that would otherwise be required to automate the DCN feature from start to finish. For instance, in a production environment, you would create a trigger in a database-driven mobile application that would execute the DCN when data change is detected on data relevant to the DCNs MBOs. How you choose to execute the DCN upon EIS data change detection depends on your EIS system and its capabilities and/or implementation e.g. some systems employ the use of user exits, triggers, Java programs, etc.. For this lab, it is far more important to understand and learn how to create a DCN. Therefore, this lab will not concern itself with the actual change of data on the sampledb database (our class EIS database), but will assume that this change event has occurred and a trigger, for example, will have executed the DCN. In order to stay focused on DCN creation, you will create the DCN and deploy it in the easiest way possible by executing it through Internet Explorers Address box. Not only will you clearly see that the DCN executes on the Unwired Server, but you will also see the acknowledgement message sent from the Unwired Server of the execution and impact to the servers CDB. You will then go into the CDB to verify that your data change has been applied to the CDB. Lastly, this lab will also not concern itself with the synchronization choices you will make to synchronize the CDB and the device data. Using what you have already learned about MBO development and synchronization configurations and such, it will be up to you to decide the best way to synchronize the device data with the CDB once the DCN has notified and updated the Unwired Servers CDB.

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 10 - 1

Lab Workbook

Task outline

1.

Implement Regular Data Change Notification

Lab 10 - 2

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 10: Data Change Notification (DCN) and Push

Detailed Instructions Task 1: Implement Regular Data Change Notification


Description In this task, you will create and deploy a simple Data Change Notification project with just one MBO based on a database table within the sample database. 1. Go to your Unwired WorkSpace. 2. Close all other projects in your workspace by right-click on each project folder and selecting Close Project .This makes things easier during development. Generally it is recommended to work with only one project at a time. After completing this lab, do not forget to close your new project and reopen your old projects again. 3. Create a new project in the Unwired Workspace. Name your project DCN- and suffix it with your initials and birth month and day: I.e. DCN-VMF0409. This will help to find the MBO tables in the CDB later:

Procedure

4. If not already connected, connect to your My Sample Database using your Enterprise Explorer. 5. In the Enterprise Explorer open the Tables subfolder and drag the customer table to the Mobile Application Diagram. 6. In the following Quick Create Wizard rename your MBO to DCN_ and suffix it with your initials and then _Customer: I.e. DCN_VMF_Customer.. Accept all default settings:

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 10 - 3

Lab Workbook

7. Click OK. You should have a new DCN_initials_Customer MBO with three operations:

Lab 10 - 4

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 10: Data Change Notification (DCN) and Push

8. Make sure that your Developer Profile in Eclipse is set to Advanced. Navigate to your Cache Groups folder in your Workspace Navigator and expand the Default cache group folder structure:

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 10 - 5

Lab Workbook 9. Right-click the Default Cache Group and select Properties. The Properties dialog appears. 10. Click the Policies tab. 11. Change the Cache Group Policy for Default to Scheduled and set the cache interval to 5 minutes:

12. Click OK. This will have two effects during your test. a. Effect 1 - the customer data in the CDB will be initially loaded after deployment of your package. b. Effect 2 - every five minutes the customer data will be retrieved anew from the backend (sampledb). 13. Save your project. 14. Now, right-click on your project and select Deploy Project. 15. For this deployment, select as deployment type Replace and RBS as the synchronization method. 16. Name your package DCN_ and your initials: I.e. DCN_VMF 17. Leave all the other options at their default values:

Lab 10 - 6

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 10: Data Change Notification (DCN) and Push

18. Click Next.

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 10 - 7

Lab Workbook 19. Select your Customer MBO to deploy:

20. Click Next. 21. We do not have any user defined JARs. Click Next.

Lab 10 - 8

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 10: Data Change Notification (DCN) and Push 22. Select your Unwired Server connection profile:

23. Click Next. 24. Select your Database connection profile My Sample Database and select the appropriate sampledb hosted by the shared SUP Server:

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 10 - 9

Lab Workbook

25. Click Next. 26. Click Finish to complete the wizard. Make sure that your MBO is indeed deployed to your Unwired Server:

Lab 10 - 10

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 10: Data Change Notification (DCN) and Push

27. This completes the setup portion of your test scenario. Create Connection Profile for CDB 28. To verify that your DCN project actually changes data stored in the CDB, it is helpful to create a database connection profile for your CDB. NOTE: Remember that the CDB is shared in the classroom envirnment and fully selfmanaged by the Unwired Server and you should NEVER apply any changes manually to the structure or data in the CDB. Notice that this rule does not apply when a Sybase Technical Support Engineer explicitly asks you to perform a change as part of a support call. 29. To create a connection profile to the CDB, perform the following. Right-click on the Database Connections folder in your Enterprise Explorer and select New. 30. In the New Connection Profile dialog, select Sybase ASA as database type and name your connection profile CDB_Connection. Provide a meaningful description, if you desire:

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 10 - 11

Lab Workbook

31. Click Next. 32. On the next dialog window, select the Sybase ASA v12.x for Unwired Server Default driver. 33. Type supdata2server on port 5200. Port number 5200 is the default port number for the Unwired Server CDB. 34. Change the Database Name to default.

Lab 10 - 12

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 10: Data Change Notification (DCN) and Push 35. Leave the User name and password at their defaults: dba and sql:

36. Test your connection using the Test Connection button. Also select the option Connect when the wizard completes so that you do not have to manually connect to the CDB later. 37. After successfully testing your connection, click finish. Locating the Customer Table

38. Expand your Tables subfolder under your CDB_Connection profile in the Unwired WorkSpace Enterprise Explorer. 39. Expand the table folder that starts with: [#should_delete_sk dl_........]: 40. Locate the Table named d1_dcn_[your initials]1_0_dcn_[your initials]_63867. Keep in mind that the naming of these tables will be different depending on your

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 10 - 13

Lab Workbook environment:

41. Expand the table and then the Columns nodes. You will see that your attribute names will be listed there, along with some other columns Unwired Server has added. You should see something similar to this:

Lab 10 - 14

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 10: Data Change Notification (DCN) and Push

Verifying Current Data

42. Right-click on the table and select Edit Data.

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 10 - 15

Lab Workbook 43. Click OK to the resulting SQL dialog, so that the table data will display:

44. You can see that your table is already populated with the sampledb data per the requirements of your deployment options. For now, close the Edit Data view that displays the table content. Creating Templates: 45. You will now create a new folder to your project to store a template DCN. A best practice is to create folders for templates and such near your MBO folder, so that you can more easily change your DCN templates when your MBO defintions change. Recall that this type of DCN (with Payload), your DCN template and its associated MBO structures/definitions have to be identical. 46. Right-click on your project in the Workspace Navigator and select New Folder. In the resulting dialog window, enter the folder name: DCN_Resources. 47. Click Finish: 48. Right-click on your newly created DCN_Resources folder and select New Other...:

Lab 10 - 16

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 10: Data Change Notification (DCN) and Push

49. Expand the General folder and select the Untitled Text File option:

50. Click Finish. You do not name the file at this time. 51. Now you will need to create the DCN in this new file. Base your DCN on the information in the table below. Review the table first and look at each parameter before you begin to construct your DCN string in the file you just created. You can provide a description for each DCN option in the table below for your own records, so that you gain a better understanding of what information is needed and why:
2012 Sybase, Inc. Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0 Lab 10 - 17

Lab Workbook

Type/Parameter Protocol

Value http

Description

Servername

localhost

SUP Server name

Portnumber

8000

Servlet name

/dcn/DCNServlet

URI parameters: cmd dcn

username

supAdmin

password

s3pAdmin

domain

Default

package

DCN:1.0

Your package name

dcn_request pkg

See below None

messages

See next parameters

id

333

op

:upsert

mbo

customer

cols
Lab 10 - 18

The column names and values are not provided here in this table. It is up to you to decide what columns are needed and
2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Module 10: Data Change Notification (DCN) and Push find the appropriate names and values in your CDB table itself.

52. After reviewing your DCN parameters, construct your DCN string. Your string should appear similar to the following: http://sup1.education.sybase.com:8000/dcn/DCNServlet?cmd=d cn&username=supAdmin&password=s3pAdmin&domain=Default&pack age=DCN_VMF:1.0&dcn_request={"pkg":"dcn_vmf","messages":[{ "id":"abc","op":":upsert","mbo":"DCN_VMF_Customer", "cols":{"address":"address","city":"city","company_name":" company","fname":"fname","id":"939","lname":"lname","phone ":"phone","state":"CA","zip":"90210"}}]} The three areas which definitely require changes are the host name, Package name and version number. For example: http://sup1.education.sybase.com:8000/... ... &package=DCN_VMF:1.0&...

...dcn_request={"pkg":"dcn_vmf","... NOTE: In case you do not want to type the entire string, you can find the solution in your Lab Resources folder in a file by the name of DCN_Update_On_Customer.txt. 53. Now, change the flname value in the string to Jacob: for example:

..."fname":"Jacob","id":"939...

54. Save the file now as DCN_Update_On_Customer. Make sure that you expand the folders:

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 10 - 19

Lab Workbook

55. Click OK. 56. Copy your DCN file contents to the clipboard and open Internet Explorer. 57. Paste your DCN string into the address bar of your Internet Explorer:

NOTE: This is a partial of the string due to the visible length of the address bar.
Lab 10 - 20 Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0 2012 Sybase, Inc.

Module 10: Data Change Notification (DCN) and Push

58. In seconds, you should see a response returned from the Unwired Server similar to one below:

[{"recordID":"abc","success":true,"statusMessage":""}] 59. If you receive an error. Study the error message carefully and correct the errors one by one until you see a successful message. The error messages that the Unwired Server returns are very helpful in detecting the problem areas in your DCN string. Here is an example whereby we inadvertently changed the MBO name to Customers:

Error and description from Unwired Server:

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 10 - 21

Lab Workbook

The error message:

. . . Problem accessing /dcn/DCNServlet. Reason:


[{"recordID":"abc","success":false,"statusMessage":"VirtualTable Name is null. MBO name Customers might be incorrect or with missing capitalization in the DCN request"}]

Verifying the Data Change in the CDB 60. Now, let us verify that the DCN actually changed the values in the CDB. Go to the Enterprise Explorer and locate the table again that contains your customer table data:

Lab 10 - 22

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 10: Data Change Notification (DCN) and Push

61. Right-click on the table and select Edit Data. Make sure that you select at least 1000 maximum rows to retrieve. Click OK to the Table Data Filter dialog window. 62. In the toolbar, click the Refresh button or press F5 to make sure your view is up to date. 63. You should see your new data by locating the record 939. This is not a very exciting row of data but it illustrates how to use DCN to update the CDB, which in turn will update device data. Now edit your DCN string to change the fname column value to your first name. Copy the revised DCN string and paste it into the Internet Explorer Address box. Run the address bar execution. 64. Go back to your Unwired WorkSpace and refresh the table data. You will see that the change impacted the CDB again. Notice that the lname and other values are the same. Just the change to the fname column value has changed in the case here, the name is Jacob:

65. At this point, what is the current state between the CDB and the backend EIS database data (e.g. sampledb)? You have changed the cache directly using a DCN, but the current state of the EIS database is still not in sync with the change impacted by the DCN. So, in fact we created a mismatch. This is, of course, not what you typically want to see in production. Hence, it is important that you use your EIS as the author of the change and not a manual update as we just performed. If the change originated in the EIS via a trigger or other external process, then the data between the EIS and the CDB would be in sync. The only piece missing would be how you would perform a CDB-to-device synchronization. If you recall, we changed the MBO synchronization to occur every five minutes. Therefore, theoretically the CDB would push out the update to the local device database every five minutes. 66. This completes Task 1 and Lab 10-1.

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 10 - 23

Lab Workbook

Lab 10-1: Implementing Regular DCN with Payload Solution


Type/Parameter Protocol Value http Description Used protocol for communication with the server Server hostname SUP Portnumber for receiving DCNs SUP Servlet Name for non authenticated DCNs

Servername Portnumber Servlet name URI parameters: cmd username password

localhost 8000 /dcn/DCNServlet

dcn supAdmin s3pAdmin

DCN command for regular DCN Login of a user with DCN rights Password

domain package dcn_request pkg

Default DCN:1.0 See below None

Domain to which the DCN belongs Package name including version number

Package name that is a placeholder and will be ignored The message array Self generated message id DCN operation for updating or inserting The mbo that needs to be changed

messages id op mbo cols

See next parameters 333 :upsert customer

"address":"adress","city":"city","company_name":"company", "fname":"fname","id":"939","lname":"lname","phone":"phon e","state":"CA","zip":"90210"


2012 Sybase, Inc.

Lab 10 - 24

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Module 10: Data Change Notification (DCN) and Push

The complete DCN string should appear as follows: http://localhost:8000/dcn/DCNServlet? cmd=dcn& username=supAdmin& password=s3pAdmin& domain=Default& package=DCN:1.0& dcn_request= { "pkg":"dummy", "messages":[ { "id":"abc", "op":":upsert", "mbo":"Customer", cols":{ "address":"address", "city":"city", "company_name":"company", "fname":"fname", "id":"939", "lname":"lname", "phone":"phone", "state":"CA", "zip":"90210"} }] }

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 10 - 25

Lab Workbook

Lab 10-2: Implementing WF-DCN for Workflow Mobile Applications


Objectives After completing this lab, you should be able to: Description Implement a workflow Data Change Notification (WF-DCN)

In this lab, you will create and test a simple workflow Data Change Notification. You will use the Vacation Request Workflow you imported in your previous labs as a basis for your DCN driven lab. You will begin by creating a workflow DCN and then send the DCN to the Unwired Server in the same manner as you did in the last lab. This DCN will be used instead of the email inbox notification feature in the SCC, whereby the EIS database sends the notification email via an insert trigger. Now, recall that DCN requires participation from the EIS data source as the generator of the DCN. It is the EIS that would invoke a process like a trigger to send the WF-DCN to the Unwired Server. Creating triggers and the like is a EIS DBA function and is beyond the scope of this lab.

Lab scenario and assumptions

The scenario and assumptions for this lab include that you should have successfully completed all labs in this course relating to the Vacation Request workflow.

Task outline

1.

Implement WF-DCN for Workflow Mobile Applications

Lab 10 - 26

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 10: Data Change Notification (DCN) and Push

Detailed Instructions Task 1: Implement WF-DCN for Workflow Mobile Applications


Description In this task, you will create and test a simple Workflow Data Change Notification (WFDCN) on the ApprovalRequest workflow to replace the standard email driven notification. 1. Close all other projects in your workspace EXCEPT for the Vacation Request projects by right-clicking on each project folder and selecting Close Project .This makes things easier during navigation in the Unwired WorkSpace. Generally it is recommended to work with only one project at a time. 2. Locate your VacationRequestWorkflow project:

Procedure

NOTE: If you have NOT completed the previous labs or have removed the project from your Unwired WorkSpace, you can import the project from your Lab Resources folder: VacationRequestWorkflow_Solutions.zip. If you are importing the Vacation Request project from the beginning, you will need to perform the following: a. Verify that you have created the VacationRequests and VacationApprovers tables in the sample database. If not, you must create them with the VacationRequests.sql script located in your project and execute it. b. Verify that both emulators (BlackBerry 9800 and Windows Mobile 6 Professional) are up and running. Windows Mobile 6 must be cradled.
2012 Sybase, Inc. Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0 Lab 10 - 27

Lab Workbook c. Deploy the MBOs of the project to the shared Unwired Server using the replace deployment type. Remember to set the synchronization to MBS. 3. Now, go to your SCC and select the shared Unwired Server (i.e. sup1). If you have not performed your previous labs, you can launch Internet Exploror and the SCC via the URL: https://sup1.education.sybase.com:8283/scc/ a. If this is the first time you launch the SCC, Internet Explorer will present a certificate error. For the class, you can safely ignore this error. Click Continue to this website (not recommended):

b. Log into the SCC using a user name of supAdmin and a password of s3pAdmin. The user name and password are case-sensitive. c. If you get a Flash Player needed error, please install the Flash Player available at the Adobe site. If you have performed all your previous labs, you should have already configured your SCC. 4. Select the Workflows folder.

Lab 10 - 28

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 10: Data Change Notification (DCN) and Push 5. Locate the ApprovalRequest workflow listed recall that you have added your last name and birth month and day to the naming of your applications. Make sure that you select your workflow application in the SCC:

6. Delete the ApprovalRequest workflow by selecting it and then clicking the Delete button. 7. Return to your Unwired WorkSpace. We are going to apply some changes to the email driven workflow. 8. Locate the ApprovalRequest.xbw form in your WorkSpace Navigator. Your Mobile Workflow Forms Editor should open. Recall that your naming will be different from the screen shots in this lab book. You MUST apply changes ONLY to your workflows. 9. Click the workflow Flow Design view:

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 10 - 29

Lab Workbook 10. In the toolbar, click the Mobile Workflow Package Generation button or right-click and select Generate Mobile Workflow Package:

11. Package Generation wizard will appear. 12. Set the settings: a. Generate Generate into the project b. Deploy to an Unwired Server New (recall that you deleted the workflow in the SCC. Hence, your only option is to deploy a new workflow. Otherwise, you would have set this option to Replace.) c. Uncheck Assign workflow user(s). Do not assign the workflow to any device users yet. You will configure this in the SCC later.

Lab 10 - 30

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 10: Data Change Notification (DCN) and Push

13. Click Finish. 14. Now, go to the Windows Mobile 6 Professional Emulator and make sure that the Messaging client is still active and you are activated as the boss user. If you have accidentally closed your Emulator, relaunch it and make sure it is cradled. If your emulator is still launched from your previous labs, go to the next step.

15. Go to the SCC and select the Workflow package ApprovalRequest:1 (Recall that your naming is different). 16. Select the Application Connections tab:

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 10 - 31

Lab Workbook 17. Click the Assign Workflow.... button:

18. Search for the boss user and select it:

19. Click OK.

Lab 10 - 32

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 10: Data Change Notification (DCN) and Push 20. You should see an Assignment was successful return message:

21. Go to your BlackBerry simulator and send a new Vacation Request as you have already done in previous labs. If your BlackBerry simulator is not running, you will need to follow the setup instructions in the previous labs to send a successful Vacation Request to the Unwired Server. Your Windows Mobile 6 Professional emulator should contain and email in the boss inbox with an email notification that a request is waiting for approval. This message was triggered by the database trigger to the Unwired Server Notification Inbox. Using WFDCN 22. Now, you will use the WF-DCN instead of the email notification feature to send change notifications to the boss user device in the Unwired Server. 23. Go to your Unwired WorkSpace. 24. Create a new folder in your project by right-clicking your project folder and selecting New Folder.

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 10 - 33

Lab Workbook 25. Name the folder WF-DCN:

26. Click Finish.

Lab 10 - 34

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 10: Data Change Notification (DCN) and Push 27. Now, import a pre-defined WF-DCN file into your project folder. Right click your new WF-DCN folder and select Import. From the tree select General File System.

28. Click Next. 29. Browse to the Lab Resources directory under c:\Sybase Courses\SUP521\Lab Resources and select the WF-DCN.txt file from the right side of the File System Import dialog:

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Lab 10 - 35

Lab Workbook

30. Click Finish. 31. Open the file by double-clicking it in the Workspace Navigator. 32. Examine the Data Change Notification string. You will see many modifications or new requirements as compared to the Regular DCN string. For example: a. The http parameter cmd has changed to wf b. The security configuration parameter was added. This is mandatory. It has the value admin. c. The dcn_request now contains name key pairs that look similar to an email. This is needed to apply the matching rule to the DCN values. d. The data part contains the whole regular DCN structure including the message array.

Lab 10 - 36

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 10: Data Change Notification (DCN) and Push Below is the first readable structured version of the WF-DCN: http://sup1.education.sybase.com:8000/dcn/DCNServlet? cmd=wf& security=admin& username=supAdmin& password=s3pAdmin& domain=Default& package=VacationRequestWorkflow& dcn_request={ "id":"abc", "op":":upsert", "to":"supAdmin", "subject":"Vacation Request (44) is ready for approval.", "from":"employee@vmb508.education.sybase.com", "body":"none", "received":"2011-11-29T10:07:45+05:00", "read":false, "priority":true, "data": [{ "id":"Emulator94675387", "pkg":"vacationrequestworkflow:1.0", "messages": [{ "id":"msg_id23", "op":":upsert", "mbo":"VacationRequests", "cols":{ "appr_id":1, "request_type":"Thanksgiving", "end_date":"2011-1128", "req_id":44, "request_comments":"Would like it",
2012 Sybase, Inc. Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0 Lab 10 - 37

Lab Workbook "request_status":"1", "requestor":"John Hammel", "start_date":"2011-1124", "total_days":"4"} }] }] } 33. Below is the JASON string that you will use to paste into the Internet Explorer address box: http://sup1.education.sybase.com:8000/dcn/DCNServlet?cmd=wf&security=admin&u sername=supAdmin&password=s3pAdmin&domain=Default&package=VacationReq uestWorkflow&dcn_request={"id":"abc","op":":upsert","to":"supAdmin","subject":"V acation Request (44) is ready for approval.","from":"employee@vmb508.sybase.education.com","body":"none","receiv ed":"2011-1116T10:07:45+05:00","read":false,"priority":true,"data":[{"id":"Emulator18863105","p kg":"vacationrequestworkflow:1.0","messages":[{"id":"msg_id23","op":":upsert","mb o":"VacationRequests","cols":{"appr_id":1,"request_type":"Thanksgiving","end_date" :"2011-11-28","req_id":44,"request_comments":"Would like it","request_status":"1","requestor":"John Hammel","start_date":"2011-1124","total_days":"4"}}]}]}

Testing WFDCN

34. Notice that the file contains the DCN String two times. First in a formatted, readable structure and in a format that can be used to paste it into Internet Explorers address bar. 35. Copy the second DCN string version into your clipboard (Ctrl + C) and paste it into Internet Explorers address bar:

36. Press Enter to execute the DCN and send it to the Unwired Server.

Lab 10 - 38

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Module 10: Data Change Notification (DCN) and Push 37. You should get your success response:

38. If you get errors, try to resolve the error using the provided error messages. Possible issues could be: a. Shared Unwired Server URL. b. The naming of MBO and version number (if you have changed these in your labs). c. Your workflow package name and version. NOTE: The WF-DCN that is provided to you will not work unless you make the appropriate changes that are necessary in your own environment. Once you have defined your server URL and MBO/Package names and versions, etc. the DCN should work as expected.

39. After a successful submit of your DCN, go to your CDB Connection, locate and rightclick the appropriate d1_vacationrequestworkflow_xxxxx table and select Edit Data, etc. Take a look at the entry. There are many tables in the CDB, so locating your exact table may take a little investigating and time:

40. Close the table.


2012 Sybase, Inc. Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0 Lab 10 - 39

Lab Workbook 41. Now, go to your Windows Mobile emulators Outlook Email Inbox and check for incoming messages. There should be a new workflow waiting for an approval. 42. Open the workflow. As you can see, all the data that you submitted via your DCN is shown in the form. But remember, the data is now out of sync with the Unwired Servers CDB and the backend. So, if you try to update this workflow instance, it will fail because the Unwired Server will try to invoke the update MBO method for a vacation request instance that does not exist on the sampledb backend. As with the Regular DCN lab, a WF-DCN would need to be invoked by the EIS upon data change detection via a trigger, Java process, etc. The purpose of this lab is to teach you how to successfully create and use a WF-DCN as an option to send a notification instantly to a device. 43. This completes Task 1, Lab 10-2.

Lab 10 - 40

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

Appendix B: Administration for the Developer

Appendix B: Administration for the Developer


There are no labs in this module.

2012 Sybase, Inc.

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

Appendix B - 1

Lab Workbook

Appendix B - 2

Sybase Unwired Platform 2.1 Mobile Application Development Version 1.0

2012 Sybase, Inc.

*SUP521-90-0211-10-LW-S*
Printed In Canada

SUP521-90-0211-10

You might also like