Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Entwicker camp2007 blackberry-workshop

364 views

Published on

Published in: Technology, Business
  • Be the first to comment

  • Be the first to like this

Entwicker camp2007 blackberry-workshop

  1. 1. Den nächste Schritt zum Erfolg : Domino&Notes8Powered byBundled-KnowHowDeploying DominoApplications to theBlackBerry.Bill BuchanHADSL
  2. 2. Den nächste Schritt zum Erfolg : Domino&Notes8Powered byBundled-KnowHowAgenda …• Introduction• Architectures• Lesson 1: Web Service Enabling a Domino Application• BlackBerry MDS Studio Overview• Lesson 2: First Application• Lesson 3: A Complex Application• Wrap-up
  3. 3. Den nächste Schritt zum Erfolg : Domino&Notes8Powered byBundled-KnowHowWhat Is This About?• This workshop aims to teach you:– How to web service enable Domino applications– The BlackBerry MDS studio– Developing your first BlackBerry application• Why BlackBerry?– Market leading handheld data device– Robust– Loved by CIOs– Do you have them already?• Who am I?– Bill Buchan – HADSL – http://www.hadsl.com
  4. 4. Den nächste Schritt zum Erfolg : Domino&Notes8Powered byBundled-KnowHowWhat is this About?(cont.)• Where do I find BlackBerry MDS Studio?– The BlackBerry Web site• www.BlackBerry.com• The MDS toolkit contains:– A BlackBerry simulator– The BlackBerry Mobile Data Suite Engine– An integrated development environment
  5. 5. Den nächste Schritt zum Erfolg : Domino&Notes8Powered byBundled-KnowHowWhat do you need to do ?• Have a Domino server running locally (or usemine)• Have Domino Designer open and ready• Install BlackBerry MDS studio – accepting ALLdefaults
  6. 6. Den nächste Schritt zum Erfolg : Domino&Notes8Powered byBundled-KnowHowAgenda …• Introduction• Architectures• Lesson 1: Web Service Enabling a Domino Application• BlackBerry MDS Studio Overview• Lesson 2: First Application• Lesson 3: A Complex Application• Wrap-up
  7. 7. Den nächste Schritt zum Erfolg : Domino&Notes8Powered byBundled-KnowHowMDS Architecture• MDS is a Java-based application stack– May run on the BlackBerry Enterprise Server• In a small environment• Larger environments may require dedicated servers– Application repository holds applications– Can push applications to users’ BlackBerries• MDS also provides:– On-line data connectivity services via web services• Allowing handsets to utilize web services– Application access to PIM data on the BlackBerry• Allowing applications to interrogate the BlackBerry
  8. 8. Den nächste Schritt zum Erfolg : Domino&Notes8Powered byBundled-KnowHowSolution ArchitectureInternetBESMDSDominoServersDominoServersDominoServersWebServicesSecure Data ChannelFirewallRIMGPRSBlackBerryBlackBerryBlackBerry MDS Mobile Data SuiteBES BlackBerry Enterprise ServerRIM Research In MotionGPRS General Packet Radio Service
  9. 9. Den nächste Schritt zum Erfolg : Domino&Notes8Powered byBundled-KnowHowSolution Architecture (cont.)• We are interested in:– Web service enabling a Domino application– Interacting with that application via a BlackBerryhandset
  10. 10. Den nächste Schritt zum Erfolg : Domino&Notes8Powered byBundled-KnowHowAgenda …• Introduction• Architectures• Lesson 1: Web Service Enabling a Domino Application• BlackBerry MDS Studio Overview• Lesson 2: First Application• Lesson 3: A Complex Application• Wrap-up
  11. 11. Den nächste Schritt zum Erfolg : Domino&Notes8Powered byBundled-KnowHowWeb Service Enabling: Introduction• What is a web service?– A web service is a standard application-to-application interface– It usually uses the “http” protocol — just like a web page– It usually encapsulates its data into an XML file– It can be made secure• How can I create a web service?– Prior to Domino 7, using Java Servlets– In Domino 7 you can create web services in LotusScript• How can I “consume” a web service:– Quick and Dirty: MS SOAP DLL Use for Testing– Better: use a Java Agent – Project “Stubby” – http://www.openNtf.org
  12. 12. Den nächste Schritt zum Erfolg : Domino&Notes8Powered byBundled-KnowHowWeb Services: Resources• www.nsftools.com– Julian’s site is a very good repository of Domino JavaCode• The sample database for this session• www.openNtf.org– The “Stubby” project
  13. 13. Den nächste Schritt zum Erfolg : Domino&Notes8Powered byBundled-KnowHowWeb Services: Design• We shall create a web servicethat provides a single function– GetAllPurchaseOrders()shall return a StringArray containing allPurchase Orders• Open Designer andnavigate to “WebServices”– Create a new webservice called“Simple”
  14. 14. Den nächste Schritt zum Erfolg : Domino&Notes8Powered byBundled-KnowHowWeb Services: Coding the Return Type• We cannot return a string array() via a function:• However, we can return a class..Class ReturnsPublic purchaseOrders() As StringSub new()Redim purchaseOrders(0)End SubEnd ClassSolution
  15. 15. Den nächste Schritt zum Erfolg : Domino&Notes8Powered byBundled-KnowHowWeb Services: Coding the Web Service• Now populate our web service classClass testWebService This function returns a string array!Public Function GetAllPurchaseOrders() As ReturnsOn Error Goto errorhandler collect all documents in the view and summarise them into the string arrayexitFunction:Exit Functionerrorhandler:MsgBox "The system experienced a run-time error: "+_Error$ + " at line: " +Trim(Str(Erl)) + Chr(10)Resume exitFunctionEnd FunctionEnd ClassSolution
  16. 16. Den nächste Schritt zum Erfolg : Domino&Notes8Powered byBundled-KnowHowWeb Services: Performance• Domino reloads LotusScript on each call– Ouch. It might not handle large concurrency.– No persistent (in memory) data– Don’t do complex actions during your web service• Keep it to lookup or store operations– Write documents that are then “completed” by ascheduled agent– How can I tell if its taking a long time?• User response• Lack of scalability in terms of concurrent users• “Profile” the web service using agent profiling
  17. 17. Den nächste Schritt zum Erfolg : Domino&Notes8Powered byBundled-KnowHowWeb Services: Scalability• Want a heavyweight, scalable web service?– Consider rewriting in Java:• Persistent session data• Caching of common lookup views• Able to use threading to separate “heavy duty” tasks• Use a LotusScript web service to prototype and test• If performance does not scale, rewrite in Java
  18. 18. Den nächste Schritt zum Erfolg : Domino&Notes8Powered byBundled-KnowHowWeb Services: Summary• Web service enabling a Domino application:– Domino 7 makes it simple to web service enablean application using LotusScript– Lots of web service tutorials on the web• Remember:– Web services are a standard, platform independent, languageindependent, application-to-application interface– Useful for exposing Domino data to other platforms– Useful for dispelling anti-Domino bias in your company– Web services are not the point of this presentation!
  19. 19. Den nächste Schritt zum Erfolg : Domino&Notes8Powered byBundled-KnowHowLesson 1: Creating a Domino Web Service1.Right click on the BBWS database, and choose“Open Designer”2.Go to the Shared Code section3.Open the “Web Services” Section4.Click on “New”web Service....
  20. 20. Den nächste Schritt zum Erfolg : Domino&Notes8Powered byBundled-KnowHowLesson 1: Creating a Domino Web Service1. Name this web service “Simple”2. In the options section•Ensure that “Option Declare” exists3. In the declarations section•Define the class Returns:•Define the class “Simple”•Fill in the missing code to populate the string array usingsummary information from the view.4. Use lots of “MsgBox” functions to log comments to the server log5. Use Internet Explorer to display the Web Service WSDL
  21. 21. Den nächste Schritt zum Erfolg : Domino&Notes8Powered byBundled-KnowHowAgenda …• Introduction• Architectures• Lesson 1: Web Service Enabling a Domino Application• BlackBerry MDS Studio Overview• Lesson 2: First Application• Lesson 3: A Complex Application• Wrap-up
  22. 22. Den nächste Schritt zum Erfolg : Domino&Notes8Powered byBundled-KnowHowMDS Studio First Look• Like many other IDEs:– It has lots of screens– It has a tree-style navigator to see objects– Double-clicking on an object opens it in the editor– Selecting an item allows you to edit its properties• It has two “perspectives”– Application perspective is for editing the application– Test perspective is for testing the application
  23. 23. Den nächste Schritt zum Erfolg : Domino&Notes8Powered byBundled-KnowHowMDS Studio First Look (cont.)• It has a BlackBerry simulator– You can choose different models to test your code• Generally it is:– Stable– Quick– Easy to use• It’s very quick for debug/test cycles– Just change perspective, edit, and retest
  24. 24. Den nächste Schritt zum Erfolg : Domino&Notes8Powered byBundled-KnowHowMDS Documentation• The documentation is pretty good. But:– Quite thin in some respects– You should rely on the online technical forum– You might consider a technical support contract
  25. 25. Den nächste Schritt zum Erfolg : Domino&Notes8Powered byBundled-KnowHowAgenda …• Introduction• Architectures• Lesson 1: Web Service Enabling a Domino Application• BlackBerry MDS Studio Overview• Lesson 2: First Application• Lesson 3: A Complex Application• Wrap-up
  26. 26. Den nächste Schritt zum Erfolg : Domino&Notes8Powered byBundled-KnowHowFirst Application: Introduction• We shall create a BlackBerry application– To retrieve information from our Domino Server• Using the web service we created earlier– That is easy for the end user– That shows how to:• Amend screens• Create scripts• Call different actions• We shall compile and distribute the application– To the built-in BlackBerry simulator
  27. 27. Den nächste Schritt zum Erfolg : Domino&Notes8Powered byBundled-KnowHowFirst Application: Creating a New Project• Choose “File, NewProject”– And choose“Quick StartApproach Wizard”
  28. 28. Den nächste Schritt zum Erfolg : Domino&Notes8Powered byBundled-KnowHowFirst Application: Creating a New Project (cont.)• Now enter the URI of the Web service Application– http://<server>/<database>/<webservicename>?WSDL– In our case, use the URL:• http://127.0.0.1/bbws.nsf/Simple?WSDL
  29. 29. Den nächste Schritt zum Erfolg : Domino&Notes8Powered byBundled-KnowHowFirst Application: Creating a New Project (cont.)• Select the web service(s) you wish to import– In our case, wejust choose thesingle function• GetAllPurchaseOrders()
  30. 30. Den nächste Schritt zum Erfolg : Domino&Notes8Powered byBundled-KnowHowFirst Application: Creating a New Project (cont.)• Finally, give the project a name– Call it “First Project”
  31. 31. Den nächste Schritt zum Erfolg : Domino&Notes8Powered byBundled-KnowHowFirst Application: Quick Fix• We shall apply a quick fix to this application– The default application sends a web service query to ourDomino server, and then displays a screen stating that the webservice request has been sent– We need to edit the Javascript routine that the “Go” buttoncalls in order to allow the response event to trigger, and displayour return value– In the navigator screen, navigate to “Scripts”– Open script“GETALLPURCHASEORDERSRequest_onSubmit”– Delete the second line of the script– Click on “File”, “Save All”
  32. 32. Den nächste Schritt zum Erfolg : Domino&Notes8Powered byBundled-KnowHowFirst Project: Running the Project:• Right click on the project name inthe explorer bar, and select “Test”– This will compile, publish,and deploy the application tothe simulator, and startthe simulator– If the MDS services havenot yet started, they willalso be started
  33. 33. Den nächste Schritt zum Erfolg : Domino&Notes8Powered byBundled-KnowHowFirst Project: Running the Project (cont.)• The simulator will appear– Use your mouse scroll heel (or the down–arrow) to select the MDS Control Center iconon the BlackBerry menu– Click the mouse scroll button to select (orclick on the ScrollWheel on the right)• Can’t see the simulator? Check your taskbar.– It often hidesdown thereGOTCHA!
  34. 34. Den nächste Schritt zum Erfolg : Domino&Notes8Powered byBundled-KnowHowFirst Project: Viewing the Project on the Simulator• On the simulator screen– Select MDS ControlCenter– Scroll downto your application– Click on theapplication and choose“Start” from the menu
  35. 35. Den nächste Schritt zum Erfolg : Domino&Notes8Powered byBundled-KnowHowFirst Project: Running the Project on the Simulator• We see a single screen with a singlebutton– Select and click on “Go”– The application will then call ourDomino Web service anddisplay the results
  36. 36. Den nächste Schritt zum Erfolg : Domino&Notes8Powered byBundled-KnowHowFirst Project: Initial Comments• We need to do some work– Add more meaningful screen titles– Bypass the “Go” button on the first screen so that theapplication automatically gets the Purchase Orders– Make the Purchase Order text read-only so that theuser does not have to scroll past it to get to the button• In fact — lets move the button to the top
  37. 37. Den nächste Schritt zum Erfolg : Domino&Notes8Powered byBundled-KnowHowFirst Project: Updating the Front Screen• Switch back to Blackberry MDS Studio– On the Blackberry MDS Studio,switch from the “TestPerspective” back to the“Development Perspective”– On the Navigator, expand the “Test” project, expand “Applications”, expand“Screens”– Double-click on the “scrMain” screen– Remove the button– Change the caption to “fetching Purchase Orders”– Click on the screen itself and change the Initialize property to run Script“GETPURCHASEORDERSRequest_onSubmit”– Change the window title to “Purchase Orders”– Now click on “File”, “Save All”
  38. 38. Den nächste Schritt zum Erfolg : Domino&Notes8Powered byBundled-KnowHowFirst Project: Updating the Second Screen• Lets update the second screen– Double click on the “scrGETPURCHASEORDERSResponse” screen– Delete the “Service Response” text and icon– Delete the “GETPURCHASEORDERS” label– Drag the button to the top of the screen– Change the button text to “Refresh”– Change the OnClick action• To a Script• Choose Script GETPURCHASEORDERSRequest_onSubmit– Change the returned text to “read-only”– Change the window title to “Purchase Orders”• Click on “File”, “Save All”
  39. 39. Den nächste Schritt zum Erfolg : Domino&Notes8Powered byBundled-KnowHowFirst Project: Testing• Right click on the project, and choose “Test”– This will recompile and redeploy the application to the simulator• The application will refresh on the simulator screen– Check that the version of the application on the simulator is the version youexpect
  40. 40. Den nächste Schritt zum Erfolg : Domino&Notes8Powered byBundled-KnowHowFirst Project: Conclusion• Congratulations! We have just completed an entire test +development cycle– Web service enabled a Domino application– Tested the web service application– Created a complete new BlackBerry application using the WebService Definition Language (WSDL)– Deployed the application to the simulator– Tested that application making “live” web service callsback to Domino– Redesigned the UI of that application– Recompiled and redeployed the application back to the simulator
  41. 41. Den nächste Schritt zum Erfolg : Domino&Notes8Powered byBundled-KnowHowAgenda …• Introduction• Architectures• Lesson 1: Web Service Enabling a Domino Application• BlackBerry MDS Studio Overview• Lesson 2: First Application• Lesson 3: A Complex Application• Wrap-up
  42. 42. Den nächste Schritt zum Erfolg : Domino&Notes8Powered byBundled-KnowHowA More Complex Application: Introduction• A more complex application allows the user to send data to the web service and acton its results– In this case we shall• Present the user with a list of Purchase Orders• Allow the user to display a particular purchase order• Allow the user to create a new purchase order– The new version of the web service is not much more complicated. Only twonew calls:• CreatePurchaseOrder()• SearchForPO(searchString as String) as String• This demonstration shows:– How to bind returned data to edit controls– How to trigger messages when edit controls change
  43. 43. Den nächste Schritt zum Erfolg : Domino&Notes8Powered byBundled-KnowHowA More Complex Application: Note• Note that:– This is still not an enterprise application– We have only touched the surface of MDS Studiosability.– The methods used are to illustrate BlackBerry MDSStudio techniques, not necessarily best practice
  44. 44. Den nächste Schritt zum Erfolg : Domino&Notes8Powered byBundled-KnowHowAgenda …• Introduction• Architectures• Lesson 1: Web Service Enabling a DominoApplication• BlackBerry MDS Studio Overview• Lesson 2: First Application• Lesson 3: A Complex Application• Wrap-up
  45. 45. Den nächste Schritt zum Erfolg : Domino&Notes8Powered byBundled-KnowHowResources• The BlackBerry MDS Studio:– www.blackberry.com• The BlackBerry Developers area– Domino Sample Code:• www.blackberry.com/developers/resources/domino/samplecode.shtml• Example database for this presentation:
  46. 46. Den nächste Schritt zum Erfolg : Domino&Notes8Powered byBundled-KnowHowSummary• Domino applications can be easily web service enabled• You don’t need a BlackBerry or a BES Server to code and testBlackBerry applications• Deploying Domino applications to the BlackBerry MDS Studio– Uses web services– Is straightforward• Blackberry MDS Studio– Is a fairly simple IDE– Quick to code and test– May run out of steam with more complex applications

×