Extending Data Change Notification to Hybrid Apps

Data change notification (WF-DCN) requests allow SAP Mobile Server to process the DCN request and send notification to the device of that data change.

Depending on the cache policy used by the affected MBO, once the application receives notification, it can retrieve data directly from the EIS or from the SAP Mobile Server cache, keeping the application synchronized. DCN messages targeted for MBOs used in applications (WF-DCN), uses similar syntax as general DCN, with these differences:

WF-DCN format

The WF-DCN request is a JSON string consisting of these fields: engine converts MBO data and WF-DCN messages into email, and pushes it to device's inbox
  1. Operation name(op) :upsert or :delete– same as regular DCN.
  2. Message ID (id) of the Hybrid App – used for correlation (a :delete for a previously submitted request with :upsert is possible)
  3. Username (to) – the SAP Mobile Platform user name. For the user to be recognized by WF-DCN, the device user should first have established communication using the activation mechanism in SAP Control Center.
    Note: The "To" field must match the SAP Mobile Platform user name—not the user name used to register the device.
  4. Subject (subject) – subject of the Hybrid App message.
  5. Originator <from> – who the Hybrid App message is from.
  6. Body of the Hybrid App message <body> – it can embed customized information.
  7. <received> – received time of the Hybrid App message.
  8. <read> – whether the Hybrid App message is read.
  9. <priority> – whether the Hybrid App message has a high priority.
  10. List of dcn request <data> – JSON format string.
Example DCN request in JSON format:
{
"op":":upsert",
"id":"WID123",
"to":"SUPAdmin", 
"subject":"Trip request approval required",
"from":"user321",
 "body":"This is a message just used to do a test",
"received":"2009-03-29T10:07:45+05:00",
"read":false,
"priority":true,
"data":
   [
     {"id": "1",
     <general dcn request>
      }
      …
     {"id": "4",
     < general dcn request>
      }
   ]
}

Hybrid App DCN request flow

WF-DCN with and without payload differ slightly, but the general flow is similar for each. When the WF- DCN request is received, SAP Mobile Server gets the wf cmd value from the request first, and:

  1. SAP Mobile Server invokes preProcessFilter if the DCN filter is specified.
  2. SAP Mobile Server receives a raw HTTP POST body to generate and return a WF- DCN request message object.
  3. The JSON format string is parsed into a WF-DCN request object.
  4. The DCN request in the Hybrid App message object is parsed and those within the scope of a single transaction per DCN request object in the array are executed. Results are recorded for a report after completing the WF-DCN request.
  5. From the CDB, the server looks up all users assigned to the indicated Hybrid App package in the “to” attribute of the Hybrid App message, then matches them with the receiver list.

    For every receiver, SAP Mobile Server generates multiple Hybrid App messages (all Hybrid App messages are created within one transaction), one per device identified (one user might have multiple devices), and then sends them to the JMS queues.

    The lookup of the logical id is performed by combining the username in the “to” list to the “securityProfile” specified in the HTTP POST REQUEST URL parameter list.

  6. If any errors occur in step four, step five does not execute. If any errors occur in step five, step five is not committed. If any errors occur in either of those steps, an HTTP 500 error is returned.
  7. SAP Mobile Server invokes the postProcessFilter, if specified.
  8. If no errors occur, SAP Mobile Server returns success to the caller HTTP 200 with the body of the JSON string (or any opaque data returned from the postProcessFilter) of the WF-DCN Result. Otherwise, SAP Mobile Server returns an HTTP 500 error with the body of the JSON log records.