Oracle9iAS Wireless Developer's Guide Release 2 (9.0.2) Part Number A90485-02 |
|
Each section of this document presents a different topic. These sections include:
Mobile Modules are wireless services with well-known virtual URL (OMP URL, i.e. omp://my.module). Mobile Modules provide an analogous mechanism to data abstraction and interfaces. They allow a component-based programming model for building mobile applications within the Oracle9iAS Wireless framework. Component-based programming provides rapid application development, reusable components and easy-to-maintain code which are essential to timely, successful deployment of web applications.
Mobile Modules can be called from any application or module and may be instructed to return control to another application or module. Calls may be nested to any level. This mechanism of bi-directional linking allows quick applications assembly.
Important difference between a module and a regular service is that the module receives information about the service it needs to return to after it is done. This is not always the caller of the module (the module caller may want the module to return to a different service).
An example of an application that leverages Mobile Modules could be a store locator application for a retail company. A developer writing this application could improve the interface by linking to the Location Mobile Module, which enables a user to store frequently accessed locations as landmarks. The application would then offer to find the nearest store based on one of those locations, saving the user the time and effort of entering an address. The next logical step would be to link to the Driving Directions Mobile Module, so that a customer could easily get directions to the store they have selected. This would enable the user to get directions without typing in any additional information, since both the starting location and the destination address (store) would intelligently populate the corresponding fields in the application.
The target attribute of SimpleMenuItem, SimpleAction, SimpleHref, and SimpleForm may be used for linking to a Mobile Module. The value of the target attribute starts with omp:// for accessing modules.
These are the XML attributes that are used for linking to Mobile Modules:
<SimpleMenuItem target="omp://oracle.com/module" callbackurl="%value service.home.url%">Call My Mobile Module</SimpleMenuItem>
<SimpleMenuItem target="omp://oracle.com/module" callbackurl="%value service.home.url%" secure="false">Call My Mobile Module</SimpleMenuItem>
<SimpleMenuItem target="omp://oracle.com/module" callbackurl="%value service.home.url%"> Call My Mobile Module</SimpleMenuItem>
<SimpleMenuItem target="omp://oracle.com/module" secure="true" callbackurl="%value service.home.url%" callbacksecure="false"> Call My Mobile Module</SimpleMenuItem>
<SimpleMenuItem target="omp://hostname/module" callbackurl="%value service.home.url%" callbackparam="foo=bar&test=TEST&a=z ">My Mobile Module</SimpleMenuItem>
Oracle9iAS Wireless contains a set of 17 ready-to-use modules subdivided in the following areas: mobile commerce, PIM and location-based services. Application developers may reuse these modules as the jumpstart of their wireless development work, or develop their own modules, by following the instructions in this document. For a complete reference on the shipped Mobile Modules, see Chapter 18, "Mobile PIM and eMail" and Chapter 19, "m-Commerce"
To use the Payment Module in order to make an credit card payment of US$ 90.00 you will use:
<SimpleMenuItem target="omp://oracle/services/commerce/payment?AMOUNT=90&merchantid=bookshop&MODE=ONLINE&TYPE=AUTH&INSTRTYPE=CC" callbackurl="%value service.home.url%">Pay amount</SimpleMenuItem>
The payment module will take the action after the user chooses this menu, and will present a flow of cards that will lead to the payment itself. In the end the Payment Module will return the transaction id in the HTTP request.
To use the Mail Module you will need to inform the action and the email to whom you want to sent the message:
<SimpleMenuItem target="omp://oracle/services/pim/mail?action=messageto&mailto=jsmith@company.com" callbackurl="%value service.home.url%">Send eMail</SimpleMenuItem>
To use the Maps Module you will need to inform the address you want to map:
These are just small examples on how to call the shipped Mobile Modules. For a more complete reference of the Modules OMP URLs, input and output values please see Chapter 18, "Mobile PIM and eMail" and Chapter 19, "m-Commerce".
<SimpleMenuItem target="omp://oracle/services/location/maps?FL=500 Oracle Parkway&CI=Redwood Shores&ST=CA" callbackurl="%value service.home.url%">Map Oracle</SimpleMenuItem>
Note:
Developing Mobile Modules is not very different than developing your own services. For more details about how to develop service see Chapter 15, "Using Location Services", Chapter 18, "Mobile PIM and eMail", and Chapter 19, "m-Commerce". In our examples we are going to use the HttpAdapter. The mobile modules will use simple JSP pages.
Our first mobile module does not do much. It will just display "Hello World" on the end user device and a link to go back to the module caller service.
Here is the JSP code for the module:
<?xml version = "1.0" encoding = "UTF-8" standalone="yes" ?> <!DOCTYPE SimpleResult PUBLIC "-//ORACLE//DTD SimpleResult 1.1.0//EN" "http://xmlns.oracle.com/ias/dtds/SimpleResult_1_1_0.dtd"> <%@ page contentType="text/vnd.oracle.mobilexml; charset=UTF-8" %> <%@ page language="java" %> <%@ page session="false" %> <SimpleResult> <SimpleContainer> <SimpleMenu> <SimpleTitle>Hello World</SimpleTitle> <SimpleMenuItem target="%value module.callback.url%">Go Back To The Caller</SimpleMenuItem> </SimpleMenu> </SimpleContainer> </SimpleResult>
Please save this code in HelloWorldModule.jsp and publish it at let say http://localhost/jsp/HelloWorldModule.jsp.
And the JSP code for the caller service:
<?xml version = "1.0" encoding = "UTF-8" standalone="yes" ?>
<!DOCTYPE SimpleResult PUBLIC "-//ORACLE//DTD SimpleResult 1.1.0//EN"
"http://xmlns.oracle.com/ias/dtds/SimpleResult_1_1_0.dtd">
<%@ page contentType="text/vnd.oracle.mobilexml; charset=UTF-8" %>
<%@ page language="java" %>
<%@ page session="false" %>
<SimpleResult>
<SimpleContainer>
<SimpleMenu>
<SimpleTitle>Hello World Caller</SimpleTitle>
<SimpleMenuItem target="omp://HelloWorld" callbackurl="%value
service.home.url%"
>Call Hello World Module</SimpleMenuItem>
</SimpleMenu>
</SimpleContainer>
</SimpleResult>
Please save this code in HelloWorldCaller.jsp and publish it at (for instance): http://localhost/jsp/HelloWorldCaller.jsp
After we publish the JSP pages we need to create two HttpAdapter based MasterServices. Use the Service Designer web tool to do that. See Oracle9iAS Wireless Getting Started and System Guide for more details about creating MasterServices
After you are done with the MasterServices you need create two services: HelloWorldModule and HelloWorldCaller. Use the Content Manager web tool to do that. See Oracle9iAS Getting Started and System Guide for more details about creating MasterServices.
That is it. Now you can test the two services from your device.
The Mobile Modules that you want to develop will most likely take some input from its caller and then return something back after there are done. Below are the JSP pages that show how a caller service can send an input parameter to a module. Publishing those two JSP pages on Oracle9iAS Wireless is the same as publishing the previous JSP pages.
Here is the code for the HelloNameModule.jsp
<?xml version = "1.0" encoding = "ISO-8859-1" standalone="yes" ?> <!DOCTYPE SimpleResult PUBLIC "-//ORACLE//DTD SimpleResult 1.1.0//EN" "http://xmlns.oracle.com/ias/dtds/SimpleResult_1_1_0.dtd"> <%@ page contentType="text/vnd.oracle.mobilexml; charset=ISO-8859-1" %> <%@ page language="java" %> <%@ page session="false" %> <% String uname = request.getParameter("uname"); %> <SimpleResult> <SimpleContainer> <SimpleMenu> <SimpleTitle>Hello Module Says Hello <%=uname%></SimpleTitle> <SimpleMenuItem target="%value module.callback.url%">Go Back To The Caller</SimpleMenuItem> </SimpleMenu> </SimpleContainer> </SimpleResult> And the JSP code for the HelloNameCaller.jsp: <?xml version = "1.0" encoding = "ISO-8859-1" standalone="yes" ?> <!DOCTYPE SimpleResult PUBLIC "-//ORACLE//DTD SimpleResult 1.1.0//EN" "http://xmlns.oracle.com/ias/dtds/SimpleResult_1_1_0.dtd"> <%@ page contentType="text/vnd.oracle.mobilexml; charset=ISO-8859-1" %> <%@ page language="java" %> <%@ page session="false" %> <SimpleResult> <SimpleContainer> <SimpleForm target="omp://HelloName"> <SimpleTitle>Please Enter User Name</SimpleTitle> <SimpleFormItem name="uname" /> </SimpleForm> </SimpleContainer> </SimpleResult>
Note: Before you can test the newly created services you need to assign them to a Group so the users in that group can invoke those services. |
That is it. Now you can test the two services from your device.
|
Copyright © 2002 Oracle Corporation. All Rights Reserved. |
|