    All Examples WAP Examples

# Wireless Application Protocol (WAP) phone book example

# about this example

This example illustrates:

- Connectivity between WebLogic Server and a mobile terminal through a Wireless Application Protocol (WAP) gateway.
- Serving up static Wireless Markup Language (WML) documents via the FileServlet
- Configuring WAP MIME types within WebLogic Server
- Making interactive requests to a servlet from a mobile client
- Using Nokia WAP Server as a gateway between WebLogic Server and mobile clients
- Converting HTML documents to WML using the Nokia WAP Server

In this example, phone.wml is accessed by the mobile client (the Nokia WAP simulation client) and presents the user with choices for looking up phone numbers via the PhoneServlet. (PhoneServlet is part of the servlets examples package. See the servlets examples package documentation for instructions on how to build and deploy this servlet.) Based on the user's input, a request for a phone number is presented to the PhoneServlet in the form of query parameters added to the servlet URL. The Nokia WAP Server is used as a gateway and converts WML requests received from the client to HTTP Servlet requests that are forwarded to PhoneServlet running on WebLogic Server. The HTTP response from the servlet is then converted back to WML by the WAP server before being returned to the client.

You will need to install the following software to run this example:

- Nokia WAP Server 1.0.1
- Nokia WAP Toolkit 1.3 (Beta)
- Java Runtime Environment version 1.2.2 (required by the Nokia WAP Server)
- Java HotSpot Performance Engine 1.0.1 (required by the Nokia WAP Server)

# how to use this example

## Build the example:

This examples uses PhoneServlet from the servlets examples package. You need to build and deploy this servlet before running this example.

## Configure the server:

1. Verify that the following WAP MIME types are registered in your weblogic.properties file.

       weblogic.httpd.mimeType.text/vnd.wap.wml=wml
       weblogic.httpd.mimeType.application/vnd.wap.wmlc=wmlc
       weblogic.httpd.mimeType.text/vnd.wap.wmlscript=wmls
       weblogic.httpd.mimeType.application/vnd.wap.wmlscriptc=wmlsc
       weblogic.httpd.mimeType.image/vnd.wap.wbmp=wbmp

2. Copy phone.wml from this directory into to your document root. The document root is the root directory for files that are publically available on your WebLogic Server. By default it is set to the /myserver/public_html directory in your WebLogic installation directory. For more details, see Setting up a document root.
3. If you are not going to the running the WAP simulation client on the same machine running WebLogic Server, you need to edit the phone.wml located in your document root so that URL used in the <go href="http..../> tag is pointing to the correct hostname and listen port of your WebLogic Server.

## Run the example:

Refer to the Nokia documentation for details on starting and administering the WAP server and for using the WAP Tookit.

1. Start the WebLogic Server.
2. Start the Nokia WAP Server. You must have the /bin directory of JRE 1.2.2 in your PATH to start the Nokia WAP Server.
3. Start and log into the Nokia WAP Server Manager (username="admin", password=""). Ensure that UDP bearer adapter has been started.
4. Start the Nokia WAP Toolkit.
5. From the Tookit's "Go" menu, select "Load location..."
6. In the Open Location dialog, enter:

       http://hostname:7001/phone.wml

   where:
   hostname
     Host name of the WebLogic Server
   port
     Port where the WebLogic Server is listening for connections (weblogic.system.ListenPort).
7. From the Toolkit's simulation phone hand set, select "Options".
8. Scroll to "Edit name" and hit "Select".
9. Scroll to one of names listed and hit "Select", then hit "OK".
10. Select "Options".
11. Scroll to "Get Number" then hit "Select". The simulated mobile client will contact PhoneServelt to obtain the phone number and display the results in the handset.

# there's more...

Read more about WAP in Using WAP with WebLogic Server.

Read more about Servlets in the Developer Guide, Using WebLogic HTTP Servlets.

Copyright © 2000 BEA Systems, Inc. All rights reserved.