Oracle Application Server Wireless Developer's Guide 10g (9.0.4) Part Number B10948-01 |
|
Each section of this document presents a different topic. These sections include:
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"
OracleAS Wireless Billing Integration Framework provides an extensible and flexible framework to model billable services, capture billable actions, and integrate with any billing engine.
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:
oracle.panama.rt.ServiceContext
oracle.panama.model.UserDownloadStatus
oracle.panama.mobilealert.ServiceAlertSubscription
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:
preService
API is called by the billing framework. For example: In a typical scenario in which usage authorization is based on user balance and credit, resource reservation, rating and fraud detection, the driver can instruct the billing framework to veto the user billable action request.
OracleAS Wireless defines the following billable actions:
preService
API right before the download request is generated by the provisioning server. If the result code of the API call indicates failure, the request is rejected.
postService
API after provisioning server has received notification from the installed device indicating successful installation and before any listener notification.
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:
BillingCollectorImpl
or defining your own implementation of the Billing Collector. Billing Collector's implementation is presented in greater detail in the next section.
The Billing Collector class can be extended (subclassed) from the out-of-the-box collector implementation or created new. Once it is created, the implementation class is set in: EM > Wireless Server: Site Administration > Billing Framework > Billing Collector Class name.
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 }
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.
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).
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:
oracle.panama.rt.ServiceContext
INVOKER
attribute value is ASYNC. The value denotes the Incoming message ID for the Async application. It can use used to relate the message request with the Async action.
oracle.panama.model.UserDownloadStatusAPPLICATION_NAME
oracle.panama.mobilealert.ServiceAlertSubscription
oracle.panama.messaging.transport.impl.SendingBillingContext
oracle.panama.messaging.transport.impl.ReceivingBillingContext
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.
OracleAS Wireless billing integration framework enables users to extend the default billing collector implementation for various reasons:
public class MyBillingCollector extends oracle.wireless.billing.BillingDataCollectorImpl { ... public ServiceDetailRecord createServiceDetailRecord(BillingContext context) { ServiceDetailRecord sdr = null; if (context instanceof oracle.panama.rt.ServiceContext ){ sdr = super.createServiceDetailRecord(context); if ( sdr != null){ // Add your additional data capture logic here // For example: // oracle.panama.rt.ServiceContext serviceContext = (oracle.panama.rt.ServiceContext)context; // sdr.setExtendedData("SERVICE_PATHURL", context.getService().getURLPathParameter()); } } else{ sdr = super.createServiceDetailRecord(context); } return sdr; } ... }
public class MyBillingCollector extends oracle.wireless.billing.BillingDataCollectorImpl { ... public ServiceDetailRecord createServiceDetailRecord(BillingContext context) { ServiceDetailRecord sdr = null; if (context instanceof MyBillingContext ){ // MyBillingContext mycontext = (MyBillingContext)context; // get the user name from your context // Java.sql.Timestamp accessTime = null; // BillingManager manager = BillingManager.getInstance(); //sdr = manager.createServiceDetailRecord(<User Name>, <Your service Name>, accessTime, <your billing component name>); // sdr.setExtendedData("MY_DATA", <Get data from your context object>); ... } } else{ sdr = super.createServiceDetailRecord(context); } return sdr; } ... }
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
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.
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()
).
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.
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);
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:
Note: In this release, integration with only one billing system at a time is supported. However, the driver implementor can use a proxy which interfaces with different billing systems as needed. |
Here is an implementation example of handling prebilling:
preService
call to do billing authorization and/or resource reservation, return an authorization ID generated by the billing system.
postService
call to complete the billing transaction by passing the authorization obtained from the preService
call.
Here is an implementation example of handling postbilling:
|
![]() Copyright © 2003 Oracle Corporation. All Rights Reserved. |
|