Mobile Application Development

Case Studies

 

By V. Lee, H. Schneider & R. Schell

 

Pre-Requisites. 1

Chapter 7 – Client-Server Data Transfer 2

Merge Replication. 2

Server 2

Client 3

RDA.. 3

Server 3

Client 3

SOAP. 3

Server 3

Client 4

TCP/IP. 4

Server 4

Client 4

Chapter 11 – Mobile Museum Case Study. 5

Server 5

Chapter 12 – Mobile Biologist Case Study. 5

Server 5

Pocket PC Client 6

Tablet PC Client 6

Chapter 13 – Mobile Zoo Case Study. 7

Server 7

Client 7

 

Pre-Requisites

To run all of the complete samples you will need the following:

  1. Server, Desktop or Laptop running Windows XP Professional or Windows 2003 Server
  2. IIS 5.0 or higher
  3. SQL Server 2000 (with current service pack – we are using SP3)
  4. SQL Server CE 2.0 with Server Tools (with the same service pack as SQL Server 2000 – we are using sqlce20sql2ksp3a.exe)
  5. Visual Studio .NET 2003
  6. Tablet PC SDK
  7. Pocket PC or Emulator running Microsoft Windows Mobile 2003
  8. Tablet PC running Microsoft Windows XP Tablet Edition and SQL Server 2000 (we are using the Developer Edition)
  9. Cellular phone emulator (we are using the Nokia Mobile Internet Toolkit 4.0)

All instructions assume you have copied the source code into the following directory: C:\ MADCode

If you have installed the files in a different location, please substitute the appropriate path.

Chapter 7 – Client-Server Data Transfer

Merge Replication

The Merge Orders Sample application demonstrates database synchronization between a client and a server using SQL Server 2000 merge replication. The server application consists of a SQL Server 2000 database, a database publication, and the SQL Server CE 2.0 Server Tools. The Merge Orders PPC Client application demonstrates a Pocket PC fat client application that uses merge replication.

 

Server

  1. Set up the Mobile Orders Merge database
    1. Create a new database called “MobileOrdersMerge
    2. Restore the database using the file C:\MADCode\CommunicationSamples\MergeReplication\MergeOrdersSample\Server\Database\ MobileOrdersMerge.bkp
  2. Create a SQL Server publication
    1. Share the folder C:\ MADCode\CommunicationSamples\MergeReplication\MergeOrdersSample\Server\MobileOrdersReplData
    2. Create a new publication for the MobileOrdersMerge database:
      1. Right-click on the MobileOrdersMerge database and select New > Publication.
      2. In the publication wizard, select the following options:
        1. Select “Merge Replication”
        2. Select “Devices Running SQL Server CE”
        3. Publish all Tables
        4. Allow SQL Server to create unique identity columns and set the NOT FOR REPLICATION option on the Identity coumns
        5. Leave the publication name as “MobileOrdersMerge
        6. Accept the default to create the publication as specified
        7. Create the snapshot in \\<computername>\MobileOrdersReplData
  3. Install SQL Server CE 2.0 Server Tools
    1. Make sure you use the SQL Server CE 2.0 installation program that corresponds with the Service Pack on your SQL Server 2000 installation. For example, if you are running SQL Server 2000 SP3 or SP3a, you must install sqlce20sql2ksp3a.exe)
    2. When installing SQL Server CE, select Development Tools AND Server Tools.
    3. When the installation is finished, launch the Virtual Directory Creation Wizard. Name the virtual directory “sqlce” and allow anonymous access.
    4. Select the checkbox to enable merge replication.
    5. Enter the name of the share you created: \\<computername>\MobileOrdersReplData
    6. Open Internet Explorer and navigate to http://localhost/sqlce/sscesa20.dll and make sure you see the following message: SQL CE Server Agent

Client

  1. Open the Merge Orders PPC Client Solution
  2. Update the information in the config.xml file
  3. Build and deploy the solution to a Pocket PC or emulator

RDA

Server

  1. Set up the Mobile Orders RDA database
    1. Create a new database called “MobileOrdersRDA
    2. Restore the database using the file C:\MADCode\CommunicationSamples\RDA\RDAOrdersSample\Server\Database\ MobileOrdersRDA.bkp
  2. Install SQL Server CE 2.0 Server Tools (if not already done to set up merge replication)
    1. Make sure you use the SQL Server CE 2.0 installation program that corresponds with the Service Pack on your SQL Server 2000 installation. For example, if you are running SQL Server 2000 SP3 or SP3a, you must install sqlce20sql2ksp3a.exe)
    2. When installing SQL Server CE, select Development Tools AND Server Tools.
    3. When the installation is finished, launch the Virtual Directory Creation Wizard. Name the virtual directory “sqlce” and allow anonymous access.
    4. Open Internet Explorer and navigate to http://localhost/sqlce/sscesa20.dll and make sure you see the following message: SQL CE Server Agent

