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

16
Billing

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

Section 16.1, "Overview"

Section 16.2, "Using the Billing Integration Framework"

Section 16.3, "BillingLoader Utility"

Section 16.4, "Billing Collector and Service Detail Record"

Section 16.5, "Billing Driver"

Section 16.6, "Billing Integration Scenario"

16.1 Overview

OracleAS Wireless Billing Integration Framework provides an extensible and flexible framework to model billable services, capture billable actions, and integrate with any billing engine.

Figure 16-1 Billing Framework Architecture

Text description of drm13.gif follows.

Text description of the illustration drm13.gif

16.1.1 Concepts

Billable Action--Customer actions which should be tracked, authorized and reported to the billing system. Typical examples are premium service access, mobile content download, alert subscription and message delivery.

Billing Context--A marker interface whose implementation object provides all the data related to a given billable action. OracleAS Wireless has the following objects predefined as Billing Context:

Service Detail Record (SDR)--A generic object that captures all the billing-specific attributes from the billing context for a given billable action. The attributes are of two types: mandatory and extended. Mandatory attributes are user information, service information and component information. Extended attributes contain the component-specific information.

Billing Collector--An extensible object that processes the BillingContext and generates the corresponding service detail record.

Billing Driver--A Java interface defined by OracleAS Wireless; it interacts with an external billing system to handle a given billable action. A billable action is usually handled in two steps:

16.2 Using the Billing Integration Framework

16.2.1 Billable Actions and Billing System Interaction

16.2.1.1 Default Billable Actions

OracleAS Wireless defines the following billable actions:

16.2.1.2 Custom Billable Actions

OracleAS Wireless billing integration framework allows users to introduce custom billable actions to meet their business needs. Following are the steps to introduce a new billable action:

Use the following code segment to trigger a new billable action for a preService call:

// Suppose your BillingContext Object is foo 
BillingController controller =  BillingController.getInstance(); 
if (controller.isBillingEnabled() ) 
 { 
       try { 
             BillingResult result = controller.preService(foo); 
            if ( result != null ){ 
               ServiceDetailRecord sdr = result.getServiceDetailRecord(); 
               if (result.getResultCode() != BillingResult.FAILED) { //Succeed 
                 // Add your logic here 
               } 
              else { // Failed 
                    // Add your logic here to handle preService failure 
                    //BillingException e = new BillingException(failure message); 
                    // e.setResult(result);
                    // throw e;

              } 
          } 
      } catch (BillingException be) { 
               //Handle Billing Execption here 
         } 

Use the following code segment to trigger a new billable action for postService call:

// Suppose your BillingContext Object is foo 
BillingController controller =  BillingController.getInstance(); 
if (controller.isBillingEnabled() ) 
 { 
       try { 
             BillingResult result = controller.postService(foo); 
            if ( result != null ){ 
               ServiceDetailRecord sdr = result.getServiceDetailRecord(); 
               if (result.getResultCode() != BillingResult.FAILED) { //Succeed 
                 // Add your logic here 
               } 
              else { // Failed 
                    // Add your logic here to handle postService failure 
              } 
          } 
      } catch (BillingException be) { 
               //Handle Billing Execption here
         } 

16.3 BillingLoader Utility

The BillingLoader Utility is a batch utility to download, purge and upload billing transaction records. For more information on BillingLoader Utility, see OracleAS Wireless Administrator's Guide.

16.4 Billing Collector and Service Detail Record

A billable operation for every component is split into 2 parts: a pre-event and post-event. An SDR is generated for both the pre- and post- events. The billing data collector class is used to create one SDR for each pre- or post- service call.

When the pre-service SDR is passed to the billing system, the billing system is expected to set a unique Billing Reference ID and return the SDR as part of the billing result.

The returned pre-service billing reference ID is extracted by OracleAS Wireless. It is set in the post service SDR of the same billable operation so that the external billing system can maintain state between the pre- and post- event of any single billable operation based on the billing reference ID.

Only the post service billing event SDR is logged to the database, unless the driver starts-up a transaction by setting the transaction ID attribute in the SDR which it returns after the pre-service. If the transaction ID is set, then the pre-service SDRs are also logged. You can identify the pre and post service SDRs based on the LOG_TYPE column which will be either PRE_SERVICE or POST_SERVICE.

The SDR ID is an internal ID used as a primary key in our tables. You can look up a particular SDR based on the SDR ID.

There is normally only one SDR ID for every post-service event, unless the driver starts up a transaction (in which case the pre-service SDR is logged).

16.4.1 Default Billing Collector Implementation

The BillingCollector implementation object is responsible for processing the BillingContext for a given billable action. It generates an appropriate Service Detail Record for the billing driver to process. OracleAS Wireless includes a default BillingCollector implementation named BillingCollectorImpl which handles the following BillingContext objects:

16.4.2 Service Detail Record ID Versus Billing Reference ID

Service Detail Record ID is defined by the Billing Collector. The default format is [Component Name: Random Key]. The Billing Reference ID is obtained from the billing system. In the pre-bill case, it is usually defined as the authorization ID.

16.4.3 Extend Default Billing Collector

OracleAS Wireless billing integration framework enables users to extend the default billing collector implementation for various reasons:

To ignore a billable action base on the context data. Simply return a null object from the createServiceDetailRecord call based on your business logic.

Specify your extended Billing Collector using Oracle Enterprise Manager:

EM > Wireless Server: Site Administration > Billing Framework > Billing Collector Class name

16.4.4 Maintaining Transaction Context on Multi-part Requests

A typical wireless request spans multiple entities (a multi-part request). For example, an Async request may originate at the Messaging Server, forwarded to the Async Listener, which invokes a Runtime service and then returns the result back to the user through the Messaging Server. The Billing Rules may demand a billing at each stage of the transaction, but the pricing may vary depending on the context of the request. To support such a scenario, it is necessary to maintain the history of the request's path (available resources to the Billing Driver [or Data Collector]), where the Billing Rules are enforced.

16.4.4.1 Creating and Assigning Billing Transactions

The Billing Driver (or Data Collector) can assign a given Service Detail Record to be part of a transaction. For example, the pre-service call implementation of the Billing Driver can contain the following lines to add the SDR to a newly created transaction.

           BillingTransaction Trans = 
BillingTransactionManager.getInstance().createTransaction();
          Trans.getId(); // if its XYZ say       
           sdr.setTransaction(Trans);

This creates a new transaction and adds the Service Detail Record to it. The subsequent service detail records can be added to the same transaction by retaining the transaction ID. Here is the pseudo-code for subsequent Service Detail Records:

            BillingTransaction Trans = 
BillingTransactionManager.getInstance().lookupTransaction (XYZ);
          Trans.getId(); // if its XYZ say       
          Trans.addSdr(sdr); // OR sdr.setTransaction(Trans);

The past Service Detail Records for this transaction can be looked-up using the BillingTransaction public APIs (see BillingTransaction's getServiceDetailRecords()).

16.4.4.2 Logging Rules for Service Detail Records

A Service Detail Record, which is part of a transaction, is implicitly logged to the database as soon as the call BillingResult is returned from the BillingDriver implementation. The BillingController inspects the Service Detail Record and does this automatically.

The SDR's part of this transaction is available for lookup (see BillingTransaction's getServiceDetailRecords()). If the SDR is not part of a transaction, then its logging is deferred to the logging framework, to be accomplished in the background.

16.4.4.3 Maintaining Transaction State in a Single-Thread Multi-part Request

If all subsequent requests of a multi-part request are done in the context of the same Java Thread, the transaction information can be stored in the Thread as a Thread Local object and referenced later for a subsequent request. The Default implementation of the BillingDataCollector (oracle.wirless.billing.BillingDataCollectorImpl) provides just that. The transaction APIs for setting and getting are available through the BillingController object.

  /**
   * Returns the current billing transaction
   * @return BillingTransaction the current billing transaction
   */
public BillingTransaction getCurrentTransaction();

/** Sets the transaction for the current transaction
 * @param transaction the current transaction
 */
public void setCurrentTransaction(BillingTransaction transaction);

16.5 Billing Driver

To integrate OracleAS Wireless billing integration with an external billing system, the system integrator must provide a Java implementation class which implements the BillingDriver interface. To set your driver:

EM > Wireless Server: Site Administration > Billing Framework > Billing Driver Provider (Driver Class Name)

The desired behavior of the Billing Driver implementation is as follows:

16.6 Billing Integration Scenario

16.6.1 Handling Prebilling

Here is an implementation example of handling prebilling:

16.6.2 Handling Postbilling

Here is an implementation example of handling postbilling:


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