Tuesday, September 18, 2012

Opentravel Mobile Android App development with the JiBX open source framework

This example demonstrates how easy it is to create an Android app that can communicate with travel sites using the opentravel.org message schema.

The JiBX open source project is a java data-binding utility that simplifies handling of xml schema. The JiBX schema library includes pre-built bindings for many message schema, including the complete opentravel schema.

This app uses the 2011B version of the opentravel touractivities search request and reply.

Here is what this app looks like on my phone. Select a date and the available tour activities will display:
Tap on a tour for a detail display:

To illustrate what is happening, let's jump right into the actual source code. I create an opentravel xml touractivity search request and then read through the returned xml reply message.

// Populate the search request
SearchRQ searchRQ = new SearchRQ();
OTAPayloadStdAttributes payload = BaseService.createStandardPayload();
DateTimePref dateTimePref = new DateTimePref();

// Send it to the server and get the result
SearchRS searchRS = search(searchRQ);
if (searchRS == null)
return null;

// Extract the information from the results
List tourProducts = new Vector();
List tourActivities = searchRS.getTourActivityInfoList();
if ((tourActivities == null) || (searchRS.getErrors() != null))
return getErrorMessage(searchRS);
for (TourActivityInfo tourActivityInfo : tourActivities)
TourInfo tourInfo = new TourInfo();
TourActivityID tourActivityID = tourActivityInfo.getBasicInfo();
tourInfo.tourID = tourActivityID.getTourActivityID();
TourActivityDescription tourActivityDescription =  tourActivityInfo.getDescription();
if (tourActivityDescription != null)
tourInfo.description = tourActivityDescription.getShortDescription();
Pricing pricing = tourActivityInfo.getPricing();
if (pricing != null)
tourInfo.minPrice = pricing.getMinPrice();
tourInfo.maxPrice = pricing.getMaxPrice();

// Return the tours to display
return tourProducts;

As you can see, manipulating the xml with java objects instead of xml makes the code easy to understand.

The rest of the code in this application handles the UI and the client calls. It should be familiar to any Android programmer. One of the nice features of Android is the inclusion of many popular open-source libraries, such as the Apache http Client library and the XMLPull parser.

This app is pretty simple. Setting up your development environment is a little tricky.

First, you will need a server that is set up to service your requests. Just follow the steps in my post here: http://blog.tourgeek.com/2012/04/creating-soap-and-rest-services-for.html . Make sure the server is working by pointing a browser to the server with this url (just replace this IP address with your server's IP): . You should get an XML reply message. Our app will be (html) posting a RESTful XML request rather than using url parameters.

Now we're ready to create our Android application.

Check out this example from github: https://github.com/jibx/schema-library/tree/master/schema-utilities/examples/android/org.jibx.android.demo.touractivity

I prefer maven for my Android development since it automatically includes all the correct opentravel binding modules automatically . You will need to set up maven for Android by following the directions here: http://www.sonatype.com/books/mvnref-book/reference/android-dev.html . Make sure you have deployed android 4.0_r3 into your local maven repo.

To build the code, just type:
mvn clean install

Now install your .apk file (from the maven target directory) onto your Android device.

Once you run the app, click the menu button to change the settings. Enter the IP address of your server and click okay:
You should see the tour display. Try changing the date to update the tour display (Some of the tours do not run on Tuesdays).

VoilĂ !

Take a look at the source code. You'll be amazed at how simple it is.

I hope this example helps you create your own app using the opentravel schema. If you have questions, contact me at don@tourgeek.com or place a comment in the space below.



jenlithos said...

Really a great application of android. Thanks for posting it.

Android Apps development

robert said...

Great information, I really like all your post. I will keep visiting this blog very often. It’s good to visit your website. android app development

cismohit said...

better technical explanation dude

Android Application Development

lee wright said...

Nice list on iphone development blogs… found very useful…


Kit Gana said...

Worth researching for. Thanks for sharing this blog.

AAREN said...

Very informative post.I like this post.
thank you so much for share it.

android application development

jack albert said...

Mooie post over android applicaties echt in dit bericht heb je aandeel zeer interessant en informatica de belangrijkste punten voor ipad deveopers.thanks voor het delen van uw ervaringen.

Bruce wills said...

Hello there I am so delighted I found your blog page, I really found you by mistake, while I was researching for something else,
Regardless I am here now and would just like to say many thanks for a remarkable post and a all round enjoyable blog
I don’t have time to go through it all at the moment but I have bookmarked it and also included your RSS feeds, so when I have time I will be back to
read more, Please do keep up the excellent work.

php web development

Richard Byrdk said...
This comment has been removed by the author.
iphone developers said...

thoroughly informative blog post Open travel mobile application development

Aadam Gibson said...

Good application and the resources you provided is very helpful to me.

Peter Smith said...

Excellent post. You really dialed that in. It’s the simple principles that worked for people that have already been where we are heading and desire to be that we should pay close attention to.Thanks for keeping it real and I always look forward to your next post!

Android Apps

Maris Boyd said...

JiBX is a device for executed XML information to Java Objects. It's extremely versatile, enabling us to begin from current Java value.now JiBx also used in Android Development.

Peter Murphy said...

That is a cool mobile android application! I just wish that the iphone application development in Sydney would provide an app similar to this one.

airbop said...

Thank you ever so for you post.Really thank you!

google cloud messaging


Derrick Patterson said...

Being a part of an application development in sydney is one of the things I want to be. That is the reason why I study programming very hard.

Vince Fury said...

Aside of becoming one of the web developers in perth, I'm also aiming to be an application developer capable of making applications just like this one.

airbop said...

This is one awesome blog.


Web Development Company India said...

Really android is android. And awesome article for Mobile App Developer.

Benjamin Armani said...

Nice post
mobile app

Victor Nadbitov said...

I'm also currently working on a mobile application. It it multi-platform app for travelers to discover places around when they are in new counries and don't speak native language. SO it should be fun. I used ibuildapp.com a lot, and they have bunch of different design templates. it could be easy to use them too

daniel Jackson said...

Being a Innoppl Mobile App developers Atlanta, These would be so useful.How to write a technical blog for that, this will be an awesome example. Really good for app developers like me. Thanks for sharing.

thomascook said...

Helpful information for android app developers. As a Los Angeles android app developers, we really thanks for providing this great resources with technical code.

Maximus said...
This comment has been removed by the author.
sophialevis said...

Full of utilitarian application. I am definitely enjoyed every little bit of your post. Thanks for posting...Designed Mobile Apps

Maximus said...

JIBX can be used in developing enterprise based mobile applications for an added security layer. Enterprise app developers should test your app by including JIBX

Abu Aslad said...

Thanks for posting it, very helpful information for mobile app developer. As a mobile app developer in India, we really thanks for providing this great resources with technical code.

Lava infotech said...

Web Application Development
This is really interesting, You’re a very skilled blogger. I have joined your feed and stay up for in the hunt for extra of your fantastic post. Also, I have shared your website in my social networks.

Ray Thomson said...

Nice app to use and have in android. Thanks for that. jiBX opensource and its frame work is some thing new to our orange949's expertise app developers in miami. But you have done an app using the framework. That motivates our developers to try for the new things. Thanks for the motivation

Rose Marry said...

Now a days people loves mobile apps, ever age group love mobile applications. There are many mobile apps like best spy mobiles apps

Rose Marry said...

Its a app world!!! every body want new and hightech apps for their phone. This app is a great app.
Download Youtube Videos on Android

Lee Wright said...

Excellent work.. do contact us if you want to have a website like this


Lee Wright said...

Enter your zip code here

Lee Wright said...

I have a good idea for an APP and would like to work with a developer on creating the APP.

Lee Wright said...


Great blog having useful information. Thanks for sharing this content. Technology is growing in all fields.
iphone application development services

apa dmi said...

What a application means just fabulous! . Now we can communicate with travel sites by means of mobile android app. It really helpful to everyone and time saving method.

Shareefkhan said...

Latest Version Apk Download for Android Free, you can here free download Viber APK Android file and that too latest version.

yogitha n said...

That was an Excellent Article. You Made some Great points and I am thankful for your information!
App developers

Rubby said...

Glad it suites you though. Always a bit of a leap into the unknown. Not the first time I have bought mice that I have hated from the moment I began to use it.candy crush it level 68

Eleuthera Beach Book said...

Nice post and great contribution
Eleuthera beach book

Alex Stephen said...

Took me time to learn all the comments, however I actually enjoyed the article. It proved to be Very helpful to me and I'm sure to all of the commenter right here! It's always nice when you can't only be told, but in addition entertained!
Free Mobile Website Builder

optisol biz said...

Very nice!! there is so much information on this blog keep posting good information like this so that I can come back every day for some new info... Hire Android Developers

zareena gull said...

This is very informative post. I really enjoy it and this is a great artical.I hope I will use this for our next business website.

This is great job!

Thanks for sharing this post.
web development company uae

Faisal Khan said...

This is very informative post. You have explained technicality very nicely.
web development uae

veda sen said...

Great effort put to develop mobile apps in few days.I Really appreciate your efforts. I enjoy reading websites like these. It has been an great source of info about Mobile application development company

Roshini RS said...

I have read your blog, it was good to read & I am getting some useful info's through your blog keep sharing... Informatica is an ETL tools helps to transform your old business leads into new vision. Learn informatica training in Chennai from corporate professionals with very good experience in informatica tool.Informatica training in chennai

karthik vijay said...

I agree with your post. Android software development kit makes the application development process lot simpler and effective. You can create best performing android application with ease. Android Training Institutes in Chennai | Best Android Training in Chennai

karthik vijay said...

Thanks for your informative article on ios mobile application development. Your article helped me to explore the future of mobile apps developers. Having sound knowledge on mobile application development will help you to float in mobile application development. iOS Training in Chennai | iOS Training Institutes in Chennai

karthik vijay said...

Your blog is really useful for me. Thanks for sharing this useful blog..Suppose if anyone interested to learn Android Course in Chennai please visit fita academy which offers best Android Training in Chennai at reasonable cost.

Sathik Ali. A said...

Thanks for sharing the useful information. Excellent blog with many useful information about Mobile Apps Development. I am planning to do Android Training in Chennai and kindly please suggest me is the best place for Android Training . If any other Android Training Institute in Chennai is their please let me know. Thanks for blog and thanks for reply guys.

brendon mccullum said...

Truly marvelous online journal. Hadoop Training in Chennai Your site is truly noteworthy for me. Oracle Training in Chennai A commitment of thankfulness is all together Hadoop Training in Chennai for sharing this lighting up online journal. Keep update your online journal.

Amirtha rao said...

Thanks for splitting your comprehension with us. It’s really useful to me & I hope it helps the people who in need of this vital information.
Informatica training chennai|Best Informatica Training In Chennai

Sri Ramachandran said...

Your posts are indeed useful.
Mobile App Developer

Stephen said...

There are lots of information about latest technology and how to get trained in them, like Hadoop Training Chennai have spread around the web, but this is a unique one according to me. The strategy you have updated here will make me to get trained in future technologies(Hadoop Training in Chennai). By the way you are running a great blog. Thanks for sharing this. FITA chennai reviews

Stephen said...

There are lots of information about latest technology and how to get trained in them, like Hadoop Training Chennai have spread around the web, but this is a unique one according to me. The strategy you have updated here will make me to get trained in future technologies(Hadoop Training in Chennai). By the way you are running a great blog. Thanks for sharing this. FITA chennai reviews

Rajal Panchal said...

Excellent Mobile app development using Open Source CMS

sss said...

Great information, I really like all your post. Informatica is such a course that requires learning the technological features of the product. visit our site for more details informatica online training in hyderabad

Melisa said...

Thanks for sharing this useful post; Actually Salesforce crm cloud application provides special cloud computing tools for your client management problems. It’s a fresh technology in IT industries for the business management.
Salesforce training in Chennai|Salesforce training institute in Chennai

Andria BZ said...

Thanks for sharing this niche useful informative post to our knowledge, Actually SAP is ERP software that can be used in many companies for their day to day business activities it has great scope in future.
sap training in Chennai|SAP Institutes in Chennai|SAP course in chennai