M-Business Tips and Tricks Kirk Reistroffer Sr. Software Eng., iAnywhere Solutions Agenda M-Business Anywhere Overview Tips and Techniques • Application Development • Optimizing Server Settings • Utilizing New features in M-Business Anywhere 6.0 Questions Resources Overview M-Business Anywhere allows you to use the best of web technologies to build, deploy and maintain dynamic and reliable mobile applications. Why Web Development? Cost-effective •Standards-based (HTML, JavaScript, XML) •Most IT shops have plenty of web expertise Cross-platform •Browser worries about the device •Developer can focus on the application Easy data/application integration •Multiple data sources can look like one app •Easy to provide common look-and-feel Server-based user interface Powerful •Automatic application updates •Personalized UI/application functionality •From content publishing to fully database-driven enterprise applications Doesn’t the Web Need a Network? Making the web work with or without a connection Cache web pages – http gives developer control • Server cache – parse and compress pages • Device cache – pages are always available Store and forward form posts • Raw post/get data is stored on device between syncs • Pending posts are posted in batch at beginning of sync Support Personalization • User agent string lets server know it’s an M-Business browser • http headers contain information about user, device profile, cookies Ensure security • Full support for round trip SSL from device to web application • Support authentication and single sign-on M-Business Anywhere Architecture • Platform for creating and deploying online/offline mobile web applications. Server – the workhorse Sync Server – – – – – All communication with devices – only sends changes Fetch, parse, cache, compress content, applications Post forms from device back to application Compile JavaScript Initial Layout Admin Server – Configure Users and Groups – Configure “Channels” and Applications – Logging and Performance reporting Soap Server – Allows integration/embedding from outside applications – Full access to users, channels, groups, sync logs A Smart Client On-Device Data - Database and XML sync to device, local database on device On-Device Logic - JavaScript and Document Object Model (DOM) to control presentation and access to data On-Device Dynamic Presentation - HTML 4.0.1, XHTML 1.0 and CSS 1.0 Style Attribute for dynamic user interface Defining a Channel Caching provides Speed and Usability Channels – the key to always-available web apps •url •Link depth Application Development Personalization Customization Optimization Personalization • Mobile applications often serve a number of user groups and applications • Need a platform - the cost of building and maintaining many point solutions is prohibitive • Limited screen and resources require application to be targeted to the user and the task at hand • Authentication/identity • Localization • Eg. Salesforce.com allows every user to have different schema, choice lists, even screens, all from the same infrastructure. • Eg. Building inspection – different forms each time they go to a building. Forms can differ even from building to building Customizing Your Application • Client customization beyond JavaScript – AvantGo object – Preferences – Toolbar – Hourglass • Navigation tricks – hidden channels • Branding the home page • Launching with a custom icon Branding the Home Page Home page is a special web page served by the server. You can customize it or replace it with your own. To customize, modify C:\MBusinessServer\tomcat\webapps\device\index.jsp. Alternately, replace the url in agreservedsub with one of your own. Branding the Home Page The home page is a special channel. You can replace it with your own page. Managing the Connection avantgo.isOnline() avantgo.connect() avantgo.disconnect() avantgo.sync() If a connection is not available when you make an online form post, the form will be placed in the queue. Inside Forms M-Business Anywhere provides several special JavaScript methods for handling form posts – submitNoResponse() – submitWithResponse() – SubmissionMgr • IsMulti – If it is false, there is only a single submission • A form post is a channel – good trick for bringing new content to the cache wirelessly • Programmatic form submission allows you to construct multiscreen forms but generate a single form post. Three ways to data driven applications Data Store Pros Cons HTML Forms •No programming required •Good for flat files •Hierarchical data •No searching/sorting •No ability to display new records until after a sync XML •Easy deployment of tables – need a Schema and a data feed •Seemless schema changes •List view widget •Best for quick distribution of read only data or quick ad-hoc data stores on device •Hierarchical data – flat file •One way – have to send new records and updates via form posts •Non-transactional Ultralite/Mobilink •Fully relational/transactional •Mobilink provides extensive control over sync •More complicated Optimizing Application Development Server-side cache to minimize network traffic between Web content servers and mBusiness server. Client-side cache to minimize traffic and bandwidth between mBusiness client and server. Client local interaction with UltraLite or XML application data via JavaScript, HTML DOM and POD plug-ins. Optimizing Layout and Rendering Initial Layout is done on the server • If onLoad script changes DOM, client has to layout • Left alone, page laods will be faster Page re-loads are slow compared to DOM manipulation • Use display attribute to show and hide – <div id=“detail” style=“display:none”> – onClick=“detail.style.display=“block” • Insert elements into the DOM • Use inline style attributes Large DOM inserts can be slow – changes are fast • Let the server initialize “placeholder” elements • Dynamically change their content or attributes Letting the Server do the Work Things to think about when working with Web Application Servers • Session management – Sessions are often short, with the assumption that you are working online. – Extend sessions for M-Business Anywhere Clients using UserAgent or http headers to determine client – Leverage new ability to send single sign-on information in headers • Navigation – many application servers use posts or JavaScript to navigate from page to page. M-Business Anywhere can only “crawl” anchors Letting the Server do the Work Things to think about when working with Web Application Servers • Navigation – many application servers use posts or JavaScript to navigate from page to page. M-Business Anywhere can only “crawl” anchors <form action=“nextPage.html”> My first page content <input type=“submit” value=“next”> </form> <input type=“button” onClick=“window.location=“nextPage.html”> <a href=“nextPage.html”></a> OR <a href=“nextPage.html><img scr=“nextbutton.gif”></a> Optimizing Server Settings : Sync.Conf Performance tuning SyncPref WebToGoMaxTextSize 256 (KB) SyncPref MaxCacheSize 262144 (256KB) SyncPref WebToGoMaxImageSize 1000 (KB) SyncPref WebToGoDefaultOnlineRequestSize 100 SyncPref QuadCompressJS TRUE SyncPref CacheInMemory TRUE SyncPref MaxMemCacheSize 10 (MB) SyncPref MaxMemCacheObjectSize 1024 (KB) Optimizing Server Settings : Sync.Conf Binary Types • default behavior SyncPref WebToGoIgnoredExtensions pdf,fdf,psd,au,z,xlc,fon,hlp,ico,jar,xls,xlt,xlw,mov,pic,ra,r m,ram,pfm,avi,wav,bmp,rtf,doc,arc,taz,tgz,wri,zip,gz,tar, ppt,mdb,class,subs,ps,xbm,conf,default,xml,xsd SyncPref WinCEDownloadTypes "mime-type1, ..., typeN“ SyncPref WinCEDownloadExts "ext1, ..., extN“ Binary Download Server Settings : Sync.Conf Where to put an executable in the Win32/WinCE file system? *.exe gets sent to the start menu: %AG_STARTMENU% *.cab files get sent to \\Program Files\AvantGo\pods and then executed all others allowed by SyncPref WinCEDownloadTypes are sent to \\Program Files\AvantGo\pods META tag capability <meta name="x-avantgo-download-location“ content="filename.xxx,%AG_STARTMENU%"> <a href="filename.xxx></a> Launching/POD shellExecute filename.xxx Optimizing Server Settings : Sync.Conf Security (inbound) (outbound) Client SSL Sync Server SSL Web Server #SSL:#ECC:Sagd_CertFileName /…/sslecdsa.crt #SSL:#ECC:Sagd_KeyPassword password #SSL:SyncPref AllowSecureClientConnect TRUE #SSL:SyncPref ConnectSecureOnly FALSE #SSL:SyncPref AllowHTTPSAlways FALSE Optimizing Server Settings : Sync.Conf Logging and Debugging settings ErrorLog logs/sync_error.log emergency: Problems preventing correct operation of the server. alert: Problems preventing correct operation of a component. critical: Problems which degrade operation of a component. error: Problems which are transient or affect only specific users. warning: Problems that may be an issue if they occur frequently. LogLevel warning SyncPref EnableLog webtogo,astro SyncPref EnableLog rover0,…,rover3 SyncPref EnableLog cache,memcache SyncPref EnableLog timed_action,webtogo_binary Utilizing new features in M-Business Anywhere 6.0 Make it easier for companies to embed and integrate M-Business Anywhere into their applications • SOAP Server • Easier client management • More control over the sync process Increase Performance and Security • Improved caching • Password protect the client • Support single sign-on integration Support more content • DBCS Support • Localized Chinese and Japanese Embedding and Integration Features SOAP API • Developers can now do programmatically virtually anything they could do thru Admin UI via WSDL-based Web Service • Allows an external system to populate M-Business meta data • Allows complete access to logging and server statistics for reporting and monitoring • Java and .NET client examples are provided Admin UI • Moved to Tomcat • A new "tree-based" paradigm will make it easier to extend the UI. • Implemented using the new SOAP API SOAP .NET Example using System; using console.SoapRef; using System.Xml; namespace console { public class TestAPI { SoapRef.avantgoapi m_api; uint m_groupUserId; uint m_groupId; NewUser nu = new NewUser(); nu.userName = “newuser; nu.firstName = “New"; nu.lastName = "User"; nu.password = “xxxx"; nu.comment = “Test"; m_groupUserId = m_api.userCreate(nu); } } Improved Client Management Client Remote Upgrade • Automatic upgrade of M-Business client to user devices • Rules by platform, group Support for More Content DBCS support • Internationalization to support double-byte characters. Includes ability to display dbcs html and run the server, client and desktop components on dbcs OS machines. Supported device platforms are XP, Windows CE 2003 and Windows Mobile 2005. Localization • Localized version of the M-Business client into Japanese, Simplified Chinese and Traditional Chinese for XP, Windows CE 2003 and Windows Mobile 2005. Windows Mobile 5.0 What’s new with Windows Mobile 2005 Client signing ActiveSync 4.x /Windows Mobile 2005 What’s coming in 6.2 Release Microsoft Smartphone Client • • • • PPC 2003 and above Full Enterprise Client support as well as AMI consumer client Softkey Menu Improved stylus free operation VGA Resolution • Greatly improved text readability • Higher quality images SD Card support • Client and content on PPC and Microsoft Smartphone • Content only on Palm Questions ? Resources http://www.ianywhere.com/developer/mbusiness_anywhere.html Developer Getting Started Guide Developer Guide Developer Reference White Papers Sample Code news://forums.sybase.com/ public.ianywhere.mbusinessanywhere.general Understanding the Device Cache URL is the unique ID – Any channel can link to a page in another channel M-Business Anywhere can serve any mime type – Easy way to get documents and media files from your web site to mobile devices – Viewer applications can be launched from JavaScript Serve a directory – Putting new files in the directory adds them to the device – Use JavaScript to navigate once the page is in the cache Hidden anchors – <a href=“foo.html”></a> – Page is still fetched and cached – Same technique works with hidden channels Personalization – HTTP Headers GET / HTTP/1.0 Host: localhost:8080 Accept: text/plain, text/html, image/jpeg, image/gif, application/octet-stream, application/x-javascript, text/javascript, text/xml User-Agent: Mozilla/4.0 (compatible; AvantGo 6.0; Windows NT) X-AvantGo-DeviceProcessor: 0x0100 Cookie: ASPSESSIONIDAACRSCDQ=ALFJPJLAPENBJJIABPOPBEIB X-AvantGo-Version: 6.0.154 6.0.154 X-AvantGo-ColorDepth: MTY= 16 X-AvantGo-ClientLanguage: en_US en_US X-AvantGo-Browser: AvantGo AvantGo X-AvantGo-ScreenSize: MzIweDMyMA== 320x320 X-AvantGo-DeviceOS: UEFMTV9PUw== PALM_OS X-AvantGo-DeviceOSVersion: NS4xLjA= 5.1.0 X-AvantGo-UserId: Y2dyaW1wYWxt cgrimpalm X-AvantGo-UserPassword: ZGVtbw== demo X-AvantGo-DeviceId: U0VSSUFMTlVNQkVS X-AvantGo-OnlineRequest: TRUE X-AvantGo-CradleSync: FALSE X-AvantGo-ChannelId: 0 X-AvantGo-PlatformData: 0x0100 Personalization - Authentication Challenge – Response • Web server returns challenge, user is prompted and must sync again Use cookies to store tokens • Custom authentication logic • Single sign-on, etc. Personalization – Use the URL Channel macros – replaced at sync time • AG_USER • AG_DEVICEOS • Example: http://myserver/form.html?id=AG_USER => http://myserver/form.html?id=cgrim Meta tags <META NAME="HandheldFriendly“ CONTENT="True"> <META HTTP-EQUIV=pragma CONTENT=“no-cache”> <META HTTP-EQUIV=content-type CONTENT="text/html; charset=ISO-8859-1"> <META HTTP-EQUIV=content-type CONTENT="text/html; charset=UTF-8"> <META HTTP-EQUIV=content-type CONTENT="text/html; charset=Shift-JIS"> AvantGo Object Preferences • Persistent key-value store • Applications specific user prefs • • • • • • • • • • getStringValueForKey() setStringValueForKey() getInt32ValueForKey() setInt32ValueForKey() getUInt32ValueForKey() setUInt32ValueForKey() getBoolValueForKey() setBoolValueForKey() getBytesForKey() setBytesForKey() Toolbar Object buttonCount createButton() deleteButton() title buttonForIndex() buttonForName() Showing an hourglass window.showBusy = bool; Call it before any activity that will take time. Custom Launcher SOAP Java Example package com.ia.mbwebapi.tests; import import import import import import import import public class TestUserApi { private static SoapHttpClient lshc; private static int userId; java.util.*; java.io.*; java.net.*; de.fmui.spheon.jsoap.*; de.fmui.spheon.jsoap.transport.http.*; de.fmui.spheon.jsoap.encoding.*; com.ia.mbwebapi.tests.Util; com.ia.mbwebapi.structs.*; public static boolean TestApi(String server, SoapConfig sc, SoapHttpClient shc, String sid) throws Exception { RPCCall call = new RPCCall( sc, "urn:AvantgoWebAPI", "userCreate" ); NewUser n = new NewUser(); n.userName = "UnitTestUser" + System.currentTimeMillis(); n.firstName = "UnitTest"; n.lastName = "User"; n.password = "u"; n.comment = "comment"; call.setParameter( "user", n, NewUser.class); Util.InsertSessionId(call.getEnvelope(), sid ); Envelope answer = shc.invokeHTTP(new URL( server ), "", call.getEnvelope()); ParamBag b = call.getResults( answer ); Integer id = (Integer) b.getValue( 0 ); p( "Success: userCreate returned user id:" + id); userId = id.intValue(); } } }
© Copyright 2024