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.

A device sends a WAP request to Content Delivery Server through a WAP Gateway. The WAP Gateway adapter in Content Delivery Server parses the HTTP header from the WAP Gateway and obtains the MSISDN. The MSISDN or unique ID is used by a subscriber adapter to access the user profile.

For information on all classes and methods, 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.

Extend this class and implement all abstract methods. For additional information, see the HTML output of the Javadoc tool for the WAP Gateway API at $CDS_HOME/javadoc/cdsapi/index.html.


7.2 Using the WAP Gateway API

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 Content Delivery Server. WAPGatewayAdapter classes are available in cdsapi.jar. For convenience, a copy of all Content Delivery Server JAR files are available in the $CDS_HOME/dist/cds/staging/jar 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 Content Delivery Server.


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

Making your adapter available to Content Delivery Server depends on the application server you are using and whether you have already deployed. To make your adapter available, follow these steps:

1. Create a JAR file for your adapter.

2. For all application servers, place the JAR file in the $CDS_HOME/dist/cds/lib/external directory.

The adapter is now included in all future deployments.

3. If you have existing deployments that need to use the adapter, place the JAR file in the $CDS_HOME/deployment/deployment-name/lib/external directory for each deployment.

If you are using WebLogic Server, the classpath is handled for you.

If you are using Sun Java System Application Server, update the classpath for each deployment:

a. Back up the $CDS_HOME/deployment/deployment-name/sun/domains/cdsdomain/config/domain.xml file before editing it so you can recover from any errors that might be introduced during editing.

b. Edit domain.xml and modify the java-config element to add the absolute path for your JAR file to the classpath-suffix attribute.

c. Save your changes.

4. Restart any existing deployment to make it aware of the new JAR file.


7.3 Sample WAP Gateway Adapter

The following code example shows the pseudo code for an adapter for SampleWAPGateway 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");
  }
}