Client

  1. Open the RDA Orders PPC Client Solution
  2. Update the information in the config.xml file
  3. Build and deploy the solution to a Pocket PC or the Pocket PC emulator

SOAP

The SOAP Calculator sample application demonstrates communication between a client and server using SOAP. The server application consists of a web service that performs simple calculations. The SOAP Calculator PPC client demonstrates a Pocket PC fat client application that uses the web service.

Server

  1. Set up the web service:
    1. Before opening the Visual Studio Solution, you must create a new Virtual Directory under the Default Web Site.
    2. Open IIS
    3. Under the Default Web Site, add a new Virtual Directory called SOAPCalculatorServer
    4. The path for the directory is C:\MADCode\CommunicationSamples\SOAP\SOAPCalculatorSample\Server\SOAPCalculatorServer
    5. Allow anonymous access and accept all the defaults
  2. Build and test the application:
    1. Open the SOAP Calcuator Server Solution in the folderC:\ MADCode\CommunicationSamples\SOAP\SOAPCalculatorSample\
    2. Rebuild the web site
    3. Test the application by browsing to http://localhost/SOAPCalculatorServer/SOAPCalculator.asmx

Client

  1. Open the SOAP Calculator PPC Client Solution in the folder C:\MADCode\CommunicationSamples\SOAP\SOAPCalculatorSample\PPC\
  2. Update the information in the config.xml file
  3. Build and deploy the solution to a Pocket PC or the Pocket PC emulator

TCP/IP

The Communication Server sample application demonstrates TCP/IP communications between a server and a Pocket PC application. The server application runs as a Windows Service.



Server

  1. Open the Communication Server solution in the folder C:\MAD\MADCode\CommunicationSamples\TCPIP\CommunicationSample\Server\
  2. Rebuild the solution (debug or release version)
  3. Install the program as a service using installutil:
    1. Open a command prompt with the correct Path setting by going to: Start Menu > Programs > Microsoft Visual Studio .NET 2003 > Visual Studio .NET Tools > Visual Studio .NET 2003 Command Prompt
    2. Navigate to the directory C:\MADCode\CommunicationSamples\TCPIP\CommunicationSample\Server\CommunicationServer\bin\Debug (or Release, if applicable)
    3. At the prompt: installutil.exe CommunicationServer.exe
    4. Enter the id and password for the service account
  4. To verify the installation go to Control Panel > Administrative Tools >Services. Verify there is a service called “Communication Server”.
  5. Start Communication Server service, if necessary.

Client

  1. Note: This client will run on a Laptop PC or Pocket PC.
  2. Open the Communication Client solution in the folder C:\MADCode\CommunicationSamples\TCPIP\CommunicationSample\PPC
  3. Rebuild the CommunicationClient
  4. Run the CommunicationClient. You may deploy to a Pocket PC, or use the emulator.
  5. You may also go to the bin directory and run CommunicationClient.exe directly on your laptop or desktop computer.
  6. Enter the IP Address or name of your server (do not enter localhost).
  7. Type a phrase in the text box and hit Send.
  8. Your phrase will be echoed back to you, followed by <EOF>.

 

Chapter 11 – Mobile Museum Case Study

 

Server

  1. Set up the Mobile Museum database:
    1. Open the SQL Server Enterprise Manager
    2. Create a new database called “MobileMuseum
    3. Restore the database, using the file MobileMuseumBackup.bkp in the folder C:\MADCode\MobileMuseum\Server\Database
  2. Create the web sites:
    1. Before opening the Visual Studio Solution, you must create two web sites – one for the main web site and one for the “mobile” web site
    2. Open IIS
    3. Under the Default Web Site, add a new Virtual Directory called MM_WebSite pointing to the directory C:\MADCode\MobileMuseum\Server\MM_WebSite
    4. Accept all the defaults
    5. Under the Default Web Site, add a new Virtual Directory called MM_MobileWebSite pointing to the directory C:\MADCode\MobileMuseum\Server\MM_MobileWebSite
    6. Allow anonymous access and accept all the defaults
  3. Build and test the application:
    1. Open the MM_Solution_Server.sln in the folder C:\MAD\MADCode\MobileMuseum\Server
    2. Rebuild the solution
    3. Test the main web site by browsing to http://localhost/MM_WebSite using Internet Explorer
    4. Test the HTML version of the mobile web site by using a Pocket PC, SmartPhone or emulator and browsing to the same URL. You will be redirected to http://localhost/MM_MobileWebSite\ppc
    5. Test the WML version of the mobile web site by using a cell phone emulator (the Nokia Mobile Internet Toolkit 4.0 includes a WAP Gateway simulator and phone emulator) and visit the same URL. You will be redirected to http://localhost/MM_MobileWebSite
    6. To view prospective members who have signed up, visit the Administration section of the main web site. Login using “admin” and “password”.
    7. If you are having trouble connecting to the web site from your Pocket PC, you might need to change your connection settings. Try changing the proxy settings for your connection to indicate “This network connects to the Internet”.

