SAP CC REST UDRs

The SAP CC REST UDR types are designed to formalize the exchange between workflows and the SAP Convergent Charging Core Server. The SAP CC REST agent translates the received charging or loading request UDRs into its corresponding SAP Convergent Charging API request and the response from the server is translated into the appropriate UDRs stored in the same request UDR provided, which becomes available in the workflow for subsequent processing.

The UDRs were generated from the API specification provided by SAP for both the Charging and Loading services, and the released API version. The REST API version configured on the SAP CC REST agent must be aligned with the REST API version used by the SAP CC server for Charging and Loading services to be sent and received.

Prerequisites

The reader of this information should be familiar with:

Overview

There are two primary request UDRs, the usage being dependent on which REST API service is configured on the agent:

  • SAPCCChargingRequest UDR. The main UDR expected by the SAP CC REST agent when the Charging Service REST API is selected and can be returned to the agent with a response attached.

  • SAPCCLoadingRequest UDR. The main UDR expected by the SAP CC REST agent when the Loading Service REST API is selected and can be returned to the agent with a response attached.

Supported Services

Within each services provided by SAP Convergent Charging, there are a number of possible APIs to be called. The following table details the currently supported services and APIs, along with the expected UDR to be passed into the primary request UDRs for each.

SAP Service

SAP Service APIs

Request UDR

Response UDR

SAP Service

SAP Service APIs

Request UDR

Response UDR

Charging Service

Event Based Rating

  • /chargeableItemProcess

ChargingRequest

ChargingResponse, OnErrorResponse

Session Based Rating (Create session)

  • /chargingSessions

ChargingSessionCreateRequest

ChargingSessionCreateResponse, OnErrorResponse

Session Based Rating (Update or Stop session)

  • /chargingSessions/{sessionId}

ChargingSessionUpdateRequest, ChargingSessionStopRequest

ChargingSessionUpdateResponse, OnErrorResponse

Loading Service

Usage Event Loading

  • /chargeableItemsLoad

List of ChargeableItem

List of LoadingResponse, OnErrorResponse

The request UDR needs to be passed into either SAPCCChargingRequest or SAPCCLoadingRequest’s request parameter, as shown below, using the above Event Based Rating API as an example.

SAPCCChargingRequest requestUdr = udrCreate(SAPCCChargingRequest); ChargingRequest udr = udrCreate(ChargingRequest); ...... requestUdr.request = udr;

Response Handling

Responses from SAP Convergent Charging are returned under the original request UDR, in the request.response.body parameter. The output will first have to be casted to the correct UDR, then cast the body into the respective UDRs described above, for further processing. An example using the above Event Based Rating API as below.

if(instanceOf(input, SAPCCChargingRequest)){ SAPCCChargingRequest resp = (SAPCCChargingRequest) input; if(instanceOf(resp.response.body, ChargingResponse)){ // Logic if response body is ChargingResponse } else{ // Logic if response body is not ChargingResponse } } else if(instanceOf(input, erroUDR)){ // Logic if there are errors when sending request }

Error Handling

The response HTTP status code can be accessed using input.response.statusCode.

For HTTP status code 200, the error will be present in the API’s respective response UDR, as response.error. An example using the Event Based Rating API as below.

SAPCCChargingRequest resp = (SAPCCChargingRequest) input; if(instanceOf(resp.response.body, ChargingResponse)){ ChargingResponse response = (ChargingResponse) resp.response.body; if(response.error != null){ // Logic to handle API error } }

The response UDR OnErrorResponse from SAP Convergent Charging will be returned in the event of a HTTP status code of 400, 401, 403 or 500.

The output UDR errorUDR will only be routed if the Route Error UDR option is enabled in the agent configuration.

 

The UDRs for the use of SAP CC REST agent are generated from the API specifications provided by SAP. For more information on structure of the API requests and responses, you may refer to the following.

The list of available SAP CC REST UDRs can be viewed in the UDR Internal Format Browser in the sapcc_rest folder. To open the browser, open an APL Editor, and, in the editing area, right-click and select UDR Assistance.

SAPCCChargingRequest

The following fields are included in the SAPCCChargingRequest UDR:

Field

Description

Field

Description

request (DRUDR)

The following UDRs can be included in this field:

  • ChargingRequest

  • ChargingSessionCreateRequest

  • ChargingSessionStopRequest

  • ChargingSessionUpdateRequest

requestUri (string)

The request URI included in the response from SAP Convergent Charging.

response (Response (http))

This field is populated by the contents of SAP CC REST UDRs | Response.

sessionId (string)

The sessionId identifier when sending a request to Session Based Rating (Update or Stop session).

SAPCCLoadingRequest

Field

Description

Field

Description

request (list<DRUDR>)

The following Loading request item can be included in this field:

  • List of ChargeableItem

requestUri (string)

Set the URI path to be used for the request.

response (Response (http))

This field is populated by the contents of SAP CC REST UDRs | Response.

errorUDR

Field

Description

Field

Description

errorMessage

Description of the error.

originalUDR

The input UDR received by the agent.

Cookie

The Cookie UDR is used for including cookie information in SAP CC REST UDRs | Response.
 The following fields are included in the Cookie UDR:

Field

Description

Field

Description

domain (string)

The domain to which the cookie belongs.

expires (string)

The date and time when the cookie expires.

httponly (boolean)

If set to true, cookies will not be exposed through channels other than HTTP and HTTPS requests.

name (string)

The name of the cookie.

path (string)

The path to the page the cookie belongs to, for example "http://mydomain.com/mypage.html ".

secure (boolean)

Indicates whether the data is sent in secure mode or not.

value (string)

The value of the cookie.

Response

The Response  UDR contains the response to the request and is incorporated in the SAP CC REST UDRs | SAPCCChargingRequest and SAP CC REST UDRs | SAPCCLoadingRequest.

The following fields are included in the Response UDR:

Field

Description

Field

Description

body (any)

This field contains the message body, that is, the payload, of the response. Responses are present as follows:

For Charging Service Requests:

  • ChargingResponse

  • ChargingSessionCreateResponse

  • ChargingSessionUpdateResponse

  • OnErrorResponse

For Loading Service Requests:

  • LoadingResponse

  • OnErrorResponse

cookies (list<CookieUDR>)

This field contains any SAP CC REST UDRs | Cookie UDRs included.

headers (map<string,list<string>>)

This field is populated by all the headers present in the response. The map keys contain header field names and the content is stored in the corresponding map values.

httpVersion (string)

This field contains the HTTP version; HTTP/1 or HTTP/2.

mimetype (string)

The type of the content, for example "text/html", "image/gif", etc.

openAPIUDR (DRUDR)

Used for custom OpenAPI specification validation, which is currently unavailable.

statusCode (int)

The HTTP status code, for example: 200 - OK, 404 - Not Found, etc.

validationErrors (string)

Used for custom OpenAPI specification validation, which is currently unavailable.



Â