Skip Headers

Oracle Application Server Wireless Developer's Guide
10g (9.0.4)

Part Number B10948-01
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

3
OracleAS Wireless Developer Kit

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

Section 3.1, "Wireless Developer Kit Overview"

Section 3.2, "WDK Installation and Configuration"

Section 3.3, "WDK Log File"

Section 3.4, "Running a Wireless Application with the WDK Tutorial"

3.1 Wireless Developer Kit Overview

OracleAS Wireless includes a developer's kit to enable development and testing of wireless applications without the full installation of Oracle Application Server. The kit provides support for developing applications in the following areas:

OracleAS Wireless Developer Kit is tightly integrated with Oracle JDeveloper Wireless Edition, offering such features as wizards, code templates, and device simulators. Because OracleAS Wireless Developer Kit is offered in a standalone mode, any IDE or development tool can leverage the development functionality of OracleAS Wireless.

3.2 WDK Installation and Configuration

Oracle Application Server WDK is a part of the Oracle Application Server Developer CD. Also, it is embedded in Oracle JDeveloper Wireless Edition. The WDK is very easy to install and use and in normal situations does not require any post-installation configuration. For advanced configuration, see the WDK component-specific configuration in the corresponding sections of this document.

3.2.1 Oracle Application Server Wireless Developer Kit Structure

After installing the WDK, you will have the following directory structure:

3.2.2 Multi-Channel Server Lite (MCSLite)

This section describes how developers can take advantage of the MCSLite component of the WDK to develop and test their Multi-Channel applications.

MCSLite is a J2EE web application containing servlets and a servlet filter. It has a small memory footprint, yet provides all the content adaptation functionality of a full-fledged MCS Server. Its purpose is to help developers to completely test their applications before deploying on OracleAS Wireless Server.

The main goal of the MCSLite is testing; it provides information to developers to help them better understand the execution of their application. The MCSLite log file contains the following important information:

MCSLite can be deployed in two ways:

3.2.2.1 Key Features

The key features of MCSLite are:

3.2.2.2 How to Use MCSLite

MCSLite was designed to be extremely easy to use. To use it, you must first create and deploy your web application. You can use any web technology to develop your application. You can use either static or dynamic pages. Also, you can use either MobileXML or XHTML+XForms or XHTML MP markup languages. The only requirement is that the application is accessible through HTTP protocol.

3.2.2.2.1 Accessing your application through MCSLite

The usage depends on the current deployment, either local or remote.

3.2.2.3 Sending Parameters to a Back-end Application

Regardless of the MCSLite deployment scenario, sending parameters to a back-end application is the same; it is no different than sending such parameters from a regular browser. Just add those parameters in the query part of the URL. For example, to send two parameters to your application:

fname=John and lname=Doe

then you add to the URL as follows:

http:// ... /myApp.jsp?fname=John&lname=Doe


Notes:

  • Remember to URL-encode the names and values of the parameters.

  • There is a list of OracleAS Wireless reserved parameter names. Choose different names for your parameters; MCSLite will filter out any parameters that are reserved.


3.2.2.4 MCSLite URL Rewriting and Caching

MCSLite uses the same URL rewriting and caching mechanism as MCS except that it uses a configuration parameter indicating whether the long or the short form of URL rewriting should be used.


See Also:

For more information on URL rewriting and caching, see Chapter 9, "Using Multi-Channel Server".


3.2.2.5 National Language Support (NLS)


See:

For information on National Language Support, see Section 9.4.6, "Globalization (NLS) Support".


3.2.2.6 MCSLite Log File

The log file contains information crucial for developers; it is a good source for debug information when testing applications. There are four types of messages that can be found in the log file:

You can view the log file in one of two ways:

For each message in the log file, the IP address and session information for the device request is provided. This is useful when you want to find requests coming from your device versus requests from someone else's device.


Note:

Error messages in the log.xml file, of the format XFM-xxxx, are generated by the XForms processor.


3.2.2.7 MCSLite Advanced Configuration