Chapter 12 – Mobile Biologist Case Study

Server

  1. Set up the Mobile Biologist database:
    1. Open the SQL Server Enterprise Manager
    2. Create a new database called “MobileBiologist
    3. Restore the database, using the file MobileBiologistBackup.bkp in the folder C:\MADCode\MobileBiologist\Server\Database
  2. Create the web sites:
    1. Before opening the Visual Studio Solution, you must create two web sites – one for the main web site and one for the web service
    2. Open IIS
    3. Under the Default Web Site, add a new Virtual Directory called MB_WebSite pointing to the directory C:\MADCode\MobileBiologist\Server\MB_WebSite
    4. Accept all the defaults
    5. Under the Default Web Site, add a new Virtual Directory called MB_WebServices pointing to the directory C:\MADCode\MobileBiologist\Server\MB_WebServices
    6. Accept all the defaults
  3. Build and test the application:
    1. Open the MB_Solution_Server.sln in the folder C:\MADCode\MobileBiologist\Server
    2. Rebuild the solution
    3. Test the main web site by browsing to http://localhost/MB_WebSite using Internet Explorer
    4. To login as an administrator use “admin” and “password”
    5. To login as a biologist use “bio” and password”
    6. To login as a default user, you may register yourself, or login using “default” and “password”
    7. Test the web service by browsing to http://localhost/MB_WebServices/MB_WS.asmx . You should see the MB_WS test page.

Pocket PC Client

  1. Open the MB_Solution_PPC.sln solution in the folder C:\MADCode\ MobileBiologist\PPC
  2. Modify the config.xml file to include the URL of your web service, such as http://192.168.1.100/MB_WebServices/MB_WS.asmx
  3. The first time you run the program you will need to download data using the server’s web service. Test connectivity between your Pocket PC or emulator and your web service by using Pocket IE to visit the web service URL. You should see the MB_WS web service test page.
  4. If you are having trouble connecting to the web site from your Pocket PC, you might need to change your connection settings. Try changing the proxy settings for your connection to indicate “This network connects to the Internet”.
  5. Rebuild MB_PPC
  6. Run MB_PPC. You may deploy to a Pocket PC or use the emulator.
  7. Login using “bio” and “password”.

Pocket PC Client database setup:

  1. The program MB_DB_Setup was used to create the SQL Server CE database file mb_db.sdf. You should not need to re-run this program unless you decide to modify the database schema or password.
  2. The current database password is “test”
  3. The database file is deployed with the Pocket PC application. If you don’t want to copy a new database over when you re-deploy, change the Build Action for the file mb_db.sdf from “Content” to “None”

Tablet PC Client

  1. Note: This client will run on a Laptop PC or Tablet PC.
  2. Build the application:
    1. The Tablet PC project references the Microsoft.Ink library. To compile the solution you will need to install the Tablet PC SDK from Microsoft.
    2. Open the MB_Solution_Tablet.sln solution in the folder C:\MADCode\ MobileBiologist\Tablet
    3. Rebuild the entire solution.
  3. Install the application on the Tablet PC
    1. Copy the files MB_Tablet_Setup.msi, Setup.Exe and Setup.ini over to the Tablet PC. The files are in the directory C:\MADCode\MobileBiologist\Tablet\MB_Tablet_Setup\Debug
    2. Run Setup.exe on the Tablet PC
    3. This will install the MB_Tablet application in the directory C:\Program Files\MAD\MB_Tablet
    4. You can remove this program using by going to Add/Remove programs in the Control Panel and removing “MB_Tablet
  4. Set up the Mobile Biologist Tablet database on the Tablet PC:
    1. Open the SQL Server Enterprise Manager
    2. Create a new database called “MobileBiologistTablet
    3. Restore the database, using the file MobileBiologistTabletBackup.bkp in the folder C:\Program Files\MAD\MB_Tablet
  5. Update the config file
    1. Update the URL and database connection string in the file MB_Tablet.exe.config in the folder C:\Program Files\MAD\MB_Tablet

Chapter 13 – Mobile Zoo Case Study

