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:
- The value of cmd is wf for WF-DCN requests, compared to dcn for regular DCN.
- The message contains the fields required for notification, such
as the to address, from address, e-mail subject, and e-mail body.
- The WF-DCN message is captured and parsed by the
server-initiated Hybrid App, which
processes the WF-DCN message differently, depending on the message type: with
payload or without payload.
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
- Operation name(op) :upsert or :delete– same
as regular DCN.
- Message ID (id) of the Hybrid App –
used for correlation (a :delete for a
previously submitted request with :upsert
is possible)
- 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.
- Subject (subject) – subject of the
Hybrid App message.
- Originator <from> – who the
Hybrid App message is from.
- Body of the Hybrid App message
<body> – it can embed customized information.
- <received> – received time of the
Hybrid App message.
- <read> – whether the Hybrid App
message is read.
- <priority> – whether the
Hybrid App message has a high priority.
- 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:
- SAP Mobile Server invokes preProcessFilter if the DCN filter is
specified.
- SAP Mobile Server receives a raw HTTP POST body to generate and
return a WF- DCN request message object.
- The JSON format string is parsed into a WF-DCN request object.
- 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.
- 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.
- 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.
- SAP Mobile Server invokes the postProcessFilter, if
specified.
- 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.