One of the advantages of MCSLite is that it works out of the box without any configuration. You can optionally perform advanced configuration actions. MCSLite allows configuration of: log file location and name, logging level, XML validation mode, enabling or disabling auto-reload of devices and transformers, and more. To perform these configuration actions, edit the MCSLite web.xml file. web.xml is located in [ORACLE_HOME]/wireless/wdk/server/applications/wdk/wdk-web/WEB-INF

Here are the configuration properties in MCSLite web.xml:

3.2.2.8 Device Description

In OracleAS Wireless server, all device descriptions are stored in the database. However, to simplify MCSLite, database connections are not necessary; each device description is stored in an XML file. The device XML files are located in [ORACLE_HOME]/wireless/wdk/server/applications/wdk/wdk-web/repository. Each XML file contains the metadata that describes attributes and characteristics of a single device.

Some of the important device properties required by the MCSLite are:

3.2.2.9 Device Detection

MCSLite uses the same sophisticated device detection algorithm as OracleAS Wireless server.


See Also:

For more information on device properties, see Chapter 9, "Using Multi-Channel Server".


3.2.2.10 Multimedia Adaptation

The multimedia adaptation supported by MCSLite is the same as in OracleAS Wireless server, except that MCSLite multimedia adaptation does not provide the extensible framework for plugging-in your own implementation of the multimedia adaptation interfaces.


See Also:

For more information on multimedia adaptation, see Chapter 9, "Using Multi-Channel Server".


3.2.2.11 Location Services

Application developers can build exciting new location services, or enhance their existing applications with location information. To do that they need specialized services:

OracleAS Wireless WDK provides an application programming interface (API) to access these location services components. Developers can access OracleAS Wireless Web Services from these APIs to develop, debug and test their applications without setting up the complete OracleAS Wireless environment together with the relevant content service providers.

The following sections briefly describe some of the important API calls along with some examples. API details can be found in the Javadoc provided with the WDK.

3.2.2.11.1 Mobile Positioning

The mobile positioning service allows you to get and set a mobile user's current location. This service is implemented as a web service in OracleAS Wireless WDK. It enables applications to get and set a mobile user's current location from anywhere on the Internet using any programming model.

The oracle.panama.mp.soap.MPSoapClient class wraps the client SOAP calls and exposes the services in the Java programming interface. A client Java program must first construct an object of this class using the web service URL and the service ID before getting and setting a mobile user's location. The web service URL is the SOAP router of the location web service on an OracleAS Wireless server; for example, http://myaswserver.oracle.com:7777/location/web services. The service ID is the SOAP service ID, for example: urn:MobilePositionServer.

3.2.2.11.2 Location Services

The LBS web services API on the client side is virtually identical to the API within OracleAS Wireless server. The following examples demonstrate this. The most relevant difference is that a set() function must specify the server. Within OracleAS Wireless server, an application would not be required to specify such a target server.

Geocoding

Geocoding supports these functions:

The following example shows the geocoding operation:

...
  public static void main(String args[])
  {
    SpatialManager.set(
      "http://mhorhamm-us.us.oracle.com:9000/studio/soap/servlet/soaprouter",
      "your username",
      "your password");

	    Location locs[] =
	      SpatialManager.getGeocoder().geocodeAddress(
	        new LocationImpl(
	          new PointImpl(0, 0),
	          "Oracle",
	          "1",
	          new String[] { "Oracle Dr" },
	          "",
	          "Nashua",
	          "NH",
	          "03062",
	          "",
	          "US"),
	        "");
	    if(locs != null)
	    {
	      for(int i = 0; i < locs.length; i++)
	        System.out.println(i + ": " + locs[i]);
	    }
	    else
	      System.out.println("null");
	
	    
	  }
	

Mapping

Mapping supports these functions:

