public class StatelessServiceClient extends AsyncRatingServiceClient
Java class allows your client application to send some stateless rating and prerating events
to the connected SAP CC Core Server system by using the
Message TCP high-speed technical interface.
Consider the following information in this topic:
The following business operations or services are now deprecated and replaced. SAP SE recommends that you do not implement these operations anymore. They will be revoked in newer versions of SAP Convergent Charging.
| Business Services | Deprecated Operations | Technical Names (Consider the methods in this Java class) | Replaced by |
|---|---|---|---|
| Non authenticated server connection | All class builders (except the empty one) that connect the client to the server without user credentials. | Replaced by the StatelessServiceClient() + a call to AsyncRatingServiceClient.setUserCredentials(String, String) then a call to one of the following methods to connect the client:
|
This rating and charging client benefits from
the functions provided by the Message TCP technical interface.
Refer to its features about:
When a timeout is associated to a given message client, it must be performed during this limited time.
If this limited time is exceeded, the operation is rolled back but client timeout does not guarantee that related
operations successfully ended (see Technical Reference Guide).
By default, this charging client provides high throughput performances
and very low latency responses.
For very high troughput performances, consider the fine-tuning activity.
By default, this charging client provides high availability services with an SAP CC system with distributed instances in HA setup.
To implement a ciphered connection between the client and SAP CC, use AsyncRatingServiceClient.setSslContext(javax.net.ssl.SSLContext )
Since SAP CC 4.1 SP2, SAP CC is able to require an authenticated connection from a client application (see the MESSAGE_API_AUTHENTICATION_REQUIRED parameter in the parameter reference guide).
The client must setup 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 stateless service client by (always) calling the empty builder (other builders are deprecated)
StatelessServiceClient client = new StatelessServiceClient();
// Set the user credentials for the new created client
// These credentials must refer to an existing service user in SAP CC having the "messageChargingClient" role.
client.setUserCredentials("clientX", "foopasswd");
//Call one of the connect() methods that are provided in the 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
Your charging client (based on this StatefulServiceClient class)
must be initialized via establishing a connection to one of more dispatcher instances available in the distant SAP CC system.
Once at least one dispatcher of the SAP CC system is connected from the client application,
the client application retrieves automatically the list of all available dispatcher instances
on the server system side. It establishes a connection with every one of them automatically.
Depending on your business requirements, you implement one of the following operations in your Java-based client application:
Consult all the online and offline charging services that you can implement in your Java-based client application and in your system landscape.
Consult the SAP CC Application Help for more information about the online charging services, the charging process and its execution modes (stateless, stateful).
| Modifier and Type | Field and Description |
|---|---|
static int |
POST_RATE_CANCELLATION |
static int |
POST_RATE_CONFIRMATION |
ALL_TRANSACTION, ALL_TRANSACTION_AND_RECURRING, CANCELLED, CONFIRMED, MASTER_TRANSACTION, NONE_TRANSACTION| Constructor and Description |
|---|
StatelessServiceClient()
Creates a non-initialized stateless service client in your client application.
|
StatelessServiceClient(java.lang.String hostName,
int port)
Deprecated.
Deprecated since version 4.1 SP2 of SAP CC and replaced by the empty builder and an authenticated connection.
Creates a stateless service client and connect it to a server.
|
StatelessServiceClient(java.lang.String hostName,
int port,
FoundLostRatingListener ratingListener)
Deprecated.
Deprecated since version 4.1 SP2 of SAP CC and replaced by the empty builder and an authenticated connection.
Creates a stateless service client and connect it to a server.
|
StatelessServiceClient(java.lang.String hostName,
int port,
FoundLostRatingListener ratingListener,
int timeout)
Deprecated.
Deprecated since version 4.1 SP2 of SAP CC and replaced by the empty builder and an authenticated connection.
Creates a stateless service client and connect it to a server.
|
StatelessServiceClient(java.lang.String hostName,
int port,
int timeout)
Deprecated.
Deprecated since version 4.1 SP2 of SAP CC and replaced by the empty builder and an authenticated connection.
Creates a stateless service client and connect it to a server.
|
StatelessServiceClient(java.lang.String hostName,
int port,
java.lang.String bindAddress,
FoundLostRatingListener ratingListener,
int timeout)
Deprecated.
Deprecated since version 4.1 SP2 of SAP CC and replaced by the empty builder and an authenticated connection.
Creates a stateless service client and connect it to a server.
|
| Modifier and Type | Method and Description |
|---|---|
void |
connect(InstanceMap imap,
java.lang.String bindAddress,
FoundLostRatingListener ratingListener,
int timeout,
ServiceClientTuning config)
|
void |
connect(java.lang.String hostName,
int port,
java.lang.String bindAddress,
FoundLostRatingListener ratingListener,
int timeout)
Connect this stateless service client using the round robin with the server.
|
void |
connect(java.lang.String hostName,
int port,
java.lang.String bindAddress,
FoundLostRatingListener ratingListener,
int timeout,
ServiceClientTuning config)
Connect this stateless service client using the round robin with the server.
|
StatelessPostRateResult |
statelessPostRate(long reservationUID,
StatelessPreRatingContext preRatingContext,
int resolution,
boolean withDetails,
ChargeableItem newCi)
This method is dedicated to the stateless post-rating.
|
StatelessPostRateResult |
statelessPostRate(long reservationUID,
StatelessPreRatingContext preRatingContext,
int resolution,
java.lang.String[] retainedDetails,
ChargeableItem newCi)
Similar to
statelessPostRate(long, StatelessPreRatingContext, int, boolean, ChargeableItem),
but with finest selection of resulting transaction details. |
StatelessPreRateResult |
statelessPreRate(StatelessRatingEvent ratingEvent,
java.lang.String chargeCode,
StatelessPreRatingContext preRatingContext,
java.util.Date ratingDate,
long reservationUID,
long postrateDeadline,
boolean withDetails,
boolean checkDates)
This method is dedicated to the stateless pre-rating.
|
StatelessPreRateResult |
statelessPreRate(StatelessRatingEvent ratingEvent,
java.lang.String chargeCode,
StatelessPreRatingContext preRatingContext,
java.util.Date ratingDate,
long reservationUID,
long postrateDeadline,
java.lang.String[] retainedDetails,
boolean checkDates)
Similar to
statelessPreRate(StatelessRatingEvent, String, StatelessPreRatingContext, Date, long, long, boolean, boolean),
but with finest selection of resulting transaction details. |
StatelessRateResult |
statelessRate(java.lang.String chargeCode,
java.util.Date ratingDate,
StatelessRatingEvent event,
StatelessRatingContext context,
boolean withDetails,
boolean checkDates)
This main business operation requests the SAP CC system to
rate (dynamically determine the price)
|
StatelessRateResult |
statelessRate(java.lang.String chargeCode,
java.util.Date ratingDate,
StatelessRatingEvent event,
StatelessRatingContext context,
java.lang.String[] retainedDetails,
boolean checkDates)
Similar to
statelessRate(String, Date, StatelessRatingEvent, StatelessRatingContext, boolean, boolean),
but with finest selection of resulting transaction details. |
java.lang.Object[] |
translate(java.lang.String tableCode,
int operator,
java.util.Date date,
java.util.Date referenceDate,
java.lang.String[] inValues)
Translates some values by using a translation table.
|
java.lang.Object[] |
translate(java.lang.String tableCode,
int operator,
java.util.Date date,
java.lang.String[] inValues)
Translates some values by using an
instance of translation table. |
addAuthenticationListener, close, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, getBootMode, getClientOpEventListener, getConnectionStatus, getSslContext, getTimeout, isAtLeastOneConnectionIsRegistered, isConnected, isNoTimeout, setBootMode, setClientOpEventListener, setHAEventListener, setNoTimeout, setSslContext, setUserCredentialspublic static final int POST_RATE_CONFIRMATION
public static final int POST_RATE_CANCELLATION
public StatelessServiceClient()
throws java.io.IOException
One of the methods connect() must then be used to connect it to the SAP CC system.
java.io.IOException - if an error occurred reading the currency resources.@Deprecated
public StatelessServiceClient(java.lang.String hostName,
int port)
throws java.io.IOException
hostName - The host name of the serverport - The port on which the server waits for requestjava.io.IOException - if the client cannot connect to the server (if server is not running, for instance)
or if an error occurred reading the currency resources.@Deprecated
public StatelessServiceClient(java.lang.String hostName,
int port,
int timeout)
throws java.io.IOException
hostName - the host name of the server.port - the port on which the server waits for request.timeout - the timeout in milliseconds for each request (or -1 to wait indefinitely).
If you use zero and acknowledgments are requested then a CommunicationFailureException will be thrown without sending request.java.io.IOException - if the client cannot connect to the server (if server is not running, for instance)
or if an error occurred reading the currency resources.@Deprecated
public StatelessServiceClient(java.lang.String hostName,
int port,
FoundLostRatingListener ratingListener)
throws java.io.IOException
hostName - the host name of the server.port - the port on which the server waits for request.ratingListener - the listener informed when rating is found or lost.java.io.IOException - if the client cannot connect to the server (if server is not running, for instance)
or if an error occurred reading the currency resources.@Deprecated
public StatelessServiceClient(java.lang.String hostName,
int port,
FoundLostRatingListener ratingListener,
int timeout)
throws java.io.IOException
hostName - the host name of the server.port - the port on which the server waits for request.ratingListener - the listener informed when rating is found or lost.timeout - the timeout in milliseconds for each request (or -1 to wait indefinitely).
If you use zero and acknowledgments are requested then a CommunicationFailureException will be thrown without sending request.java.io.IOException - if the client cannot connect to the server (if server is not running, for instance)
or if an error occurred reading the currency resources.@Deprecated
public StatelessServiceClient(java.lang.String hostName,
int port,
java.lang.String bindAddress,
FoundLostRatingListener ratingListener,
int timeout)
throws java.io.IOException
hostName - the host name of the server.port - the port on which the server waits for request.bindAddress - address to bind description.ratingListener - the listener informed when rating is found or lost.timeout - the timeout in milliseconds for each request (or -1 to wait indefinitely).
If you use zero and acknowledgments are requested then a CommunicationFailureException will be thrown without sending request.java.io.IOException - if the client cannot connect to the server (if server is not running, for instance)
or if an error occurred reading the currency resources.public void connect(java.lang.String hostName,
int port,
java.lang.String bindAddress,
FoundLostRatingListener ratingListener,
int timeout)
throws java.io.IOException
hostName - the host name of the server.port - the port on which the server waits for request.bindAddress - the address to bind description.ratingListener - the FoundLostRatingListener that will be notified
each time a Rating Instance will be found or lost.timeout - the timeout in milliseconds for each request (or -1 to wait indefinitely).
If you use zero and acknowledgments are requested then a CommunicationFailureException will be thrown without sending request.java.io.IOException - if the client cannot connect to the server (if server is not running, for instance).public void connect(java.lang.String hostName,
int port,
java.lang.String bindAddress,
FoundLostRatingListener ratingListener,
int timeout,
ServiceClientTuning config)
throws java.io.IOException
hostName - The host name of the serverport - The port on which the server waits for requestbindAddress - The address to bind descriptionratingListener - The FoundLostRatingListener that will be notified
each time a Rating Instance will be found or lost.timeout - The timeout in milliseconds for each request (or -1 to wait indefinitely).
If you use zero and acknowledgments are requested then a CommunicationFailureException will be thrown without sending request.config - A tuned configuration for this client, can be null.java.io.IOException - if the client cannot connect to the server (if server is not running, for instance).@Deprecated public void connect(InstanceMap imap, java.lang.String bindAddress, FoundLostRatingListener ratingListener, int timeout, ServiceClientTuning config) throws java.io.IOException
imap - The instance mapbindAddress - The address to bind descriptionratingListener - The FoundLostRatingListener that will be notified
each time a Rating Instance will be found or lost.timeout - The timeout in milliseconds for each request (or -1 to wait indefinitely).
If you use zero and acknowledgments are requested then a CommunicationFailureException will be thrown without sending request.config - A tuned configuration for this client, can be null.java.io.IOException - if the client cannot connect to the server (if server is not running, for instance).public StatelessRateResult statelessRate(java.lang.String chargeCode, java.util.Date ratingDate, StatelessRatingEvent event, StatelessRatingContext context, boolean withDetails, boolean checkDates) throws StatelessRateException, InvalidItemException, ForbiddenChargeException, CommunicationFailureException, ServerFailureException
StatelessRatingContext
which is embeded into a StatelessPreRatingContext.
See StatelessPreRatingContext documentation.
chargeCode - The identification code of the master charge configured in SAP CC;
This charge includes a particular price plan dedicated to the stateless rating services.ratingDate - The date of the ratingevent - The event to rate or take into accountcontext - The context of the ratingwithDetails - With all or main details in the returned resultscheckDates - Check date chronologyStatelessRateException - if the rate stateless failsInvalidItemException - if the item is invalidForbiddenChargeException - if the process is forbidden (no access in the price plan of the specified charge, agreement is not valid any longer, the price plan forbids rating or when arguments are not correct)CommunicationFailureException - if all the rater instances are unavailable in the connected SAP CC system.ServerFailureException - if a failure occurred on SAP CC Core Server system sidepublic StatelessRateResult statelessRate(java.lang.String chargeCode, java.util.Date ratingDate, StatelessRatingEvent event, StatelessRatingContext context, java.lang.String[] retainedDetails, boolean checkDates) throws StatelessRateException, InvalidItemException, ForbiddenChargeException, CommunicationFailureException, ServerFailureException
statelessRate(String, Date, StatelessRatingEvent, StatelessRatingContext, boolean, boolean),
but with finest selection of resulting transaction details.
Indeed, the retainedDetails parameter enables to list the
transaction details to retain in the resulting transaction(s).
When retainedDetails is null, this is
equivalent to
statelessRate(chargeCode, ratingDate, event, context, false, checkDates).
Main details that are present in this case are always present, whatever
the content of retainedDetails is.
chargeCode - The code of the chargeratingDate - The date of the ratingevent - The event to ratecontext - The context of the ratingretainedDetails - The list of names of transaction details to retain in resulting transaction(s).checkDates - Check date chronologyStatelessRateException - when the rate stateless fails.InvalidItemException - when the item is invalid.ForbiddenChargeException - when the charge process is forbidden (no access, agreement is not valid any longer, the price plan forbids charging or when arguments are not correct).CommunicationFailureException - if all the raters are unavailable.ServerFailureException - if a failure occurred on server side.statelessRate(String, Date, StatelessRatingEvent, StatelessRatingContext, boolean, boolean)public java.lang.Object[] translate(java.lang.String tableCode,
int operator,
java.util.Date date,
java.lang.String[] inValues)
throws DoesNotExistException,
CommunicationFailureException,
ServerFailureException
instance of translation table.tableCode - The code of the translation table which must be usedoperator - The comparison operatordate - The version date of the translation tableinValues - An array of String which represents the input valuesObjectDoesNotExistException - thrown if the translation table does
not existCommunicationFailureException - if all the raters are unavailableServerFailureException - if a failure occurred on server sideTranslateValueOppublic java.lang.Object[] translate(java.lang.String tableCode,
int operator,
java.util.Date date,
java.util.Date referenceDate,
java.lang.String[] inValues)
throws DoesNotExistException,
CommunicationFailureException,
ServerFailureException
tableCode - The code of the translation table which must be usedoperator - The comparison operatordate - The version date of the translation tablereferenceDate - The reference date used to check column "start date" and column "end date"inValues - An array of String which represents the input valuesObjectDoesNotExistException - thrown if the translation table does not existCommunicationFailureException - if all the raters are unavailableServerFailureException - if a failure occurred on server sideTranslateValueOppublic StatelessPreRateResult statelessPreRate(StatelessRatingEvent ratingEvent, java.lang.String chargeCode, StatelessPreRatingContext preRatingContext, java.util.Date ratingDate, long reservationUID, long postrateDeadline, boolean withDetails, boolean checkDates) throws StatelessPreRatingException, StatelessRateException, InvalidItemException, ForbiddenChargeException, CommunicationFailureException, ServerFailureException
After a call to this method, the passed StatelessPreRatingContext
is not modified. It must be updated (if needed) explicitly calling
the StatelessPreRateResult.update(StatelessPreRatingContext)
method of the result.
The underlying rating is done using the StatelessRatingContext
associated with the charge code in the
given StatelessPreRatingContext.
If no such StatelessRatingContext exists, it's created
(it will be then really added in the StatelessPreRatingContext
by the further call to
StatelessPreRateResult.update(StatelessPreRatingContext)).
See also StatelessPreRatingContext documentation for limitation
and constraints to follow.
ratingEvent - the event to rate.chargeCode - the code of the charge.preRatingContext - the context of the stateless pre-rating.ratingDate - a date based on which the chargeable item is rated.reservationUID - the unique identifier of the reservation.postrateDeadline - the delay after which the availability of pending
prerating is no longer guarantied in case of post-rate call using
the related reservationUID. A value <= 0 means the pre-rating is
'auto-confirmed' and not available for post-rate.withDetails - with all or main details in results.checkDates - check date chronology.StatelessPreRatingException - when the pre rate stateless fails.StatelessRateException - when the rate stateless fails.InvalidItemException - when the item is invalid.ForbiddenChargeException - when the charge process is forbidden (no access, agreement is not valid any longer, the price plan forbids charging or when arguments are not correct).CommunicationFailureException - if all the raters are unavailable.ServerFailureException - if a failure occurred on server side.public StatelessPreRateResult statelessPreRate(StatelessRatingEvent ratingEvent, java.lang.String chargeCode, StatelessPreRatingContext preRatingContext, java.util.Date ratingDate, long reservationUID, long postrateDeadline, java.lang.String[] retainedDetails, boolean checkDates) throws StatelessPreRatingException, StatelessRateException, InvalidItemException, ForbiddenChargeException, CommunicationFailureException, ServerFailureException
statelessPreRate(StatelessRatingEvent, String, StatelessPreRatingContext, Date, long, long, boolean, boolean),
but with finest selection of resulting transaction details.
Indeed, the retainedDetails parameter enables to list the
transaction details to retain in the resulting transaction(s).
When retainedDetails is null, this is
equivalent to
statelessRate(chargeCode, ratingDate, event, context, false, checkDates).
Main details that are present in this case are always present, whatever
the content of retainedDetails is.
ratingEvent - the event to rate.chargeCode - the code of the charge.preRatingContext - the context of the stateless pre-rating.ratingDate - a date based on which the chargeable item is rated.reservationUID - the unique identifier of the reservation.postrateDeadline - the delay after which the availability of pending
pre-rating is no longer guarantied in case of post-rate call using
the related reservationUID. A value <= 0 means the pre-rating is
'auto-confirmed' and not available for post-rate.retainedDetails - list of names of transaction details to retain in
resulting transaction(s).checkDates - check date chronology.StatelessPreRatingException - when the pre rate stateless fails.StatelessRateException - when the rate stateless fails.InvalidItemException - when the item is invalid.ForbiddenChargeException - when the charge process is forbidden (no access, agreement is not valid any longer, the price plan forbids charging or when arguments are not correct).CommunicationFailureException - if all the raters are unavailable.ServerFailureException - if a failure occurred on server side.statelessPreRate(StatelessRatingEvent, String, StatelessPreRatingContext, Date, long, long, boolean, boolean)public StatelessPostRateResult statelessPostRate(long reservationUID, StatelessPreRatingContext preRatingContext, int resolution, boolean withDetails, ChargeableItem newCi) throws StatelessPreRatingException, StatelessRateException, InvalidItemException, ForbiddenChargeException, CommunicationFailureException, ServerFailureException
After a call to this method, the passed StatelessPreRatingContext
is not modified. It must be updated (if needed) explicitly calling
the StatelessPostRateResult.update(StatelessPreRatingContext)
method of the result.
reservationUID - the unique identifier of the reservation.preRatingContext - the context of the stateless pre-rating.resolution - the resolution (one of POST_RATE_CONFIRMATION
or POST_RATE_CONFIRMATION).withDetails - with all or main details in results.newCi - the new chargeable item, in case of confirmation with new CI.StatelessPreRatingException - when the pre rate stateless fails.StatelessRateException - when the rate stateless fails.InvalidItemException - when the item is invalid.ForbiddenChargeException - when the charge process is forbidden (no access, agreement is not valid any longer, the price plan forbids charging or when arguments are not correct).CommunicationFailureException - if all the raters are unavailable.ServerFailureException - if a failure occurred on server side.public StatelessPostRateResult statelessPostRate(long reservationUID, StatelessPreRatingContext preRatingContext, int resolution, java.lang.String[] retainedDetails, ChargeableItem newCi) throws StatelessPreRatingException, StatelessRateException, InvalidItemException, ForbiddenChargeException, CommunicationFailureException, ServerFailureException
statelessPostRate(long, StatelessPreRatingContext, int, boolean, ChargeableItem),
but with finest selection of resulting transaction details.
Indeed, the retainedDetails parameter enables to list the
transaction details to retain in the resulting transaction(s).
When retainedDetails is null, this is
equivalent to
statelessRate(chargeCode, ratingDate, event, context, false, checkDates).
Main details that are present in this case are always present, whatever
the content of retainedDetails is.
reservationUID - the unique identifier of the reservation.preRatingContext - the context of the stateless pre-rating.resolution - the resolution (one of POST_RATE_CONFIRMATION
or POST_RATE_CONFIRMATION).retainedDetails - list of names of transaction details to retain in
resulting transaction(s).newCi - the new chargeable item, in case of confirmation with new CI.StatelessPreRatingException - when the pre rate stateless fails.StatelessRateException - when the rate stateless fails.InvalidItemException - when the item is invalid.ForbiddenChargeException - when the charge process is forbidden (no access, agreement is not valid any longer, the price plan forbids charging or when arguments are not correct).CommunicationFailureException - if all the raters are unavailable.ServerFailureException - if a failure occurred on server side.statelessPostRate(long, StatelessPreRatingContext, int, boolean, ChargeableItem)