Oracle9iAS Wireless Developer's Guide Release 2 (9.0.2) Part Number A90485-02 |
|
This document explains Transcoding. Each section of this document presents a different topic. These sections include:
The majority of applications available on web render content in format specific to certain types of clients/devices. Transcoding services allow applications developed for a particular device/markup language to be reformatted to formats suitable for the any web-enabled device.
Transcoding services in Oracle9iAS Wireless supports a Web content reformatting service and a WML Translator service. The reformatting service allows Oracle9iAS Wireless applications to map and adapt any Web content to be reformatted for all web-enabled devices. The WML Translator service allows interpretation of content authored in WML and translates the content for access from all web enabled devices.
The Web Content adaptation service allows you to quickly extend your existing published and legacy web application to wireless web-enabled devices. Oracle9iAS Wireless services can connect any remote web resource, like HTML or XML document, and acquire content for reformatting. The content so acquired is adapted and mapped to data elements in wireless XML format and rendered to the Mobile devices.
Oracle9iAS Wireless supports WebIntegration Beans and Web Integration server that enables applications to map web content. The Web Integration Definition Language (WIDL), developed using Web Integration developer, defines the web content to be acquired by the Web Integration Server.
WIDL (Web Interface Definition Language) services allow you to acquire and extract content from any HTML documents or XML documents. WIDL service is an XML document that defines the web content that need to be acquires. WIDL services are individual units of programs that accept inputs from the application and returns outputs. The input and outputs elements are data structures with one or more elements. The inputs elements, if needed, are used by the WIDL service as inputs to acquire the content requested. The output elements represent the extracted data from the remote source. The elements within the input and output can contain complex data structures.
A WIDL service accepts inputs to execute a service and returns the extracted content as outputs. The inputs and outputs contain complex data structure elements. An application, to execute a WIDL service, has to connect to the Web Integration Server and manipulate the input and output elements.
WebIntegration Beans, a Java utility, provides the necessary abstraction and masks the complex nature of these input and output elements. WebIntegration Beans connects to the Web Integration server and executes the service. Also the beans provide software based round robin load balancing between different instances of Web Integration Server.
WebIntegration Beans supports the following classes
This object allows you to specify the service and the sub service of the Web Integration Service that needs to be invoked.
The WebBeanDelegator invokes the service with required service inputs and returns the outputs. The server to connect to is declared in the property file WebBeanProperty.properties. Both the inputs and outputs for the WebBeanDelegator are instances of HashMap (java.util.HashMap). The HashMap contains the collection of service input and output values. Depending on the service that values in the HashMap can be a string, HashMap or an array of HashMap.
In this walkthrough, you create a WIDL Integration Wireless WIDL using the Developer tool. You would use the Web Integration Developer to map the elements of a sample Web page (http://finance.yahoo.com), and define input and output parameters. You will then publish this Service to the Web Integration Server.
Follow these steps to create a Web page mapping and create a Web Integration Definition Language (WIDL) file, using the Web Integration Developer.
Open the source page in the Web Integration Developer as follows:
Next, generate a WIDL file from the source page as follows:
The input variables defined in this WIDL service have the same names as those specified in the HTML form. You can edit the input binding to make these names more meaningful as follows:
The output defined by this service extracts all elements from the document returned by the Web page. To extract just the stock quotes to pass back to the client application, you can edit the output binding:
To test the WIDL file in the Web Integration Developer:
Publishing a WIDL interface makes it accessible to Web Integration services that you create in the Service Designer.
You must have administrator authority on the Web Integration Server to perform this procedure. When you publish an interface, the services in that interface are added to those already on the Web Integration Server. If you create a service with the same name as an existing service, the existing service is overwritten.
Follow these steps to publish your WIDL file (StockInfo) to the Web Integration Server.
The Web Integration Developer copies the interface to the selected package on the Web Integration Server and notifies you that the interface is successfully published.
This walkthrough continues our StockInfo WIDL Service (from previous WIDL walkthrough). We will create a JSP application that generates Oracle9iAS Wireless XML and uses the WebIntegration Beans to execute the StockInfo WIDL service. This JSP application will then be deployed as an Oracle9iAS Wireless HTTP Service and render to the Wireless Device.
Create a JSP file, shown in the example. This JSP generates Oracle9iAS Wireless XML. The JSP looks for the "CoSymbol" as a request parameter, if Present executes the WIDL Service using the WebIntegration Beans. The response from the JSP contains the Price of the Stock requested and is embedded in Oracle9iAS Wireless XML format.
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <!DOCTYPE SimpleResult PUBLIC "-//ORACLE//DTD SimpleResult 1.1//EN" "http://xmlns.oracle.com/ias/dtds/SimpleResult_1_1_0.dtd"> <%@ page language="java" session="false" %> <%@ page import="java.util.*" %> <%@ page import="oracle.panama.tools.webbean.*" %> <% String CoSymbol = request.getParameter ("CoSymbol"); //CoSymbol is null, ask for a Symbol from the User if ((CoSymbol == null) || (CoSymbol.length() == 0)) { %> <SimpleResult> <SimpleContainer> <SimpleForm target="StockQuote.jsp"> <SimpleTitle>Stock Quotes</SimpleTitle> <SimpleFormItem name="CoSymbol" type="none" displaymode="text"> <SimpleTitle>Enter Company Symbol</SimpleTitle> </SimpleFormItem> </SimpleForm> </SimpleContainer> </SimpleResult> <% } else { //Set the Input to the User given Symbol HashMap inputs = new HashMap(); inputs.put("CoSymbol", CoSymbol); //Define the Service and ServiceContext //Set the Service to "StockInfo" and SubService to "Yahoo_GetQuote" WebBeanContextDelegator context = null; context = new WebBeanContextDelegator(); context.setService("StockInfo"); context.setSubService("Yahoo_GetQuote"); //Connect to the Server and Invoke the Service WebBeanDelegator webBean = null; webBean = new WebBeanDelegator(); HashMap outputs = webBean.invokeWebService(context,inputs); String CurrentPrice = (String)outputs.get ("CurrentPrice"); %> <SimpleResult> <SimpleContainer> <SimpleText> <SimpleTextItem> Current Price of <%=CoSymbol%> is: <SimpleBreak></SimpleBreak> <%=CurrentPrice%> </SimpleTextItem> <SimpleAction type="primary" target="StockQuote.jsp" label="New"></S impleAction> </SimpleText> </SimpleContainer> </SimpleResult> <% } %>
You will now use the Oracle9iAS Wireless Webtool to create a StockQuotes Service. The StockQuotes is an Oracle9iAS Wireless service and will execute the StockQuote.jsp using the HTTPAdapter/HTTPMasterService. The Oracle9iAS Wireless XML returned by the JSP is the transformed to the device Markup Language
You will Webtool to make the service you created available to a group of users:
You will now test the StockQuotes service using a browser and a phone simulator.
Log on to a browser to test the service. To access the URL:
You can use any phone simulator (for example, WML, HDML, CHTML) to test Stock Quotes. If you do not already have one, download and install a simulator. If you are working behind a firewall, you must configure the proxy server settings in the simulator before using it to access external sites.
Follow these steps to test the service from a phone simulator.
The Wireless server retrieves and displays the current price of the stock.
The WML translator service reformats WML documents/resources on the web to be available on all wireless web-enabled devices. The WML translator performs On-the-fly translation of remote WML resource into Oracle9iAS Wireless XML. The wireless XML is then transformed into appropriate device specific markup language.
This WML Translator enables these legacy WML applications to be integrated into mobile portals, deployed on Oracle9iAS Wireless, accessible by all web-enabled devices.
The WML Translator is deployed as an Oracle9iAS Wireless module. The Translator service has the following service parameters.
This represents a fully qualified class name. This class encapsulates the connection to the remote WML resource. This class will be instantiated by the WML Translator service and is used to get content from a WML URL.
The connection is defined by the Interface oracle.panama.module.commerce.translator.ConnectionIfc.
This default connection implementation uses HTTP connection to retrieve the WML content and is implemented by the class oracle.panama.module.commerce.translator.WMLConnectionImpl
This is a fully qualified class name that implements the WML document translation Interface defined by oracle.panama.module.commerce.translator.WMLTransformImpl. This class will be instantiated by the WML Translator service and is used to transform WML document to wireless XML format.
This default implementation uses the standard XSL Stylesheet and XSLT processor to perform the required transformation. The default implementation is provided by the class oracle.panama.module.commerce.translator.WMLConnectionImpl
This is an URL to the location of the pointing to the location of the XSL stylesheet that is used to transform WML document to Oracle9iAS Wireless XML. In no value is specified, then the default transformation class uses a pre-built XSL stylesheet.
The WML Translator is deployed as an Oracle9iAS Wireless Module service with module URL being omp://oracle/services/commerce/translator. To use the WML Translator applications can invoke the module, with the URL to the WML application as a parameter. The default parameter name is XLTORSITE, for e.g. to invoke to www.oraclemobile.com you can use the following URL in your Oracle9iAS Wireless XML omp://oracle/services/commerce/translator?XLTORSITE=http%3A%2F%2Fwww.oraclemobile.com
|
Copyright © 2002 Oracle Corporation. All Rights Reserved. |
|