Operation Details

Nel documento Oracle9 Application Server (pagine 103-108)

Supporting Wireless Clients

Screen 2 shows the sample application’s starting point, which is the empbft.xml file

7.5 Operation Details

To Oracle9iAS, requests from wireless clients look the same as requests from desktop browsers except that the user agent field contains the name of the wireless device. However, the way in which wireless requests get to Oracle9iAS is different:

Wireless requests first go through gateways (such as WAP, Voice, or SMS), which convert the requests to the HTTP protocol. The gateways then route the requests to Oracle9iAS Wireless.

Oracle9iAS Wireless processes the requests by invoking an adapter to retrieve XML from the mobile application. The XML is based on a schema defined by Oracle9iAS.

Oracle9iAS Wireless then invokes a transformer, which takes the XML and

transforms it to a markup language appropriate for the wireless client. Oracle9iAS sends the resulting data to the gateway, which may encode the data (to make the data more compact) before sending it to the client.

See the Oracle9iAS Wireless Developer’s Guide and the Oracle9iAS Getting Started and System Guide for further details.

7.5.1 Query Operation

Figure 7–4 shows the flow of the query operation with wireless and browser clients.

This figure is a more complex form of Figure 6–1.

Figure 7–4 Query Operation

The figure above contains two sequences of events. One sequence is for requests that come from browsers; steps in this sequence are noted in the figure with a "B".

The other sequence is for requests that come from wireless clients; steps in this sequence are noted with a "W".

The steps for browser requests are covered in Section 6.2, "Query Employee Operation". This section covers the wireless steps.

W1: The server sends the request to the Controller with the action parameter set to queryEmployee and the empID parameter set to the employee ID entered by the user.

W2: QueryEmployee.java checks the clientType parameter to determine if the request came from a wireless client or a browser. This parameter is set only in the

ID page Request without employee ID


Request with employee ID action=queryEmployee

Request with employee ID action=queryEmployee

Operation Details

Supporting Wireless Clients 7-15 XML files that the application sends to wireless clients; requests from browsers do not have this parameter. QueryEmployee.java also checks if the employee ID is valid.

W3: QueryEmployee.java forwards the request to queryEmployeeWireless.jsp.

W4: queryEmployeeWireless.jsp is similar to queryEmployee.jsp. It retrieves and displays employee data. Note that the retrieval method is the same in both files. The only difference is in the tags used (HTML for browsers, XML for wireless clients).

7.5.2 queryEmployeeWireless.jsp

queryEmployeeWireless.jsp looks like the following:

// queryEmployeeWireless.jsp

<?xml version = "1.0" encoding = "ISO-8859-1"?>

<%@ page contentType="text/vnd.oracle.mobilexml; charset=ISO-8859-1" %>

<%@ page import="java.util.*" %>

<%@ page import="empbft.component.employee.ejb.*" %>

<%@ page import="empbft.component.employee.helper.*" %>

<%@ page import="empbft.util.*" %>




String empId = request.getParameter(SessionHelper.EMP_ID_PARAMETER);

if (empId == null) {


<SimpleForm title="Query Employee" target="/empbft/controller">

<SimpleFormItem name="empID" format="*N">Enter Emp ID: </SimpleFormItem>

<SimpleFormItem name="action" type="hidden" value="queryEmployee" />

<SimpleFormItem name="clientType" type="hidden" value="wireless" />



} else {

int id = Integer.parseInt(empId);

EmployeeManager mgr = SessionHelper.getEmployeeManager(request);

EmployeeModel emp = mgr.getEmployeeDetails(id);



<SimpleTextItem>Emp ID: <%=empId%></SimpleTextItem>

<SimpleTextItem>First Name: <%=emp.getFirstName()%></SimpleTextItem>

<SimpleTextItem>Last Name: <%=emp.getLastName()%></SimpleTextItem>

<SimpleTextItem>Email: <%=emp.getEmail()%></SimpleTextItem>

<SimpleTextItem>Phone: <%=emp.getPhoneNumber()%></SimpleTextItem>

<SimpleTextItem>Hire: <%=emp.getHireDate()%></SimpleTextItem>

<SimpleTextItem>Job: <%=emp.getJobId()%></SimpleTextItem>

<SimpleTextItem>Elected Benefits: </SimpleTextItem>


Collection benefits = emp.getBenefits();

if (benefits == null || benefits.size() == 0) {






} // end of while } // end of if


<Action label="Add Benefits" type="SOFT1" task="GO"



<Action label="Remove Benefits" type="SOFT1" task="GO"



<Action label="Query Other Employee" type="SOFT1" task="GO"




The Action tag defines popup menus (Figure 7–1, Screen 4). The user presses the Menu button to access the popup menu.

7.5.3 Add and Remove Benefits Operations

The add and remove benefits operations for wireless clients are similar to the corresponding operations for browsers. The changes in the application needed to support these operations for wireless clients include:

Operation Details

Supporting Wireless Clients 7-17

Modifying AddBenefitToEmployee.java and

RemoveBenefitFromEmployee.java to check if the request came from a wireless client. The checks use the same format as in the query operation.

Creating addBenefitToEmployeeWireless.jsp and

removeBenefitFromEmployeeWireless.jsp to define the XML for presentation.

Creating errorWireless.jsp to display an error message.

Creating successWireless.jsp, which the application displays when a user successfully adds or removes a benefit. In addition to displaying a success message, the file also defines a popup menu that enables the user to add or remove additional benefits without having to go to the main menu. This feature is not applicable to browsers. Section 7.2.2, "Differences Between the Wireless and the Browser Application" describes this feature in detail.

Nel documento Oracle9 Application Server (pagine 103-108)