C H A P T E R  7

WAP Gateway API

This chapter describes the Sun Java System Content Delivery Server WAP Gateway API. This API retrieves the MSISDN, device profile, and other attributes from the HTTP header. Authentication based on user and password is not required with WAP gateway integration.

FIGURE 7-1 is a simplified representation of the general system components that interact with this API and the access point for it. It also includes additional components that do not interact with this API, but are necessary for an overall understanding of the architecture.


FIGURE 7-1 WAP Gateway Adapter Architecture

Overview of the WAP Gateway adapter. This figure is described in the text.


The WAP Gateway adapter parses the HTTP header from a specific WAP Gateway and obtains the MSISDN.

For information on classes or methods not described in this section, see the HTML output of the Javadoc tool for the WAP Gateway API at $CDS_HOME/javadoc/cdsapi/index.html.


7.1 WAPGatewayAdapter Class

The public abstract WAPGatewayAdapter class defines the methods to get the MSISDN and unique device ID from the HTTP header. It also defines a method to check if this method is supported or implemented.

For information on methods not described in this section, see the HTML output of the Javadoc tool for the WAP Gateway API at $CDS_HOME/javadoc/cdsapi/index.html.

7.1.1 doHandle()

public abstract boolean doHandle(String method)throws WAPGatewayException

Returns true if method is implemented, and returns false if method is not implemented. This method is used to determine if the other methods for this class are implemented.

7.1.2 getMSISDN()

public abstract String getMSISDN(HttpServletRequest request) throws WAPGatewayException

Returns the MSISDN as a string after parsing the HTTP header.

7.1.3 getUniqueId()

public abstract String getUniqueId(HttpServletRequest request) throws WAPGatewayException

Returns the unique device ID as a string after parsing the HTTP header.


7.2 Using the WAP Gateway API

The Content Delivery Server provides an API implementation for the following WAP Gateways.

A WAP gateway must be configured to forward the MSISDN or the unique device ID to the Content Delivery Server. WAPGatewayManager and WAPGatewayAdapter classes are available in cdsapi.jar, which is in the $CDS_HOME/deployment/deployment-name/lib/cdslib directory. To register a new class that extends the WAPGatewayAdapter class for any other WAP gateway, add the class file name to the wapgateway.config file inside the $CDS_HOME/deployment/deployment-name/conf directory. The following statement is an example of how to register an adapter for Nokia Activ Server 2.0.1 with the Content Delivery Server.


module.gateway.id=com.sun.content.server.service.gateway.nokia.NokiaActivServerWAPGateway

Place your adapter in the $CDS_HOME/deployment/deployment-name/lib/external directory so that the Content Delivery Server can find the file during execution.


7.3 Sample WAP Gateway Adapter

The following code example shows the pseudo code for an adapter for Nokia Activ Server that extends WAPGatewayAdapter class.


CODE EXAMPLE 7-1 Example Using the WAPGatewayAdapter Class
package com.sun.content.server.service.gateway.sample;
 
import com.sun.content.server.service.gateway.WAPGatewayAdapter;
import com.sun.content.server.service.gateway.WAPGatewayException;
import javax.servlet.http.HttpServletRequest;
 
public class SampleWAPGateway extends WAPGatewayAdapter
{
  /* Method to check if the passed method is implemented in this
   * class or not. */
  public boolean doHandle(String method) throws WAPGatewayException
  {
    if (method.equals("getMSISDN"))
      return true;
    return false;
  }
 
  /* Gets the MSISDN from the header and returns as a string. */
  public String getMSISDN(HttpServletRequest request)
  {
    return request.getHeader("<key to retrieve>");
  }
 
  /* This method is not implemented. */
  public String getUniqueId(HttpServletRequest req)
throws WAPGatewayException
  {
    throw new WAPGatewayException("This method is not implemented");
  }
}