iLifeSensor on the iPhone - Part III
Rebuilding iLifeSensor Mobil
This article, the third part of our feature on iLifeSensor Mobil, is for web developers who are looking to create web applications that connect to LifeSensor (a PHR). Familiarity with the programming language Java, Web development technologies, and an IDE like Eclipse are required to follow along. Although not required, experience with Tomcat and Subversion would be helpful.
There are a number of similar LifeSensor terms in this article which might be a bit confusing. Let me clarify these terms for you:
- LifeSensor (http://www.lifesensor.com)
The Personal Health Record (PHR) by InterComponentWare. - lifesensor-mobil (http://lifesensor-mobil.googlecode.com)
A project started to bring LifeSensor on mobile devices. It is hosted on googlecode. - iLifeSensor Mobile (http://ilifesensor.mobi/)
The web application produced by the project. - iLS
The Eclipse project name I chose.
Prerequisites / System requirements
This how-to uses a few open source tools and resources and stitches them together to form a development enviroment for an open source mobile data-collection platform. You need all of them to perform the steps in this tutorial. The primary focus is developing applications that connect to LifeSensor, so those pieces are the primary requirement. Here is the full list:
- Eclipse Development Environment (http://www.eclipse.org/downloads)
This tutorial employs Eclipse IDE for Java EE Developers (Ganymede v3.4). - Java Runtime Environment 1.6.0 (http://java.sun.com)
- Tomcat (http://tomcat.apache.org)
A web container that functions as a web server supporting servlets and JSPs. Version 6.0.18 was used for this article and is the latest production quality release at the time of writing. - Subclipse (http://subclipse.tigris.org) or Subversive (http://www.eclipse.org/subversive)
Plug-ins providing support for Subversion within the Eclipse IDE. - iLifeSensor Mobil (http://lifesensor-mobil.googlecode.com)
The revision used for this article is r167. - ICW SDK Java Edition 1.5.0 (http://idn.icw-global.com/icw-ehealth-framework/software-development-kit.html)
The SDK jars are already incorporated in the Lifesensor-mobil package, so you don't have to download them. Future releases of SDK may be downloaded from the IDN download section.
Setup and Configure the IDE
Install Eclipse and Tomcat on your system. There is a nice IBM developerWorks article with hints on how to get started with Eclipse and Tomcat. http://www.ibm.com/developerworks/opensource/library/os-eclipse-tomcat/
To check out the code from Lifesensor-mobil you can add a Subversion (SVN) plug-in (e.g. Subclipse, Subversiv) to Eclipse or use any stand alone SVN client (e.g. Tortoise).
In case of the eclipse plug-in, add the iLifeSensor Mobil URL http://lifesensor-mobil.googlecode.com/svn/trunk and check out the code from its repository to a new project, e.g. iLS.
Edit the Java Build Paths to your JDK and ServletAPI in the iLS project properties in Eclipse.
Build and Run the Application
So now you're ready to test the existing functionality.
- Right click on the iLS project and select Run As > Run on Server.
Select the Tomcat 6.0 server, and click Finish. - Eclipse starts the Tomcat application server. After the server starts, you should see a page like this.

Behind a Proxy?
If you run the application and your system is behind a firewall/proxy you will get an error message like this:
com.icw.sdk.exceptions.SDKException: SDK_UNK_1.0_F_C_199_1416
Caused by: java.net.ConnectException: Connection timed out: connect
It will take two steps to modify the code to match your proxy server:
- add/change/uncomment in sdk-examples.properties:
# System property for https.proxy
http.proxyHost=proxy.?.com
http.proxyPort=3128 - add/change/uncomment in Login.java:
// add setProxy() for usage behind a firewall
loader.setProxy();
LifeSensor Account
The code you imported from Lifesensor-mobil is configured to run on a German LifeSensor account. If you have such a LifeSensor record you can go ahead and login with your name and password.
For testing purposes there also is a test system available. To switch iLS to the test system change the LifeSensor WebService URL in the sdk-examples.properties file from record2 to drecord2. Go here to get the login data for the actual test account.
The previous articles of our feature on iLifeSensor Mobil:


