Skip to main content

Snowboard Application for the Apple iPhone and iPod Touch

Overview

This application displays the innovative possibilities of using the WebSphere Application Server Feature Pack for Web 2.0. The application utilizes both client-side and server-side technologies to serve web-content to Apple’s iPhone or iPod Touch.

The Technologies used - Client side

On the client-side, the JavaScript Dojo Toolkit, IBM provided JavaScript SOAP library, and the iUi JavaScript library are used.

The iUi library is an open-source library used to provide iPhone/iPod Touch graphical look and feel. The library does not provide a Web 2.0 Feature Pack, but illustrates the ease of which third party components can be integrated with applications created with the Feature Pack. Also, the usage of the iUi library is not an endorsement of the iUi library by IBM, but merely used for convenience in providing the look-and-feel of an iPhone/iPod Touch application.

The Dojo Toolkit is an open-source JavaScript library supported by IBM that allows you to easily build dynamic capabilities into Web pages. Dojo provides a rich set of user interface widgets, many of which can be utilized on the iPhone/iPod Touch, I/O APIs for making Ajax requests, and generic JavaScript language enhancements.

The SOAP library is an IBM extension to the Dojo Toolkit that allows you to package and send SOAP requests to SOAP enabled Web-services. The SOAP library is used to connect to SOAP based Web-services described in the section on "Putting it all together".

Client side - Web publish and subscribe

The Dojo Toolkit and Web 2.0 Feature Pack support a Cometd server model to asynchronously push message events from the server to the client. The technologies allow you to create applications where events are published directly from the server to the browser without having to implement a polling model.

The Technologies used - The server side

On the server-side, the IBM WebSphere Application Server is used to host the application via IBM's demo service. The server-side application makes use of the Feature Pack's Ajax Proxy and JSON4J library. The Ajax Proxy allows you to create Web-applications that support cross domain scripting in the browser. The Ajax Proxy is typically used when aggregating multiple Web sites together. As an example, taking content from another Web service and combining it with your own content.

The JSON4J library is a compact Java library that can be used to package JavaScript Object Notation (JSON) data. JSON data is an easily created data format that is readily evaluated by today's JavaScript browsers.

Server Side - Publish and Subscribe

The Feature Pack for Web 2.0 provides server-side support for the Bayeux protocol and integrates with WebSphere Application Server's service integration bus (SIBus). Combined with Dojo's support of Cometd, events can be pushed from the server to the client. Integration with SIBus allows events from JMS or Web Services to be pushed to the asynchronously to the iPhone or iPod Touch using a WiFi connection.

Putting it all together

The application provides the ability to retrieve weather information from popular ski resorts. The weather information is provided for free from the United States Department of Commerce National Oceanic and Atmospheric Administration (NOAA). The content is available via a SOAP request to their servers. A postal zip-code is used as the location to retrieve. The content is returned in an XML format which is parsed by the client.

The SOAP request to the NOAA service is created on the iPhone or iPod Touch client using the IBM SOAP extension provided in the Feature Pack. The SOAP request is passed to the Ajax Proxy provided by the Feature Pack which in turn forwards the request to the NOAA server for processing. The weather result is then forwarded back to the client. The client processes the XML data returned from the NOAA servers and displays the result.

In addition to weather information, the Web application provides the ability to display snowboard gear information and displays the ease by which you can create your own dynamic application using the Feature Pack.

On the client-side, a custom Dojo widget is created to display the gear information. When the widget is created, an Ajax request to the WebSphere server is made to retrieve content information. The information retrieved is based on the user selected id. The Servlet performs a lookup and returns the information in a JSON format using the JSON4J library provided with the Feature Pack. The client retrieves the response and displays the data.

A chat application is also provided which highlights the publish-and-subscribe support provided with the Web 2.0 Feature Pack. On the client, the cometd support provided by Dojo is used to establish a connection to the WebSphere Application Server. Using the Feature Pack, the server provides support for cometd and integrates the publish-and-subscribe messaging with WebSphere's service Integration Bus. A text entry from one client is broadcast to the server which in turn broadcasts the text to any device that may also be connected. Text is pushed to any listening devices which results in a chat display.