SMP 2.3 Enterprise Grade Mobility – Webinar Series
Prashanth Sutram / Global Mobility SWAT Team
Sep, 2013
Device Notifications
Troubleshooting the SAP Mobile Platform
Brought to you by the SAP Mobile Rapid Innovation Group (RIG)
© 2013 SAP AG. All rights reserved. 2 Public
SAP Mobile Platform: Enterprise Grade Mobility
SCN pages and webinars bring to you
technical details on Enterprise
Readiness aspects of the SAP Mobile
Platform (SMP).
• Webinars are done every week
Thursday until November. The
schedule is published on SCN.
http://scn.sap.com/docs/DOC-43425
• OnTopicPages presented links to
White Papers, How-To Guides, Blogs
and other resources.
http://scn.sap.com/docs/DOC-43424
© 2013 SAP AG. All rights reserved. 3 Public
Get More Mobile at SAP TechEd Events
Attend Education Breakout
Sessions to Learn about
the latest Mobile Solutions
from our Experts
Visit Product Experts at
the Mobile Tables
on the Technology
Showcase Floor
Participate in the InnoJam
Challenge to get Hands
On Experience with SAP
Mobile Solutions
Sign Up for the ASUG Pre-
Conference Seminar for
Mobile: Deep Dive into
SAP Mobile Platform
Register Today!
http://www.sapteched.com
Device Notifications
SMP Enterprise Grade Mobility – Webinar Series
© 2013 SAP AG. All rights reserved. 5 Public
Agenda
1. Enabling Data Change Notifications (DCN) for Applications
2. Enabling Push Notifications in Native Applications
3. Application Demo
4. Troubleshooting A Notification end-to-end
5. Q & A
© 2013 SAP AG. All rights reserved. 6 Public
Notification Architecture
EIS MMS CDB MSG Application DS
1. Data Updated
in EIS
APNS /GCM / BES
2. Generate DCN
Message
3. Post DCN
4. Modify Cache
5. Cache Merge
Return Status Return Status
6. Calculate
Subscribers 7. Send Notifications to Subscribers
8. Queue
Notifications
9a. Push Message to Online Clients
9b. Push Message to Online Clients
10. Synchronize on Notification CONTINIUE
© 2013 SAP AG. All rights reserved. 7 Public
Data Change Notification (DCN)
• DCN Messages are posted over http/https
• Messages can be batched up into hundreds of messages.
• Each posting is transactional i.e. either all messages are posted successfully or all fail.
• Messages are in JSON (JavaScript Object Notation) format
• Postings are authenticated and authorized based on security settings of package.
© 2013 SAP AG. All rights reserved. 8 Public
Data Change Notification (DCN)
http://unwired_server_host:unwired_server_port/dcn/DCNServlet?
cmd=dcn &username=userName &password=password
&domain=domainName &package=unwired_server_PackageName
&dcn_request={"pkg":"dummy",
"messages":[{"id":"1","mbo":"CustomerWithParam","op":":upsert“
,"cols":{"id":"10001","fname":"Adam"}}]}
© 2013 SAP AG. All rights reserved. 9 Public
Data Change Notification (DCN)
:upsert operation (Insert / Update)
• All MBO primary key attributes to be present in the payload.
• All other MBO attributes are also used in upsert, unspecified attributes are set to null.
• All columns in the operation use attribute names (not the column names to which they are mapped).
:delete operation
• The MBO primary key attribute be present in the payload.
• All columns in the operation use attribute names (not the column names to which they are mapped).
© 2013 SAP AG. All rights reserved. 10 Public
Enabling Push Synchronization Applications
• A messaging channel is used from the server to the client device
• By default Change detection is disabled.
• Applications have to enable this explicitly for each synchronization group
• Following code enables Subscription
Id<SUPSynchronizationGroup> syncGroup1 = [DemoCustNotificationsDB getSynchronizationGroup:@"CustomerSyncGroup"];
if ([syncGroup1 enableSIS] == NO)
{
NSLog (@"Enabling SIS for Misc Sync group");
[syncGroup1 setEnableSIS:YES];
[syncGroup1 setInterval:1];
[syncGroup1 save];
}
© 2013 SAP AG. All rights reserved. 11 Public
Enabling Push Synchronization Applications
• Check SCC for successful enablement of subscriptions.
© 2013 SAP AG. All rights reserved. 12 Public
Enabling Push Synchronization Applications
• On receiving push notifications the following code applies
- (SUPSynchronizationActionType)onSynchronize:(SUPObjectList*)syncGroupList withContext:(SUPSynchronizationContext*)context
{
switch (context.status)
{
case SUPSynchronizationStatus_STARTING_ON_NOTIFICATION:
if( [allowBackgroudSync])
{
return SUPSynchronizationAction_CONTINUE;
}
else
{
return SUPSynchronizationAction_CANCEL;
}
break;
default:
break;
}
return SUPSynchronizationAction_CONTINUE;
};
© 2013 SAP AG. All rights reserved. 13 Public
Demo – Application Setup - MBO
© 2013 SAP AG. All rights reserved. 14 Public
Demo – Application Setup – Customer MBO
• A Synchronization Parameter, STATE_SYNC_PARAM is configured and mapped to the state
attribute.
© 2013 SAP AG. All rights reserved. 15 Public
Demo – Application Setup – CustNotifications Package
• CustomerCacheGroup & ContactCacheGroup configured as
scheduled with a 24 hour refresh interval
• CustomerSyncGroup & ContactSyncGroup configured with a
detection interval of 10 mins (default).
© 2013 SAP AG. All rights reserved. 16 Public
Troubleshooting a notification - Generate DCN Message
Confirm DCN messages are valid.
Public websites are available to validate the JSON string like
http://jsonlint.com/
© 2013 SAP AG. All rights reserved. 17 Public
Troubleshooting a notification - Generate DCN Message
• Confirm DCN message is valid.
• Public websites are available to validate the JSON
string like http://jsonlint.com/
• Syntax error
© 2013 SAP AG. All rights reserved. 18 Public
Troubleshooting a notification - Post DCN Message
• Expected Result is http status code of 200.
• On success the following output is received:
o [{"recordID":"1","success":true,"statusMessage":""}]
Multiple records can be posted and output would appear as follows where for each record posted an entry is
available.
o [{"recordID":"1","success":true,"statusMessage":""},{"recordID":"2","success":true,"statusMessage":""}]
© 2013 SAP AG. All rights reserved. 19 Public
Troubleshooting a notification - Post DCN Message
• Possible Error Messages
– HTTP 400 - DCN Usage Errors
– HTTP 401 - Authentication Errors
– HTTP 403 - Authorization Errors
– HTTP 500 - Internal server error
• Check Error Messages in server.log for
– Security pool-3-thread-9 [com.sybase.security.ldap.LDAPLoginModule] [] [] [LDAP: error code 49 - Invalid
Credentials]
– javax.naming.AuthenticationException: [LDAP: error code 49 - Invalid Credentials]
© 2013 SAP AG. All rights reserved. 20 Public
Troubleshooting a notification - Modify Cache & Cache Merge
Confirm data has been applied to the CDB by executing a SQL
Server Log Entries
– DEBUG MMS pool-3-thread-8 - /dcn/HttpAuthDCNServlet?cmd=dcn&domain=default&package=custnotifications:1.0
[com.sybase.sup.server.dcn.DCNHandler] [] [] processing all DCN messages in a single transaction
– DEBUG DataServices pool-3-thread-8 -
/dcn/HttpAuthDCNServlet?cmd=dcn&domain=default&package=custnotifications:1.0
[com.sybase.vader.mms.DataServiceImpl] [] [] d1_custnotifications.1_0 (pool-3-thread-8 -
/dcn/HttpAuthDCNServlet?cmd=dcn&domain=default&package=custnotifications:1.0)
com.sybase.vader.mms.DataServiceImpl::modifyCache:814 - Executing Modify Cache on VirtualTable:
d1_custnotifications_1__08667 with parameters: [{id=101, zip=07070, lname=Devlin24, phone=2015558967, address=3114
Pioneer Avenue, company_name=The Power Group, state=NJ, fname=Michaels24, city=Rutherford}]
– DEBUG MMS MboChangeDetection [com.sybase.sup.server.sis.MboChangeDetection] [] [] going to sync changed
MBO detection with Cdb
– DEBUG MMS MboChangeDetection [com.sybase.sup.server.sis.MboChangeDetection] [] [] updating changed MBOs
[{"packageName":"d1_custnotifications.1_0","mboName":"Customer","changed":true}]
– DEBUG MMS MboChangeDetection [com.sybase.sup.server.sis.MboChangeDetection] [] [] going to sync changed
MBO detection with Cdb
© 2013 SAP AG. All rights reserved. 21 Public
Troubleshooting a notification - Calculate Subscribers
• A list of subscribed clients that need to be notified is created based on the individual
synchronization options. Example from Server.log
2013-09-04 14:14:12.686 DEBUG MMS ScheduledTask:d1_custnotifications.1_0_CustomerSyncGroup_Push [com.sybase.sup.server.sis.Notification] [] []
creating notification {"subscription":{"__subscriptionId":2,"__deviceId":"moca://SIMULATOR-PSUTRAM-
LDAP__CustNotifications","__username":"psutram@ldap","__appname":"sup","__enable":true,"__adminLock":false,"__interval":1,"__protocol":"TCN","__numSyn
cs":30,"__lastSynched":{"nanos":468000000},"__lastNotified":{"nanos":468000000},"__domain":"default","__package":"CustNotifications:1.0","__syncGroup":"Custome
rSyncGroup","__clientId":"9d358420-0d6a-122d-8000-
3c07545db42a","__deleted":false,"__lastModified":{"nanos":718000000},"_isNew":false,"_isDirty":false,"_isDeleted":false,"_restore":0,"_restored":false},"gateway":"TC
N","subject":"SY_SUP_SIS_NOTIFICATION","content":"notification_timestamp\u003d2013-09-04 14:14:12.686;app\u003dsup;device_id\u003dmoca://SIMULATOR-
PSUTRAM-LDAP__CustNotifications;package\u003dCustNotifications:1.0;publication\u003dCustomerSyncGroup;cid\u003d9d358420-0d6a-122d-8000-
3c07545db42a;user_name\u003dpsutram@ldap;domain\u003ddefault;pv\u003d3","address":"2","resendMinute":"0m","minuteToLive":"0m","subscriptionId":2,"delivery
Time":{"nanos":468000000}}
© 2013 SAP AG. All rights reserved. 22 Public
Troubleshooting a notification - Send Notifications to Subscribers
• MMS sends the change notifications, via a JMS Bridge, to Messaging (MSG) which will be
responsible to delivering them to the client applications DEBUG MMS Scheduler(2:1) [com.sybase.sup.server.sis.gateway.MOCAGateway] [] [] --------Notification(Content, address, device, id)--
-------
DEBUG MMS Scheduler(2:1) [com.sybase.sup.server.sis.gateway.MOCAGateway] [] [] notification_timestamp=2013-09-04
14:14:12.686;app=sup;device_id=moca://SIMULATOR-PSUTRAM-
LDAP__CustNotifications;package=CustNotifications:1.0;publication=CustomerSyncGroup;cid=9d358420-0d6a-122d-8000-
3c07545db42a;user_name=psutram@ldap;domain=default;pv=3
DEBUG MMS Scheduler(2:1) [com.sybase.sup.server.sis.gateway.MOCAGateway] [] [] 2
DEBUG MMS Scheduler(2:1) [com.sybase.sup.server.sis.gateway.MOCAGateway] [] []
DEBUG MMS Scheduler(2:1) [com.sybase.sup.server.sis.gateway.MOCAGateway] [] [] 12
DEBUG MMS Scheduler(2:1) [com.sybase.sup.server.sis.gateway.MOCAGateway] [] [] -------------------------------------------------------
-----
© 2013 SAP AG. All rights reserved. 23 Public
Troubleshooting a notification - Queue Notifications
• Messaging queues the notifications to be sent to the individual client applications.
• Notifications are queued by MSG and "Pending Count" for that application connection increases
and can be observed in the SAP Control Center under the Application Connections section
Notifications sent to Messaging systems.
• Advanced users with access to the CDB database (e.g. using a standalone DEV environment) can
confirm that a new entry has been added to the queue table (QUEUED_MESSAGES(DBA))
© 2013 SAP AG. All rights reserved. 24 Public
Troubleshooting a notification – Push Message to Client
• Scenario where the device is online (as viewed in SAP Control Center, Application Connections),
then the notification message is immediately delivered to the device.
• Scenario where device is offline in SCC and Native Push Notification Service is configured, i.e.
APNS / GCM / BES
o Server has the ability to make a connection to APNS / GCM / BES url.
o Ensure Application Connection has the device token available.
o Message is sent to Native Notification Service using the device token
o The native service notifies the client application
Q & A
Thank you
Contact information:
Prashanth Sutram
Principal Consultant, Global Mobility SWAT team
© 2013 SAP AG. All rights reserved.
© 2013 SAP AG. All rights reserved.
No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG. The information contained herein may be changed without prior notice.
Some software products marketed by SAP AG and its distributors contain proprietary software components of other software vendors.
Microsoft, Windows, Excel, Outlook, PowerPoint, Silverlight, and Visual Studio are registered trademarks of Microsoft Corporation.
IBM, DB2, DB2 Universal Database, System i, System i5, System p, System p5, System x, System z, System z10, z10, z/VM, z/OS, OS/390, zEnterprise, PowerVM, Power Architecture, Power Systems, POWER7, POWER6+, POWER6, POWER, PowerHA, pureScale, PowerPC, BladeCenter, System Storage, Storwize, XIV, GPFS, HACMP, RETAIN, DB2 Connect, RACF, Redbooks, OS/2, AIX, Intelligent Miner, WebSphere, Tivoli, Informix, and Smarter Planet are trademarks or registered trademarks of IBM Corporation.
Linux is the registered trademark of Linus Torvalds in the United States and other countries.
Adobe, the Adobe logo, Acrobat, PostScript, and Reader are trademarks or registered trademarks of Adobe Systems Incorporated in the United States and other countries.
Oracle and Java are registered trademarks of Oracle and its affiliates.
UNIX, X/Open, OSF/1, and Motif are registered trademarks of the Open Group.
Citrix, ICA, Program Neighborhood, MetaFrame, WinFrame, VideoFrame, and MultiWin are trademarks or registered trademarks of Citrix Systems Inc.
HTML, XML, XHTML, and W3C are trademarks or registered trademarks of W3C®, World Wide Web Consortium, Massachusetts Institute of Technology.
Apple, App Store, iBooks, iPad, iPhone, iPhoto, iPod, iTunes, Multi-Touch, Objective-C, Retina, Safari, Siri, and Xcode are trademarks or registered trademarks of Apple Inc.
IOS is a registered trademark of Cisco Systems Inc.
RIM, BlackBerry, BBM, BlackBerry Curve, BlackBerry Bold, BlackBerry Pearl, BlackBerry Torch, BlackBerry Storm, BlackBerry Storm2, BlackBerry PlayBook, and BlackBerry App World are trademarks or registered trademarks of Research in Motion Limited.
Google App Engine, Google Apps, Google Checkout, Google Data API, Google Maps, Google Mobile Ads, Google Mobile Updater, Google Mobile, Google Store, Google Sync, Google Updater, Google Voice, Google Mail, Gmail, YouTube, Dalvik and Android are trademarks or registered trademarks of Google Inc.
INTERMEC is a registered trademark of Intermec Technologies Corporation.
Wi-Fi is a registered trademark of Wi-Fi Alliance.
Bluetooth is a registered trademark of Bluetooth SIG Inc.
Motorola is a registered trademark of Motorola Trademark Holdings LLC.
Computop is a registered trademark of Computop Wirtschaftsinformatik GmbH.
SAP, R/3, SAP NetWeaver, Duet, PartnerEdge, ByDesign, SAP BusinessObjects Explorer, StreamWork, SAP HANA, and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and other countries.
Business Objects and the Business Objects logo, BusinessObjects, Crystal Reports, Crystal Decisions, Web Intelligence, Xcelsius, and other Business Objects products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of Business Objects Software Ltd. Business Objects is an SAP company.
Sybase and Adaptive Server, iAnywhere, Sybase 365, SQL Anywhere, and other Sybase products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of Sybase Inc. Sybase is an SAP company.
Crossgate, m@gic EDDY, B2B 360°, and B2B 360° Services are registered trademarks of Crossgate AG in Germany and other countries. Crossgate is an SAP company.
All other product and service names mentioned are the trademarks of their respective companies. Data contained in this document serves informational purposes only. National product specifications may vary.
The information in this document is proprietary to SAP. No part of this document may be reproduced, copied, or transmitted in any form or for any purpose without the express prior written permission of SAP AG.
Top Related