Skip Headers

Oracle9iAS Wireless Developer's Guide
Release 2 (9.0.2)

Part Number A90485-02
Go To Documentation Library
Home
Go To Product List
Solution Area
Go To Table Of Contents
Contents
Go To Index
Index

Go to previous page Go to next page

14
Transcoding

This document explains Transcoding. Each section of this document presents a different topic. These sections include:

Figure 14-1 Transcoding

Text description of feature4.gif follows.

Text description of the illustration feature4.gif

14.1 Transcoding Overview

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.

14.2 Web Content Adaptation

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.

Figure 14-2 Web Content Adaptation and Reformatting.

Text description of trans1.gif follows.

Text description of the illustration trans1.gif

14.2.1 WIDL Services

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.

14.2.2 WebIntegration Beans

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.

14.2.3 Using WebIntegration Beans

WebIntegration Beans supports the following classes

14.2.3.1 WebBeanContextDelegator

This object allows you to specify the service and the sub service of the Web Integration Service that needs to be invoked.

14.2.3.2 WebBeanDelegator

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.

14.2.3.3 Walkthrough: Creating an WIDL Using Web Integration Developer.

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.

14.2.3.4 Start the Web Integration Developer

  1. Click Start on the Windows NT desktop and point to Programs.

  2. From the Programs menu, select Oracle for Windows NT.

  3. Select Wireless Edition, then select Web Integration Developer. The Web Integration Developer appears.

14.2.3.5 Open the Source Page

Open the source page in the Web Integration Developer as follows:

  1. Select Open URL from the File menu or toolbar.

  2. In the Open URL dialog box, type the following URL: http://finance.yahoo.com

  3. Click OK. The Web Integration Developer retrieves the page, parses it, and adds it to the Document Browser (in the left frame). For this example, the Document Browser shows the following items:

    • The first item (http://finance.yahoo.com) identifies the open document.

    • The second item (the Document node) represents the contents of the HTML document: paragraphs, images, links, lists, and tables.

    • The third item (the FirstForm node) represents the form in this document. When you open a page that contains forms, the Web Integration Developer creates a form node for each form in the document.

14.2.3.6 Generate a WIDL File

Next, generate a WIDL file from the source page as follows:

  1. Select FirstForm in the left frame.


    Note:

    Go to the Configure menu and set proxy to go through the firewall.


  2. Select WIDL from the Generate menu.

  3. Complete the New Service dialog as follows:

    In this Field... Type...
    Interface StockInfo
    Service Yahoo_GetQuote

  4. Click OK.

  5. In the Generate New WIDL for Service dialog, type ORCL.

  6. Click the Submit button.

14.2.3.7 Edit the Input Binding of the WIDL File

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:

  1. Expand the Bindings folder in the left frame.

  2. Click the Yahoo_GetQuoteInput binding.

  3. Click the variable "d" in the variable list in the right frame. In the Name field, type ReportType and press Enter.

  4. Click the variable "s" in the variable list. In the Name field, type CoSymbol and press Enter.

14.2.3.8 Edit the Output Binding of the WIDL File

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:

  1. Select the Yahoo_GetQuoteOutput binding in the left frame.

  2. In the right frame, scroll through the variable list until you reach the table variables.

  3. Click the variable table10. Make sure the content of this variable is the stock price of ORCL. If not, click the variable whose content is ORCL's stock price.

  4. On the Sample tab, select the cell that contains the current stock price.

  5. Click the right mouse button and select Create New Variable From Selection from the pop-up menu.

  6. Type CurrentPrice in the New Variable dialog and click OK. The CurrentPrice variable now appears in the variable list.

  7. Delete all other variables from the variable list.

  8. Save the WIDL file.

14.2.3.9 Test the WIDL File

To test the WIDL file in the Web Integration Developer:

  1. Click Yahoo_GetQuote in the Services folder in the left frame.

  2. Select Test Service from the Tools menu.

  3. Type any valid stock symbol in the CoSymbol field.

14.2.3.10 Publish the WIDL Interface to the Web Integration Server

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.

  1. Select StockInfo in the left frame.

  2. From the File menu, select Publishing, then Publish Interface.

  3. In the Specify Server field in the Publish Interface dialog, type the name of the Web Integration Server to which you want to publish this interface. Specify the server name using the format:

    host_name:port

  4. The Web Integration Server uses packages to organize services. You can click Update Packages to view a list of packages on the specified server, then add the service to a specific package. In this case, however, you can add the sample service to the Default package. Click OK.

  5. If the User Name and Password dialog appears, enter a user name and password for the selected server. This user must have administrative privileges.Click OK.

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.

14.2.3.11 Walkthrough: Developing an Oracle9iAS Wireless Service with Web Integration Service

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.

14.2.3.12 Create the JSP Application

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>
<%
    }
