Class BatchServiceClient

All Implemented Interfaces:
com.highdeal.barbus.ISSLContextProvider

public class BatchServiceClient extends AsyncBatchServiceClient
This main Java class provides the necessary operations to implement Offline Charging Services (OFCS) in your SAP system landscape to send chargeable items to the connected SAP CC Core Server system to charge the past usage (consumption) of a marketable service by end customers; This class enables synchronous communications via the Message TCP high-speed technical interface.

Recommendation

You can implement the AsyncBatchServiceClient class to speed up the processing.

Consider the following information in this topic:

Example

For test, demo, or training purposes, a program (SAP CC Message Client) is provided with the SAP CC Core Tool software unit: It allows you to send some charging operation requests to the SAP CC system. The SAP CC Message Client user interface implements some methods of this Java class.

Synchronous Services and Operations

  • Offline acquisition step of the Deferred charging service - see acquire(java.util.List)
  • Offline charging service (batch mode or single chargeable item)
  • Quote service (blank charging)
  • Recharging step for the Rerating end-to-end service (based on subscriptions or on provider contracts)

With this Java class, you can implement offline charging services via the Message TCP high-speed technical interface. Charging is based on acquired events.

Business Services:
Offline Charging Services
Operations Technical Names (Consider the methods in this Java class)
Chargeable item acquisition (for deferred charging managed in SAP CI) Batch acquisition operation acquire(..)
Batch charging Batch charging operation (*) batchCharge(..) to a contract or subscription already identified
Event-based charging without credit control Single charging operation charge(..)
Event-based advice of charge Blank charging operation blankCharge(..)
Offline recharging Peration For each subscription or provider contract to re-charge:

Recommendation

You can implement the rerating end-to-end service (based on provider contracts) by using another technical interface based on SOAP APIs: SAP CC provides Web Services that your client application can consume.

Note

Consult all the offline charging services that you can implement in your Java-based client application used as a mediation system. Refer to the AsyncBatchServiceClient class for asynchronous communications and very high throughput performances.

Features

This charging client benefits from the functions provided by the Message TCP technical interface. Refer to its features about:

  • High Availability Management
  • High Volume Management
  • High Performance Management

Operation Results

The connected SAP CC system replies to operation requests with the following data:

Charging Contract Operational Status

All services and operations take into account the operational status of a charging contract. This means that an operation exception can be thrown if the operational status of a charging contract is locked or closed.

Communication Timeout

You can define a client-side timeout associated to a charging client based on this BatchServiceClient class: The connected SAP CC system must process your operation request during this limited time.

If the limited time is exceeded, the operation is automatically rolled back:

  • An operation is sent to the SAP CC system in background to cancel the initial operation request.
  • An exception is thrown in the charging client of your client application.

This client-side timeout does not guarantee that related operations successfully ended (see SAP CC Application Help).

Security

To implement a ciphered connection between the client and SAP CC, use AsyncRatingServiceClient.setSslContext(javax.net.ssl.SSLContext).
Then, the client application will be authenticated and authorized to connect to the SAP CC server by calling the AsyncRatingServiceClient.connect(String hostname, int port, boolean secure, String bindAddress, int timeout, FoundLostRatingListener ratingListener, ServiceClientTuning config) method, with secure parameter set to true.

To implement user authentication between the client and SAP CC, the client must set up some valid user credentials by calling the setUserCredentials() method.
Then, the client application will be authenticated and authorized to connect to the SAP CC server by calling one of the following connect() methods:

Code Snippet

The following code snippet provides an example of how to authenticate a client application to the SAP CC server :

    private static final String DISPATCHER_HOST = "localhost";
    private static final int DISPATCHER_EXT_PORT = 2000;

    // Initialize the stateful service client by (always) calling the empty builder (other builders are deprecated)
    BatchServiceClient client = new BatchServiceClient();

    // Set the user credentials for the new created client
    // These credentials must refer to an existing service user in SAP CC that has the "messageChargingClient" role.
    client.setUserCredentials("clientX", "foopasswd");

    //Call one of the connect() methods that are provided in Service Client classes according to the
    //  expected behavior.
    ConnectionStatus status = client.connect(DISPATCHER_HOST, DISPATCHER_EXT_PORT);

    // Check the result of the  connect() method.
    if (!status.isServiceAvailable()) { // No dispatcher can be reached
    } // else at least one CC dispatcher has been reached and charging is available
 

Implementation in Your Client Application

Implementing Batch Acquisition Services

You can implement this business operation if both SAP Convergent Charging and SAP Convergent Invoicing (SAP CI) are available in your system landscape. The consumption item management function must be enable in SAP CI (in the SAP ERP/FI-CA system).

Use the method acquire(..) .

Implementing Batch Charging Services

Customizing Sequence
  • guiderLookup(..)
  • batchCharge(..)

Advanced Implementation

The following advanced implementation activities are possible. Refer to the implementation note section for more information.

Notes on SAP CC Implementation

Implementing Recharging for Rerating Services

To provide your system landscape with rerating services, you must implement the Recharging step of this process. This step follows the correction of the source(s) of the mistakes.

Recommendation

Before implementing these operations, refer to the SAP CC Application Help for more information about these processes.

Customizing Sequence

Develop the following sequence of operations to recharge the usage and to correct the related subsriptions or charging contracts:

  • Identify the subscriptions or the charging contracts to re-charge
  • Generate a reratingLockCode
  • Call the startSubscriptionRerating operation for each subscription or charging contract to lock it and restore the values of its counters
  • Send the corrected chargeable items to recharge for all subscriptions or charging contracts in chronological order (by calling the charge operation )
  • Call the stopSubscriptionRerating operation for each subscription or charging contract to unlock it

Additional Information

Consult all the online and offline charging services that you can implement in your Java-based client application.

Consult the SAP CC Application Help for more information about the Offline Charging Services (OFCS) and the charging process in batch mode.

Related Information

See Also:
  • Field Details

  • Constructor Details

    • BatchServiceClient

      public BatchServiceClient()
      Creates a non-initialized charging client for implementing the offline charging services in your Java-based client application; One of the {TEST #connect(java.lang.String, int) connect(..)} methods must then be used to connect this MessageClient to the distant SAP CC system.
  • Method Details