The following example shows the mapping with one marked point:

	...
	  public static void main(String args[])
	  {
	    SpatialManager.set(
	      "http://mhorhamm-us.us.oracle.com:9000/studio/soap/servlet/soaprouter",
	      "your username",
	      "your password");
	
	    Location
	      adr1[] =
	        SpatialManager.getGeocoder().geocodeAddress(
	          new LocationImpl(
	            new PointImpl(0, 0),
	            "NEDC",
	            "1",
	            new String[] { "Oracle Dr" },
	            "",
	            "Nashua",
	            "NH",
	            "03062",
	            "",
	            "US"),
	          ""),
	      adr2[] =
	        SpatialManager.getGeocoder().geocodeAddress(
	          new LocationImpl(
	            new PointImpl(0, 0),
	            "HQ",
	            "500",
	            new String[] { "Oracle Parkway" },
	            "",
	            "Redwood City",
	            "CA",
	            "94065",
	            "",
	            "US"),
	          "");
	
	
	    System.out.println(
	      SpatialManager.getMapper().getMapURL(
	        adr1[0],
	        ImageFormats.GIF,
	        800,
	        600,
	        false));
	
	    ...
	  }
	...

Driving Directions

The Driving Directions component supports these functions:

The following example shows the driving direction between two addresses:

	...
	  public static void main(String args[])
	  {
	    SpatialManager.set(
	      "http://mhorhamm-us.us.oracle.com:9000/studio/soap/servlet/soaprouter",
	      "your username",
	      "your password");
	
	    Location
	      adr1[] =
	        SpatialManager.getGeocoder().geocodeAddress(
	          new LocationImpl(
	            new PointImpl(0, 0),
	            "NEDC",
	            "1",
	            new String[] { "Oracle Dr" },
	            "",
	            "Nashua",
	            "NH",
	            "03062",
	            "",
	            "US"),
	          ""),
	      adr2[] =
	        SpatialManager.getGeocoder().geocodeAddress(
	          new LocationImpl(
	            new PointImpl(0, 0),
	            "HQ",
	            "500",
	            new String[] { "Oracle Parkway" },
	            "",
	            "Redwood City",
	            "CA",
	            "94065",
	            "",
	            "US"),
	          "");
	
	    //////////////////////////////////////////////////////////////////
	
	    RoutingSettings settings = new RoutingSettings(true, false);
	    settings.setSecondaryOption(RoutingOption.maneuverMapWidth,   "800");
	    settings.setSecondaryOption(RoutingOption.maneuverMapHeight,  "600");
	    settings.setSecondaryOption(RoutingOption.overviewMapWidth,   "800");
	    settings.setSecondaryOption(RoutingOption.overviewMapHeight,  "600");
	    
	    System.out.println(
	      SpatialManager.getRouter().computeRoute(
	        adr1[0],
	        adr2[0],
	        null,
	        settings,
	        Locale.US));
	    
	  }
	

Business Directory

The Business Directory component supports these functions:

The following example shows several categories and businesses with a given name:


  public static void main(String args[])
  {
    SpatialManager.set(
      "http://mhorhamm-us.us.oracle.com:9000/studio/soap/servlet/soaprouter",
      "your username",
      "your password");

    //////////////////////////////////////////////////////////////////

    System.out.println(SpatialManager.getYPFinder().getCategoryAtRoot());
    System.out.println(SpatialManager.getYPFinder().getCategoryAtPath(new 
String[0]));
    YPCategory cats[] =
      SpatialManager.getYPFinder().getCategoryAtRoot().getSubCategories();
    if(cats != null)
      for(int i = 0; i < cats.length; i++)
        System.out.println(i + ": " + cats[i]);

    //////////////////////////////////////////////////////////////////

    YPBusiness b[] =
      SpatialManager.getYPFinder().getBusinessesAnywhere(
        "Border",
        Locale.US);
    for(int i = 0; i < b.length; i++)
      System.out.println(i + ": " + b[i]);

    
  }

3.3 WDK Log File

OracleAS Wireless WDK provides a log file to help you develop wireless applications. This section provides a detailed explanation of the information logged in the WDK log file.

