Show TOC

Subscription and Notification FlowLocate this document in the navigation structure

In addition to the normal OData Channel capabilities, SAP Gateway also offers subscription and notification flow functionality.

Subscription

Subscription is always done to a business object collection using a filter.

Example

A user may subscribe to all customers belonging to California and thus be notified as soon as a new California customer is created in the backend system or if there are any changes in any California customer.

The most important particular cases of the filter are:

  • Subscription to the whole collection (the filter is empty)

  • Subscription to a specific business object instance (the filter contains just an ID)

Subscription and Notification Formats

In order to enhance the usability of the Push and Pull Notifications in SAP Gateway, the users now have the option to receive Notifications in two formats:

  • ATOM XML

  • JSON

Note

Push - While subscribing for a push notification, the value of Accept HTTP header must be given as application/json in order to receive notifications in JSON format. Else, by default you receive notifications in ATOM XML format.

Pull - While subscribing for a pull notification, it does not matter what is passed in the Accept HTTP header. While pulling the notifications from the SAP Gateway system through the service, NOTIFICATIONSTORE, the value of Accept HTTP header should be the appropriate value in which the Notifications are desired.

Feed

A feed is simply a collection of notifications for an end-user. It is the result of user’s subscriptions to different collections. The notifications may be pushed automatically to the end-user or pulled.

Example

Example of a feed on a mobile device:

  • A Travel Request of $1500 was received

  • Sales Order 123 was updated

  • The address of Customer 456 has changed

  • A new track inspection was assigned to your work center

Subscription Process Flow
  1. To subscribe, a consumer sends a subscription request to SAP Gateway specifying a user and subscription content (collection, filter, delivery method, and so on.

  2. SAP Gateway has to validate the request and to forward it further to backend.

  3. If the subscription is accepted by the backend then it is saved by SAP Gateway in the subscription persistence layer and an acknowledgment is sent to the consumer. The process flow to unsubscribe is similar.

Notification Process Flow
  1. The backend tracks the changes in business objects and sends a change notification to SAP Gateway as soon as any change/create/update happens in the business object collection subscribed to.

  2. SAP Gateway receives the notification, and forwards it to a consumer using the appropriate format and delivery method. If the consumer is a connectivity server it has its own logic to deliver the notification to end-devices.

Subscription Requests

Create Subscription

The delivery address must have one of the following formats:

  • urn:sap-com:channel :<RFC destination>:<request URI>

  • http://... or https://...

Delete Subscription

Note that a subscription ID must exist for your user.

Example:

DELETE: http://<server name>:<port number>/sap/opu/sdata/iwcnt/SalesOrderLookUp.svc/SubscriptionCollection
(value='005056B40E791DEFB0AD9237BD0657E1',scheme_id='IWF_SUBSCRIPTION',scheme_agency_id='abc_004')
Request Header:
Name = X-Requested-With, value = XMLHttpRequest
 

Get List of Subscriptions

Note that the list contains subscriptions for the current user only.

GET: http://<server name>:<port number>/sap/opu/sdata/iwcnt/SalesOrderLookUp.svc/SubscriptionCollection
Request Header:
Name = X-Requested-With, value = XMLHttpRequest
End of the source code.

 

Get Subscription Details

Note that a subscription ID must exist for your user.

GET: http://<server name>:<port number>/sap/opu/sdata/iwcnt/SalesOrderLookUp.svc/SubscriptionCollection
(value='005056B40E791DEFB0AD9237BD0657E1',scheme_id='IWF_SUBSCRIPTION',scheme_agency_id='abc_004')
Request Header:
Name = X-Requested-With, value = XMLHttpRequest