Server

  1. Set up the Mobile Zoo database:
    1. Open the SQL Server Enterprise Manager
    2. Create a new database called “MobileZoo
    3. Restore the database, using the file MobileZooBackup.bkp in the folder C:\MADCode\MobileZoo\Server\Database
  2. Create the web sites:
    1. Before opening the Visual Studio Solution, you must create two web sites – one for the main web site and one for the web service
    2. Open IIS
    3. Under the Default Web Site, add a new Virtual Directory called MZ_WebSite pointing to the directory C:\MADCode\MobileZoo\Server\MZ_WebSite
    4. Accept all the defaults
    5. Under the Default Web Site, add a new Virtual Directory called MZ_WebServices pointing to the directory C:\MADCode\MobileZoo\Server\MZ_WebServices
    6. Accept all the defaults
  3. Build and test the application:
    1. Open the MZ_Solution_Server.sln in the folder C:\MADCode\MobileZoo\Server
    2. Rebuild the solution
    3. Test the main web site by browsing to http://localhost/MZ_WebSite using Internet Explorer
    4. To login as an administrator use “admin” and “password”
    5. Test the web service by browsing to http://localhost/MZ_WebServices/MZ_WS.asmx . You should see the MZ_WS test page.

Client

  1. Install Pocket Web Host
    1. Open the solution file pwhost.sln in the folder C:\MADCode\PWH\pwhost
    2. Deploy the project to the Pocket PC or emulator
    3. Run the program pwhost.exe in the folder \Program Files\pwhost on the mobile device
  2. Install the Mobile Zoo web site
    1. All of the web pages, code behinds and business objects are in the folder C:\MADCode\MobileZoo\PPC\PWH_Version\MobileZoo
    2. Modify the MZ_config.xml to include the URL of your web service, such as http://192.168.1.100/MZ_WebServices/MZ_WS.asmx
    3. Copy the entire MobileZoo folder over to the mobile device under the folder \Program Files\pwhost\
    4. Note: To copy files to an emulator create a share on your laptop and put the files there. Then map the share from within the emulator and copy the files.
    5. Open Pocket IE on the Pocket PC or emulator
    6. Visit the URL http:/127.0.0.1:8080/MobileZoo/default.htm (Note that on Pocket PC 2002 you can enter http://localhost:8080/MobileZoo/default.htm, but this does not work properly on Microsoft Windows Mobile 2003).
    7. Browse the web pages and enter your data on the signup page
    8. You must be connected to your server to upload data. Test connectivity between your Pocket PC or emulator and your web service by using Pocket IE to visit the web service URL. You should see the MZ_WS web service test page.
    9. If you are having trouble connecting to the web site from your Pocket PC, you might need to change your connection settings. Try changing the proxy settings for your connection to indicate “This network connects to the Internet”.
    10. To upload data to the server, visit the page http://localhost:8080/MobileZoo/upload.pwh

 

Note: We have also created a partial version of this web site that works with the Microsoft Pocket PC HTTP Server. We have tested this on a HP iPAQ running Microsoft Windows Mobile 2003. This application allows users to enter data into the local database, but it does not currently synchronize that data with the server database.

  1. Install the Microsoft Pocket PC HTTP Server from the Pocket PC 2003 SDK
    1. Locate the cab file HTTPServer.PPC2003ARM.MS.PocketPC. This file can be found in one of the sub-folders under C:\Program Files\Windows CE Tools\wce420\POCKET PC 2003\Support\httpserver
    2. Copy the cab file to your mobile device and open it to install the HTTP Server
  2. Install the eVB Runtime (which includes the ADOCE libraries)
    1. Download the eVB runtime from http://www.microsoft.com/windowsmobile/resources/downloads/developer/eula/evb_eula.mspx
    2. Copy the cab file msvbppc.armv4.cab to your mobile device and open it to install the eVB runtime
    3. Note – there is no x86 version of this cab file, so you cannot install it on your Pocket PC 2003 emulator
  3. Install the Microsoft SQL Server CE libraries
    1. Locate the SQL CE cab files. You may find them under C:\Program Files\Microsoft Visual Studio .NET 2003\CompactFrameworkSDK\v1.0.5000\Windows CE\wce400\armv4.
    2. Copy the following cab files to your mobile device and open them to install the SQL CE libraries
      1. sqlce.dev.wce4.armv4.CAB
      2. sqlce.wce4.armv4.CAB
      3. sql.wce4.armv4.CAB
  4. Copy the Mobile Zoo web site to the iPAQ
    1. Copy the folder MobileZoo from C:\MADCode\MobileZoo\PPC\HTTPServer_Version\ to your mobile device under \Windows\www\wwwpub\
  5. Reset your iPAQ.
  6. Browse to http://localhost. You should see a test page which indicates that the HTTP Server is running
  7. Browse to http://localhost/MobileZoo/default.htm. You should see the MobileZoo application

 

Important Note: You may experience problems running both the PWH and HTTP Server versions of the MobileZoo web site on an HP iPAQ that uses Microsoft Windows Mobile 2003 when the iPAQ is not connected to the network. If you experience difficulties running the applications, place your iPAQ in its cradle. The version of Pocket Internet Explorer that comes with Microsoft Windows Mobile 2003 will not attempt to access the local web server when it is not connected to the network.