The amount of information that is logged in the log file can be configured by changing the wdk.log.level parameter in WEB-INF/web.xml. The possible values for this parameter, with the amount of information being most to least, are: debug, info, warning, and error. The default value of this parameter is info. At this level, the kinds of information that are logged to the log file are:

When debug log level is used, more log messages are produced. The debug messages are:

3.3.1 WDK Log Sample

The following excerpt from the WDK log file in debug log level is for a single successful request-response cycle using UP Simulator 4.1.1.

The header includes:

3.3.2 Common Mistakes Encountered

This section explains some of the common mistakes encountered in the WDK:

The value of back-end URL can be checked in the log file under Back end URL.

Sample log entries:

127.0.0.1 - - 3b34912b68474bc1b1defa87e74dbd1e - - DEBUG : [Fri, 23 May 2003 11:06:45 PDT]
Back end URL: http://localhost:9010/mcs/examples/mobile-xmll/index.jsp

127.0.0.1 - - 3b34912b68474bc1b1defa87e74dbd1e - - DEBUG : [Fri, 23 May 2003 11:06:45 PDT]
Back end response code: 404 ; response message: Not Found

127.0.0.1 - - 3b34912b68474bc1b1defa87e74dbd1e - - ERROR : [Fri, 23 May 2003 11:06:45 PDT]
javax.servlet.ServletException: 
HTTP(S) Error: 404 : Not Found

Sample log entries:

127.0.0.1 - - 3b34912b68474bc1b1defa87e74dbd1e - - INFO : [Fri, 23 May 2003 10:59:27 PDT]
Response HTTP headers received from back end application:
x-oracle-wireless.referer.url: http://localhost:9010/mcs/examples/index.jsp
content-type: application/vnd.oracle.xhtml+xforms; charset=UTF-8
x-oracle-wireless.base.url: http://localhost:9010/mcs/examples/index.jsp
connection: Close
date: Fri, 23 May 2003 17:59:27 GMT
server: Oracle9iAS (9.0.3.0.0) Containers for J2EE
content-length: 994

Sample log entries:

127.0.0.1 - - 3b34912b68474bc1b1defa87e74dbd1e - - INFO : [Fri, 23 May 2003 11:00:50 PDT]
XML Result from backend: 
<?xml version = "1.0" encoding = "UTF-8" standalone="yes" ?>

<html profile="http://xmlns.oracle.com/ias/dtds/xhtml+xforms/0.9.0/1.0"
      xmlns="http://www.w3.org/1999/xhtml" 
      xmlns:style="urn:oracle:iasw-internal:style.1.0" 
      xmlns:extra="urn:oracle:iasw-internal:mxml.1.0">
  <head>
     <title>Oracle9iAS Wireless Examples</title>
     <style type="text/css">
         .title {font-style: italic; color: blue; font-size: xx-large}
         .menu {font-style: italic; color: blue; font-size: x-large}
         li {font-weight: bold; color: blue}
     </style>
  </head>
  <body>
    <nl style="list-style-type: decimal">
      <label class="title">Oracle9iAS Wireless Examples</label>
      <li class="menu" href="xhtml%2Bxforms/index.jsp">XHTML+XFroms Examples</li>
      <li class="menu" href="xhtml%2Bmp/index.jsp">XHTML MP Examples</li>
      <li class="menu" href="mobile-xml/index.jsp">MobileXML Examples</li>
    </nl>
  <body>
</html>

127.0.0.1 - - 3b34912b68474bc1b1defa87e74dbd1e - - ERROR : [Fri, 23 May 2003 11:00:50 PDT]
oracle.wireless.sdk.SdkException: The xml could not be parsed. It contains invalid xml.

3.4 Running a Wireless Application with the WDK Tutorial

This tutorial takes you through the process of setting up a OracleAS Wireless development environment on your laptop or desktop using the Wireless Developer's Kit (WDK). You will take a few existing applications and run them in your environment.

3.4.1 What you Need