%>

  1. Deploy this JSP on your J2EE Web Application Server.

  2. Confirm if you can access this JSP from your desktop browser. For example: Internet Explorer (5.0) would display this page as an XML file, while Netscape will just display the text in the file.

14.2.3.13 Creating a Oracle9iAS Wireless StockQuotes Service

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

14.2.3.14 Creating an HTTPAdapter Service

  1. Open the Webtool with your HTML Browser and Login

  2. Navigate to the Content Manager tab on the Webtool.

  3. Select "Add Service" link on the bottom of the Content Manager Page.

  4. Complete the New Service page as follows and click
    Service Name: StockQuotes
    Description: Mobile Stock Quotes
    Select Visible Check Box
    Select Personalizable Check box
    Select Normal Service

  5. Click Next

  6. Select HttpMaster Service

  7. Click Next. The screen for Setting the Init Parameters appears. Enter the following information into the fields.

    1. For the URL, enter the URL to your JSP application in the Value Column. It will be in the form of http://yourserviceport/path/.

    2. For the Replace URL enter true in the value column.

    3. For the Form Method enter GET in the value column.

  8. Click Next and on the Next page click Submit to create the Stock Quotes Service.

14.2.3.15 Making Stock Quotes Service Available to a Group

You will Webtool to make the service you created available to a group of users:

  1. Click the Content Manager tab on the Webtool

  2. On the Content Manager Page, select the sub tab Groups.

  3. Select the group Guests and click Assign Services.

  4. From the list of Available services, on the bottom half of the page, select StockQuotes Service.

  5. Click on AddToGroup button. This makes the service available to both guest and registered users of Oracle9iAS Wireless.

14.2.3.16 Testing Stock Quotes

You will now test the StockQuotes service using a browser and a phone simulator.

14.2.3.17 Testing the Service on a Browser

Log on to a browser to test the service. To access the URL:

  1. From a Web browser, enter the following

    URL: http://9iASWEServer.domain/ptg/rm

  2. Click StockQuotes Link

  3. Enter a valid stock symbol and click submit.

    The StockQuotes retrieves and displays the current stock price.

14.2.3.18 Testing Stock Quotes on a Phone Simulator

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.

  1. Start the simulator.

  2. Enter the following URL in the Go window:

    http://9iASWEServer.domain/ptg/rm
    This is the URL of the device portal for your Wireless Server installation.

  3. Select the StockQuotes Link

  4. Enter a valid stock ticker symbol (for example, ORCL) and click OK.

The Wireless server retrieves and displays the current price of the stock.


Note:

If the phone simulator returns an HTTP error, you should:
refresh the cookie cache and source cache. Then go to the phone simulator install directory and refresh (or delete) the files CookieCache and SourceCache.


14.3 WML Translator

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.

14.3.1 Deploying and Configuring WML Translator

The WML Translator is deployed as an Oracle9iAS Wireless module. The Translator service has the following service parameters.

14.3.2 Using the WML Translator

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


Go to previous page Go to next page
Oracle
Copyright © 2002 Oracle Corporation.

All Rights Reserved.
Go To Documentation Library
Home
Go To Product List
Solution Area
Go To Table Of Contents
Contents
Go To Index
Index