section_logo

Booking service for mobile phone

Small booking service application using J2ME and JSP.

description


Before start this project I was using J2ME for a while but just for client mobile applications. I wanted to create some project combining together mobile applications and server side services so I got the opportunity to make this job for a project during my studies in Vitus Bering University College.

The result was the cachondo booking service (Cachondo means funny in spanish). I was the responsible of the major IT part and another friends took the marketing and business management part, which I'm not going to explain here.

The idea behind this project was to allow a user to access to the services provided by different companies. It was focus on leisure so mainly this kind of services include buy a ticket for a concert or cinema, book places in a restaurant, check special offers and featured parties in the clubs, etc.

The architecture is simple, a main server processing both inputs, from providers and from users. The communication between users and the server was made using custom xml messages managed by a servlet. In the other hand the providers access to their custom services page using simple website.

The server uses Tomcat to run the two servelts the project needed:

  • servlet_service: Building the website that will be show to the providers.
  • servlet_server: Communication with mobile phone.

Providers server-side

Once that the user has been validated, he can administrate the menus, offers or reservations.

Even if we can use the same template for each service option, we could also implement custom templates for each service and/or provider. Here we can see the available menus that users could choose from the mobile:

The provider could see as well the reservations from the clients, checking if they ask for some special service, and confirming the booking date.

Database

The database design is divided into two parts, one is the common for all the kind of services, and another one include the custom tables for each kind of service.

mobile_flow

Mobile

The mobile uses custom messages in XML using the following syntax: Mobile to Server
<cachondo version="1">
	<message type="login">
		<data login="userlogin" password="1234"/>
	</message>
</cachondo>
Server to Mobile
<cachondo version="1">
	<message type="login">
		<data verified="true" user_id="1"/>
	</message>
</cachondo>

These messages are generated and parsed using kXML, a small and simple xml library available for use in j2me.

State diagram

The following image shows the state diagram for a basic restaurant service:

mobile_flow

Midlet connection

Maybe the most insteresting thing in the code was to create the asynchronous connection between the servlet and the midlet, instead of normal connection that freeze the mobile phone waiting for answer. Instead of that classic connection we create a thread and throw it in the connection section and when why finish the connection we close it. The following graph shows the normal workflow of our forms.

The login function is called in the main thread of the midlet, and it throws a thread that will entablish the connection needed for login.

private void login()
{
	Thread t =  new Thread() 
	{
		public void run() 
		{
			loginConnect();
		}
	};
	t.start();
}
 
private boolean loginConnect()
{
	HttpConnection hc = null;
	InputStream is = null;
	OutputStream os=null;
 
	String url= URL.baseURL+"mobileserver";
	try 
	{
  		hc = (HttpConnection)Connector.open(url);
  		hc.setRequestMethod(HttpConnection.POST); 
  		hc.setRequestProperty("User-Agent","Profile/MIDP-2.0");
		hc.setRequestProperty("Content-Language","es-ES");
 
		// We send the petition
		os = hc.openOutputStream();
 
		// Send the XML petition for login
		sendValidateRequest(os);	
 
		// Get the answer in XML form the server
  		midlet.login(userValidateResponse(hc));
 
		hc.close();
	}
	catch (Exception ioe) 
	{
  		System.out.println(ioe.toString());
	}
  	return true;
}

downloads


Source code including the midlet and the server side

comments


#1 posted by jow at 2010-04-08 14:30:39

can you please send me the code for the application. i would be thankful... i am doing a more advanced version of this application but ddont know were to start, could you please help me!!!

#2 posted by jow at 2010-04-08 14:37:56

can you please send me the code for the application. i would be thankful... i am doing a more advanced version of this application but ddont know were to start, could you please help me!!! I am using netbeans to do this project!!!

#3 posted by more at 2010-10-23 19:55:47

Hi there, Your application is very interesting... I will like to have the complete source code for my final year project please

#4 posted by ariff at 2010-11-30 19:25:27

hello there.. can u give me full source code... thats for my final project.. teach me all about this project... help me please.. thanxs for helping me...

#5 posted by Gozde at 2011-05-26 14:31:32

Hi can I have the full codes of this projes. I would like to use in my homework. I would be glad if you could help me.

Message posting is currently unavailable :(
Feel free to contact me using mail or contact form