3.4.2 Tutorial Overview

The WDK is a small runtime environment of OracleAS Wireless. It includes the Multi-Channel Server of OracleAS Wireless for device adaptation and multi-media adaptation allowing you to build and test wireless applications.

3.4.3 Environment Set Up

The following steps take you through the WDK environment setup.

3.4.3.1 Set up your WDK Environment

  1. Download and install JDK 1.4.1 onto your computer (to, for example, D:\j2sdk1.4.1_01). If you do not have JDK 1.4.1, you can download it from http://java.sun.com. This tutorial assumes you installed the JDK at D:\j2sdk1.4.1_01.

  2. Download and install the Wireless Developer's Kit (WDK) onto your machine:

    1. Unzip the WDK anywhere on your computer. Make sure the path to the WDK does not include spaces.

    2. Set two environment variables on your computer:

      • IAS_HOME to D:\wdk9041 (to where you unzipped the WDK); and

      • JAVA_HOME to D:\j2sdk1.4.1_01 (to where you installed JDK 1.4.1)

  3. Download and install a device simulator (if you do not already have one). If you have Internet access, you can get a device simulator at the Mobile Tech Center on OTN: http://otn.oracle.com/tech/wireless/tools/content.html.

3.4.3.2 Configure the WDK

You must modify the following WDK files:

The entries: __REPLACE_WITH_IASW_HOME_PATH__, must be replaced with the absolute path to the WDK_INSTALL_DIR. Use the slash (/) for the directory separator, even in Microsoft Windows. For example, if the WDK is installed in d:\wdk, then replace __REPLACE_WITH_IASW_HOME_PATH__ with d:/wdk.

3.4.3.3 Start the WDK

  1. Run wdk.bat (in wdk9041/j2ee/home/wdk.bat) to start the Wireless environment. At first startup, some files will be unpacked. After starting, a messaging appears stating the Containers for J2EE have initialized.

  2. To stop the environment, type ctrl-C, and answer Yes. Restart the environment as in Step 1 above.

There are two main URLs that you need to know for the Wireless Development Kit: the URL to access your application and the URL to view the logs.

http://<host_name>:9010/wdk/mcslite/http/<host_name>/9010/examples/<app_name>

For example, http://localhost:9010/wdk/mcslite/http/localhost/9010/examples/mobile-xml/Hello.jsp. Use this URL to access the Hello World example with your PC browser or your mobile device simulator. This is a simple demo to test your WDK.

The code for the Hello World application is in the following directory of the WDK: D:\wdk9041\wireless\j2ee\applications\wdk\examples-web\mobile-xml. You will not be able to see the examples code until you start the WDK for the first time and the WDK unpackages the examples.

Explanation of the URL: the WDK enables Wireless access to your application even if the application is not running in the WDK environment. The first part of the URL (http://localhost:9010/wdk/mcslite/http/), means that you want to access a wireless application with the WDK. The second part the URL (localhost/9010/examples/mobile-xml/Hello.jsp), is the URL of your application.

If your application was located on Geocities, the full URL would be http://localhost:9010/wdk/mcslite/http/www.geocities.com/myaccount/Hello.jsp.

http://<host_name>:9010/wdk/log. For example, http://localhost:9010/wdk/log. This provides the full error logs on requests to the WDK. Try this URL in your PC browser to view the log of your Hello World application; scroll down to the bottom to view the newest log output.

3.4.4 Multi-media Adaptation Demonstration

OracleAS Wireless includes multi-media adaptation capabilities. If an application includes a GIF image, the server will automatically resize and convert the image to the appropriate format. For example, a GIF will be converted to WBMP format for a WAP phone. The following example will show an Oracle logo image on multiple devices. Copy and paste this URL into your PC browser, color phone, or black and white phone to see the images.

http://localhost:9010/wdk/mcslite/http/localhost/9010/examples/mobile-xml/ImageExample.jsp


Go to previous page Go to next page
Oracle
Copyright © 2003 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