Sample Demonstrating SMS Enabling a Wireless Application

Table Of Contents 

This document is organized into following sub-sections :

Overview of the Sample Application

Back To Top

Oracle9iAS Wireless presents a framework to develop mobile applications to be accessed "from anywhere, from any device, using any protocol". To achieve this, the developer has to async-enable the application. The application can now talk to various protocols such as WAP (Wireless Access Protocol), SMS (Short Messaging Service), Voice and others. For more information on Oracle9iAS Wireless Server, click here.

The Mobile Center is a complete resource, including hosted development and deployment portal, for learning about the wireless and voice services of Oracle9i Application Server Wireless Edition. It is located at http://studio.oraclemobile.com/. It provides a complete infrastructure for Creating, Deploying and Testing Applications. So there is no need to install your own wireless infrastructure to test wireless application. Instead the developers can deploy their applications in mobile studio and execute the applications from studio. They can register with the mobile studio and access it through multiple channels like: SMS, Email and mobile browsers.

This sample illustrates how to SMS enable a Wireless Application using Oracle9iAS Wireless Server as well as Mobile Studio. This scenario is demonstrated using a Stock Quote Application. This application takes a Company Stock Symbol as input and returns the stock price of the company. The stock price of the company is retrieved from the database. The sample is SMS enabled so that it can be invoked either from a mobile using SMS or from an e-mail based client. If the company's stock quote is sent as a parameter through SMS or from an e-mail, the price of it is retrieved from the database and sent back to the client. If the Company Stock Symbol is not present in the database then a message is sent back informing that the price of the Company Stock is not present in the database.

Required Software

Back To Top

For running the application from Oracle9iAS

1) Oracle9iAS Enterprise Edition Release 2 V9.0.2 (Can be downloaded from here).

2) Oracle9i or later Database (Can be downloaded from here).

3) Device simulators like Openwave. It can be downloaded from here. Information of other device simulators is present here. It is optional.

For running the application from Mobile Studio

1) Oracle9iAS (9.0.2.0.0) Containers for J2EE i.e. OC4J (or later) downloadable from here.

2) Oracle9i or later Database (Can be downloaded from here).

3) Device simulators like Openwave. It can be downloaded from here. Information of other device simulators is present here. It is optional.

 

Notations used

Back To Top

This section will describe the terms used in the document.

Notation Description
OC4J Oracle Containers for J2EE
<OC4J_HOME> If the sample is being deployed into a standalone OC4J, then this value will be the folder where OC4J is installed. For example, D:/oc4j.
If the sample is being deployed in 9iAS, then this value will be the folder where iAS middle-tier has been installed. For example, D:/iAS.
<J2EE_HOME> The folder j2ee/home under <OC4J_HOME>. For example, D:/oc4j/j2ee/home
<SAMPLE_HOME> Folder where this sample resides. For example, if <X> is the folder where the sample was extracted, then <X>/StockQuoteSample would be the value of this Notation.

 

Installation

Back To Top

Step 1. Unjar the provided StockQuoteSample.jar using the following command:

> jar xvf StockQuoteSample.jar

Step 2. This sample application requires that the following table to exist in database.

Table Name : Stock_Prices
Column Name Column Type Description
CompanyStockSymbol VARCHAR2(10) Company's Stock Quote symbol
Price NUMBER(7,3) Price of the Stock Quote

To create the table and fill it with test data, run SQL*Plus, connect to your Oracle database as any user and execute the Install.sql script as shown below.

SQL> @<SAMPLE_HOME>/sql/Install.sql

Step 3. Edit <SAMPLE_HOME>/src/oracle/otnsamples/wireless/ConnectionParams.java file in your favorite editor. Change the Host name, port number, SID, username and password to those where the tables were installed in the above step.

Change the following lines:

public final static String hostName     = "insn104a.idc.oracle.com";
public final static String portNumber   = "1522";
public final static String SID          = "ora9idb";
public final static String userName     = "scott";
public final static String userPassword = "tiger";

Step 4. Copy <SAMPLE_HOME>/src/Stock to <J2EE_HOME>/default-web-app.
             Now copy <SAMPLE_HOME>/src/oracle to <J2EE_HOME>/default-web-app/WEB-INF/classes.

Step 5. Go to <J2EE_HOME>/default-web-app/WEB-INF/classes on command prompt and run the following command.

javac -d . oracle/otnsamples/wireless/*.java

Make sure that you have <OC4J_HOME>/jdbc/lib/classes12dms.jar in the classpath before running the above command.

Step 6. Start the OC4J server. Now configure the Email Adapter in Oracle9iAS Wireless. Go through the viewlet located here for doing this.

Step 7. To deploy the sample application in Oracle9iAS Wireless see the viewlet present here. To deploy the sample application in Mobile Studio see the viewlet present here. You can test the sample application deployed in Mobile Studio using the procedure explained in this viewlet.


Note: If you are outside the firewall then access the link http://studio.oraclemobile.com instead of http://studioinside.us.oracle.com for working in Mobile Studio. For more information on Mobile Studio click here.

Running the Application

Back To Top

Running the application from Oracle9iAS

For running the sample application, first setup an Email ID over IMAP protocol. This can be done by following the viewlets present in Step 6 in the above section. We will refer to the Email ID (which the wireless server is listening) as <WIRELESS_MAIL>. This is rajgupt@idc.oracle.com in the viewlet.

Step 1. Open your favourite Email Client. Create a new mail and write Stockquote in the subject line (Stockquote is the name you provided as short name while deploying the application in Oracle9iAS Wireless). Remove everything from the body of the mail and type "ORCL" (within double quotes) and send the mail to <WIRELESS_MAIL>.

Step 2. After some time, you will get a mail from the Wireless server which will show the Stock Quote of the company whose symbol is sent.

Running the application from Mobile Studio.

Mobile Studio server listens to the Email ID studioin@oraclemobile.com. We will refer to this Email ID as <STUDIO_MAIL>.

Step 1. Open your favourite Email Client. Create a new mail and write stockquote in the subject line (stockquote is the short name which you provided while deploying the application in Mobile Studio). Remove everything from the body of the mail and type "ORCL" (with double quotes) and send the mail to <STUDIO_MAIL>.

Step 2. After some time, you will get a mail from the Mobile Studio Server which will show the Stock Quote of the company whose symbol is sent.

Description of Sample Files

Back To Top

The directory structure of the StockQuoteSample.jar is as shown below :

Directory Files Description
<SAMPLE_HOME>/docs Readme.html This file.
<SAMPLE_HOME>/sql Install.sql This SQL scripts creates and populates the table used by the application.
<SAMPLE_HOME>/src/oracle/otnsamples/wireless ConnectionParams.java This file contains the database connection parameters.
StockQuoteSampleBean.java This file contains the methods required to connect to the database and retrieve data.
<SAMPLE_HOME>/src/Stock Main.xml This file accepts the input from the input device.
Result.jsp This file shows the result retrieved from the database.

 



Please enter your comments about this sample in the OTN Sample Code Discussion Forum.
E-mail this page
Printer View Printer View