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
To run all
of the complete samples you will need the following:
- Server, Desktop or Laptop running Windows XP
Professional or Windows 2003 Server
- IIS 5.0 or higher
- SQL Server 2000 (with current service pack – we are
using SP3)
- SQL Server CE 2.0 with Server Tools (with the same
service pack as SQL Server 2000 – we are using sqlce20sql2ksp3a.exe)
- Visual Studio .NET 2003
- Tablet PC SDK
- Pocket PC or Emulator running Microsoft Windows Mobile
2003
- Tablet PC running Microsoft Windows XP Tablet Edition
and SQL Server 2000 (we are using the Developer Edition)
- 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.
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.
- Set up the Mobile Orders Merge database
- Create a new database called “MobileOrdersMerge”
- Restore the database using the
file C:\MADCode\CommunicationSamples\MergeReplication\MergeOrdersSample\Server\Database\
MobileOrdersMerge.bkp
- Create a SQL Server publication
- Share the folder C:\
MADCode\CommunicationSamples\MergeReplication\MergeOrdersSample\Server\MobileOrdersReplData
- Create a new publication for
the MobileOrdersMerge database:
- Right-click on the MobileOrdersMerge database and select New >
Publication.
- In the publication wizard,
select the following options:
- Select “Merge Replication”
- Select “Devices Running SQL
Server CE”
- Publish all Tables
- Allow SQL Server to create
unique identity columns and set the NOT FOR REPLICATION option on the
Identity coumns
- Leave the publication name
as “MobileOrdersMerge”
- Accept the default to create
the publication as specified
- Create the snapshot in
\\<computername>\MobileOrdersReplData
- Install SQL Server CE 2.0 Server Tools
- 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)
- When installing SQL Server CE,
select Development Tools AND Server Tools.
- When the installation is
finished, launch the Virtual Directory Creation Wizard. Name the virtual
directory “sqlce” and allow anonymous access.
- Select the checkbox to enable
merge replication.
- Enter the name of the share
you created: \\<computername>\MobileOrdersReplData
- Open Internet Explorer and
navigate to http://localhost/sqlce/sscesa20.dll
and make sure you see the following message:
SQL CE Server Agent
- Open the Merge Orders PPC Client Solution
- Update the information in the config.xml file
- Build and deploy the solution to a Pocket PC or
emulator
- Set up the Mobile Orders RDA database
- Create a new database called “MobileOrdersRDA”
- Restore the database using the
file C:\MADCode\CommunicationSamples\RDA\RDAOrdersSample\Server\Database\
MobileOrdersRDA.bkp
- Install SQL Server CE 2.0 Server Tools (if not
already done to set up merge replication)
- 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)
- When installing SQL Server CE,
select Development Tools AND Server Tools.
- When the installation is
finished, launch the Virtual Directory Creation Wizard. Name the virtual
directory “sqlce” and allow anonymous access.
- Open Internet Explorer and
navigate to http://localhost/sqlce/sscesa20.dll and make sure you see the
following message:
SQL CE
Server Agent
- Open the RDA Orders PPC Client Solution
- Update the information in the config.xml file
- Build and deploy the solution to a Pocket PC or
the Pocket PC emulator
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.
- Set up the web service:
- Before opening the Visual
Studio Solution, you must create a new Virtual Directory under the
Default Web Site.
- Open IIS
- Under the Default Web Site,
add a new Virtual Directory called SOAPCalculatorServer
- The path for the directory is
C:\MADCode\CommunicationSamples\SOAP\SOAPCalculatorSample\Server\SOAPCalculatorServer
- Allow anonymous access and
accept all the defaults
- Build and test the application:
- Open the SOAP Calcuator Server Solution in the folderC:\ MADCode\CommunicationSamples\SOAP\SOAPCalculatorSample\
- Rebuild the web site
- Test the application by
browsing to http://localhost/SOAPCalculatorServer/SOAPCalculator.asmx
- Open the SOAP Calculator PPC Client Solution in
the folder C:\MADCode\CommunicationSamples\SOAP\SOAPCalculatorSample\PPC\
- Update the information in the config.xml file
- Build and deploy the solution to a Pocket PC or
the Pocket PC emulator
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
- Open the Communication Server solution in the folder
C:\MAD\MADCode\CommunicationSamples\TCPIP\CommunicationSample\Server\
- Rebuild the solution (debug or release version)
- Install the program as a service using installutil:
- 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
- Navigate to
the directory
C:\MADCode\CommunicationSamples\TCPIP\CommunicationSample\Server\CommunicationServer\bin\Debug
(or Release, if applicable)
At the prompt: installutil.exe
CommunicationServer.exe
Enter the id and password for
the service account
To verify the installation go
to Control Panel > Administrative Tools >Services. Verify there is a
service called “Communication Server”.
Start Communication Server
service, if necessary.
- Note: This client will run on a Laptop PC or
Pocket PC.
- Open the Communication Client solution in the
folder C
:\MADCode\CommunicationSamples\TCPIP\CommunicationSample\PPC
- Rebuild the CommunicationClient
- Run the CommunicationClient.
You may deploy to a Pocket PC, or use the emulator.
- You may also go to the bin directory and run
CommunicationClient.exe directly on your laptop or desktop computer.
- Enter the IP Address or name of your server (do
not enter localhost).
- Type a phrase in the text box and hit Send.
- Your phrase will be echoed back to you, followed
by <EOF>.
Chapter 11 – Mobile Museum Case Study
- Set up the Mobile Museum database:
- Open the SQL Server Enterprise
Manager
- Create a new database called “MobileMuseum”
- Restore the database, using
the file MobileMuseumBackup.bkp in the folder
C:\MADCode\MobileMuseum\Server\Database
- Create the web sites:
- 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
- Open IIS
- Under the Default Web Site,
add a new Virtual Directory called MM_WebSite
pointing to the directory C:\MADCode\MobileMuseum\Server\MM_WebSite
- Accept all the defaults
- Under the Default Web Site,
add a new Virtual Directory called MM_MobileWebSite
pointing to the directory C:\MADCode\MobileMuseum\Server\MM_MobileWebSite
- Allow anonymous access and
accept all the defaults
- Build and test the application:
- Open the MM_Solution_Server.sln
in the folder C:\MAD\MADCode\MobileMuseum\Server
- Rebuild the solution
- Test the main web site by
browsing to http://localhost/MM_WebSite using Internet Explorer
- 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
- 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
- To view prospective members
who have signed up, visit the Administration section of the main web
site. Login using “admin” and “password”.
- 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”.
- Set up the Mobile Biologist database:
- Open the SQL Server Enterprise
Manager
- Create a new database called “MobileBiologist”
- Restore the database, using
the file MobileBiologistBackup.bkp in the folder
C:\MADCode\MobileBiologist\Server\Database
- Create the web sites:
- Before opening the Visual
Studio Solution, you must create two web sites – one for the main web
site and one for the web service
- Open IIS
- Under the Default Web Site,
add a new Virtual Directory called MB_WebSite
pointing to the directory C:\MADCode\MobileBiologist\Server\MB_WebSite
- Accept all the defaults
- Under the Default Web Site,
add a new Virtual Directory called MB_WebServices
pointing to the directory C:\MADCode\MobileBiologist\Server\MB_WebServices
- Accept all the defaults
- Build and test the application:
- Open the MB_Solution_Server.sln
in the folder C:\MADCode\MobileBiologist\Server
- Rebuild the solution
- Test the main web site by
browsing to http://localhost/MB_WebSite using Internet Explorer
- To login as an administrator
use “admin” and “password”
- To login as a biologist use
“bio” and password”
- To login as a default user,
you may register yourself, or login using “default” and “password”
- Test the web service by
browsing to http://localhost/MB_WebServices/MB_WS.asmx
. You should see the MB_WS test page.
- Open the MB_Solution_PPC.sln
solution in the folder C
:\MADCode\
MobileBiologist
\PPC
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
- 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.
- 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”.
- Rebuild MB_PPC
- Run MB_PPC. You may deploy to a Pocket PC or use
the emulator.
- Login using “bio” and “password”.
Pocket PC
Client database setup:
- 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.
- The current database password is “test”
- 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”
- Note: This client will run on a Laptop PC or
Tablet PC.
- Build the application:
- The Tablet PC project
references the Microsoft.Ink library. To
compile the solution you will need to install the Tablet PC SDK from
Microsoft.
- Open the MB_Solution_Tablet.sln
solution in the folder C
:\MADCode\
MobileBiologist
\Tablet
- Rebuild the entire solution.
- Install the application on the Tablet PC
- 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
- Run Setup.exe on the Tablet PC
- This will install the MB_Tablet application in the directory C:\Program
Files\MAD\MB_Tablet
- You can remove this program
using by going to Add/Remove programs in the Control Panel and removing “MB_Tablet”
- Set up the Mobile Biologist Tablet database on
the Tablet PC:
- Open the SQL Server Enterprise
Manager
- Create a new database called “MobileBiologistTablet”
- Restore the database, using
the file MobileBiologistTabletBackup.bkp in the
folder C:\Program
Files\MAD\MB_Tablet
- Update the config file
- Update the URL and database
connection string in the file MB_Tablet.exe.config
in the folder C:\Program Files\MAD\MB_Tablet
- Set up the Mobile Zoo database:
- Open the SQL Server Enterprise
Manager
- Create a new database called “MobileZoo”
- Restore the database, using
the file MobileZooBackup.bkp in the folder
C:\MADCode\MobileZoo\Server\Database
- Create the web sites:
- Before opening the Visual
Studio Solution, you must create two web sites – one for the main web
site and one for the web service
- Open IIS
- Under the Default Web Site,
add a new Virtual Directory called MZ_WebSite
pointing to the directory C:\MADCode\MobileZoo\Server\MZ_WebSite
- Accept all the defaults
- Under the Default Web Site,
add a new Virtual Directory called MZ_WebServices
pointing to the directory C:\MADCode\MobileZoo\Server\MZ_WebServices
- Accept all the defaults
- Build and test the application:
- Open the MZ_Solution_Server.sln
in the folder C:\MADCode\MobileZoo\Server
- Rebuild the solution
- Test the main web site by
browsing to http://localhost/MZ_WebSite using Internet Explorer
- To login as an administrator
use “admin” and “password”
- Test the web service by
browsing to http://localhost/MZ_WebServices/MZ_WS.asmx
. You should see the MZ_WS test page.
- Install Pocket Web Host
- Open the solution file pwhost.sln in the folder C:\MADCode\PWH\pwhost
- Deploy the project to the
Pocket PC or emulator
- Run the program pwhost.exe in
the folder \Program Files\pwhost on the mobile
device
- Install the Mobile Zoo web site
- All of the web pages, code
behinds and business objects are in the folder
C:\MADCode\MobileZoo\PPC\PWH_Version\MobileZoo
- 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
- Copy the entire MobileZoo folder over to the mobile device under the
folder \Program Files\pwhost\
- 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.
- Open Pocket IE on the Pocket
PC or emulator
- 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).
- Browse the web pages and enter
your data on the signup page
- 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.
- 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”.
- 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.
- Install the Microsoft Pocket PC HTTP Server from
the Pocket PC 2003 SDK
- 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
- Copy the cab file to your
mobile device and open it to install the HTTP Server
- Install the eVB
Runtime (which includes the ADOCE libraries)
- Download the eVB runtime from http://www.microsoft.com/windowsmobile/resources/downloads/developer/eula/evb_eula.mspx
- Copy the cab file msvbppc.armv4.cab to your
mobile device and open it to install the eVB
runtime
- Note – there is no x86 version
of this cab file, so you cannot install it on your Pocket PC 2003
emulator
- Install the Microsoft SQL Server CE libraries
- 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.
- Copy the following cab files
to your mobile device and open them to install the SQL CE libraries
- sqlce.dev.wce4.armv4.CAB
- sqlce.wce4.armv4.CAB
- sql.wce4.armv4.CAB
- Copy the Mobile Zoo web site to the iPAQ
- Copy the folder MobileZoo from
C:\MADCode\MobileZoo\PPC\HTTPServer_Version\ to your mobile device under
\Windows\www\wwwpub\
- Reset your iPAQ.
- Browse to http://localhost.
You should see a test page which indicates that the HTTP Server is running
- 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.