65
© 2006 Wellesley Information Services. All rights reserved. Deploying Domino Applications to BlackBerry MDS Studio Bill Buchan HADSL

The View - Deploying domino applications to BlackBerry MDS Studio

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: The View - Deploying domino applications to BlackBerry MDS Studio

© 2006 Wellesley Information Services. All rights reserved.

Deploying Domino Applications to BlackBerryMDS Studio

Bill BuchanHADSL

Page 2: The View - Deploying domino applications to BlackBerry MDS Studio

2

What We'll Cover …

• Introduction• Architectures• Web Service Enabling a Domino Application• Installing BlackBerry MDS Studio• BlackBerry MDS Studio Overview• First Application• A Complex Application• Wrap-up

Page 3: The View - Deploying domino applications to BlackBerry MDS Studio

3

Who is the Target Audience?

• Lotus Notes developers in BlackBerry enabled environments• Developers who wish to deploy applications to BlackBerries

Page 4: The View - Deploying domino applications to BlackBerry MDS Studio

4

What Is This About?

• This talk aims to demonstrate:How to web service enable Domino applicationsThe BlackBerry MDS studioDeveloping your first BlackBerry application

Page 5: The View - Deploying domino applications to BlackBerry MDS Studio

5

What Is This About? (cont.)

• Why BlackBerry?Market leading handheld data deviceRobustLoved by CIOsDo you have them already?

• Who am I?Bill BuchanDual PCLP in v3, v4, v5, v6, v710+ years senior development consultancy forEnterprise customers

Learn from my pain!5+ years code auditingCEO — HADSL — developing best-practice tools

Page 6: The View - Deploying domino applications to BlackBerry MDS Studio

6

What is this About?(cont.)

• Where do I find BlackBerry MDS Studio?The BlackBerry Web site

www.BlackBerry.com• The MDS toolkit contains:

A BlackBerry simulatorThe BlackBerry Mobile Data Suite EngineAn integrated development environment

Note

Page 7: The View - Deploying domino applications to BlackBerry MDS Studio

7

What We'll Cover …

• Introduction• Architectures• Web Service Enabling a Domino Application• Installing Blackberry MDS Studio• BlackBerry MDS Studio Overview• First Application• A Complex Application• Wrap-up

Page 8: The View - Deploying domino applications to BlackBerry MDS Studio

8

MDS Architecture

• MDS is a Java-based application stackMay run on the BlackBerry Enterprise Server

In a small environmentLarger environments may require dedicated servers

Application repository holds applicationsCan push applications to users’ BlackBerries

• MDS also provides:On-line data connectivity services via web services

Allowing handsets to utilize web servicesApplication access to PIM data on the BlackBerry

Allowing applications to interrogate the BlackBerry

Page 9: The View - Deploying domino applications to BlackBerry MDS Studio

9

Solution Architecture

• MDS provides application and data to handsets

InternetBES

MDS

DominoServers

DominoServers

DominoServers

WebServices

Secure Data Channel Firew

all

RIM

GP

RS

BlackBerryBlackBerryBlackBerry

Don't Forget

MDS Mobile Data SuiteBES BlackBerry Enterprise ServerRIM Research In MotionGPRS General Packet Radio Service

Page 10: The View - Deploying domino applications to BlackBerry MDS Studio

10

Solution Architecture (cont.)

• We are interested in:Web service enabling a Domino applicationInteracting with that application via a BlackBerry handset

• Is this difficult?No. The Blackberry MDS Studio makes it simple for you.

• Is the Blackberry MDS Studio lightweight?No. It creates enterprise applications.

• Is it difficult to use?No. This presentation will lead you through your first application.

• Oh no. Not another IDE!It’s yet another IDESimilar to Visual Studio/Rational Application Developer

Page 11: The View - Deploying domino applications to BlackBerry MDS Studio

11

What We'll Cover …

• Introduction• Architectures• Web Service Enabling a Domino Application• Installing Blackberry MDS Studio• BlackBerry MDS Studio Overview• First Application• A Complex Application• Wrap-up

Page 12: The View - Deploying domino applications to BlackBerry MDS Studio

12

Web Service Enabling: Introduction

• What is a web service?A web service is a standard application-to-application interfaceIt usually uses the “http” protocol — just like a web pageIt usually encapsulates its data into an XML fileIt can be made secure

• How can I create a web service?Prior to Domino 7, using Java ServletsIn Domino 7 you can create web services in LotusScript

• How can I “consume” a web service:Quick and Dirty: MS SOAP DLL

Use for TestingBetter: use a Java Agent

Page 13: The View - Deploying domino applications to BlackBerry MDS Studio

13

Web Services: Resources

• www.nsftools.comJulian’s site is a very good repository of Domino Java Code

• www.billbuchan.comMy “Speaking Engagements” page has a web services examplefrom ILUG

• The sample database for this session• www.openNtf.org

The “Stubby” project

Page 14: The View - Deploying domino applications to BlackBerry MDS Studio

14

Web Services: Design

• We shall create a web service that provides a single functionGetJoke() shall return a string containing a single JokeRepeated calls to this function will return different jokes on a random basis

• Open Designer and navigate to “Web Services”

Create a new web service called “Simple”

Page 15: The View - Deploying domino applications to BlackBerry MDS Studio

15

Web Services: Coding the Web Service

• Now populate our web service classClass testWebService

' This function returns a single stringPublic Function getJoke() As String

On Error Goto errorhandler

Msgbox "Being asked for a joke.."

getJoke = “Whats Brown and Sticky ? A Stick!”

exitFunction:Exit Function

errorhandler:getJoke = "The system experienced a run-time error: "+_Error$ + " at line: " +Trim(Str(Erl)) + Chr(10)

Resume exitFunctionEnd Function

End Class

Solution

Page 16: The View - Deploying domino applications to BlackBerry MDS Studio

16

Web Services: Create a Web Service Consumer

• Go to www.nsftools.com and download the JURST toolkitCopy two script libraries from the example applicationto your application

ApacheSoapJurst

• Create a new Java agentCall it “GetTheJoke”Set the Target to “None”

Page 17: The View - Deploying domino applications to BlackBerry MDS Studio

17

Web Services: Create a Web Service Consumer (cont.)

import lotus.domino.*;import com.nsftools.jurst.SoapHelper;

public class JavaAgent extends AgentBase {public void NotesMain() {

try {Session session = getSession();AgentContext agentContext = session.getAgentContext();Database db = agentContext.getCurrentDatabase();String dbPath = db.getFilePath();

Name serverName = session.createName(db.getServer());String wsdlUrl = "http://" + serverName.getCommon() +

"/" + dbPath + "/Simple?WSDL";SoapHelper sh = new SoapHelper(wsdlUrl);System.out.println(sh.callSimpleMethod("GetJoke"));

} catch(Exception e) {e.printStackTrace();

}}

}

Page 18: The View - Deploying domino applications to BlackBerry MDS Studio

18

Web Services: Running the Consumer

• Open the NotesJava Debug Console

“File”, “Tools”, “Show Java Debug Console”This shows all “print”statements from ourJava code

Note

Page 19: The View - Deploying domino applications to BlackBerry MDS Studio

19

Web Services: Running the Consumer (cont.)

• Click on “Actions”, “GetTheJoke”

The results will appear inthe Java Console window

Page 20: The View - Deploying domino applications to BlackBerry MDS Studio

20

Web Services: Performance

• Domino reloads LotusScript on each callOuch. It might not handle large concurrency.No persistent (in memory) dataDon’t do complex actions during your web service

Keep it to lookup or store operationsWrite documents that are then “completed” by ascheduled agent

How can I tell if its taking a long time?User responseLack of scalability in terms of concurrent users“Profile” the web service using agent profiling

Page 21: The View - Deploying domino applications to BlackBerry MDS Studio

21

Web Services: Scalability

• Want a heavyweight, scalable web service?Consider rewriting in Java:

Persistent session dataCaching of common lookup viewsAble 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

Page 22: The View - Deploying domino applications to BlackBerry MDS Studio

22

Web Services: Summary

• Web service enabling a Domino application:Domino 7 makes it simple to web service enablean application using LotusScriptLots of web service tutorials on the web

• Remember:Web services are a standard, platform independent, language independent, application-to-application interfaceUseful for exposing Domino data to other platformsUseful for dispelling anti-Domino bias in your companyWeb services are not the point of this presentation!

Page 23: The View - Deploying domino applications to BlackBerry MDS Studio

23

What We'll Cover …

• Introduction• Architectures• Web Service Enabling a Domino Application• Installing Blackberry MDS Studio• BlackBerry MDS Studio Overview• First Application• A Complex Application• Wrap-up

Page 24: The View - Deploying domino applications to BlackBerry MDS Studio

24

Installing Blackberry MDS Studio: Introduction

• BlackBerry MDS StudioIt’s a Windows-only installation kitDownload from www.blackberry.comObtain a Blackberry MDS Studio license keyAt the time of writing (August 2006):

It was free!I installed version v1.0.4.13

Installation is relatively painless — less than 20 minsNeeds 1.5gb free disk spaceNeeds at least 1gb RAM

Page 25: The View - Deploying domino applications to BlackBerry MDS Studio

25

Blackberry MDS Studio: Installation

• Run the downloaded file, it will extract:“Setup.exe”a PDF document

• Run “Setup.exe”

Page 26: The View - Deploying domino applications to BlackBerry MDS Studio

26

Blackberry MDS Studio: Installation (cont.)

• Accept all four license screensIncluding the “Bouncy Castle” License

Page 27: The View - Deploying domino applications to BlackBerry MDS Studio

27

Blackberry MDS Studio: Installation (cont.)

• Enter the file pathI usually choose the default one

Page 28: The View - Deploying domino applications to BlackBerry MDS Studio

28

Blackberry MDS Studio: Installation (cont.)

• Enter the registration data you received from theBlackBerry Web site

Page 29: The View - Deploying domino applications to BlackBerry MDS Studio

29

Blackberry MDS Studio: Installation (cont.)

• Enter a Uniform Resource Identifier (URI) you wish to associate with your applications

I used “CompanyName.com”

Page 30: The View - Deploying domino applications to BlackBerry MDS Studio

30

Blackberry MDS Studio: Installation (cont.)

• You are now prompted to select ports for variousMDS services

I recommend you leave defaults unless you absolutely knowwhat you are doing!

Page 31: The View - Deploying domino applications to BlackBerry MDS Studio

31

Blackberry MDS Studio: Installation (cont.)

• Choose where you wish to create shortcuts

Page 32: The View - Deploying domino applications to BlackBerry MDS Studio

32

Blackberry MDS Studio: Installation (cont.)

• Confirm you wish to continue

Page 33: The View - Deploying domino applications to BlackBerry MDS Studio

33

Blackberry MDS Studio: Installation (cont.)

• Now sit back for 10-30 minutes whilst it installs

Page 34: The View - Deploying domino applications to BlackBerry MDS Studio

34

Blackberry MDS Studio: Installation Confirmation

• If the installation failedYou might want to consider uninstalling and reinstalling

• Start up Blackberry MDS StudioYou should see this splash screen

• Congratulations!

Page 35: The View - Deploying domino applications to BlackBerry MDS Studio

35

What We'll Cover …

• Introduction• Architectures• Web Service Enabling a Domino Application• Installing Blackberry MDS Studio• BlackBerry MDS Studio Overview• First Application• A Complex Application• Wrap-up

Page 36: The View - Deploying domino applications to BlackBerry MDS Studio

36

MDS Studio First Look

• Like many other IDEs:It has lots of screensIt has a tree-style navigator to see objectsDouble-clicking on an object opens it in the editorSelecting an item allows you to edit its properties

• It has two “perspectives”Application perspective is for editing the applicationTest perspective is for testing the application

Page 37: The View - Deploying domino applications to BlackBerry MDS Studio

37

MDS Studio First Look (cont.)

• It has a BlackBerry simulatorYou can choose different models to test your code

• Generally it is:StableQuickEasy to use

• It’s very quick for debug/test cyclesJust change perspective, edit, and retest

Page 38: The View - Deploying domino applications to BlackBerry MDS Studio

38

MDS Documentation

• The documentation is pretty good. But:Quite sparse in some respectsYou should rely on the online technical forumYou might consider a technical support contract

Page 39: The View - Deploying domino applications to BlackBerry MDS Studio

39

MDS Demo

Demo

Blackberry MDS Studio

First look

Page 40: The View - Deploying domino applications to BlackBerry MDS Studio

40

What We'll Cover …

• Introduction• Architectures• Web Service Enabling a Domino Application• Installing Blackberry MDS Studio• BlackBerry MDS Studio Overview• First Application• A Complex Application• Wrap-up

Page 41: The View - Deploying domino applications to BlackBerry MDS Studio

41

First Application: Introduction

• We shall create a BlackBerry applicationTo retrieve information from our Domino Server

Using the web service we created earlierThat is easy for the end userThat shows how to:

Amend screensCreate scriptsCall different actions

• We shall compile and distribute the applicationTo the built-in BlackBerry simulator

Page 42: The View - Deploying domino applications to BlackBerry MDS Studio

42

First Application: Creating a New Project

• Choose “File, New Project”And choose “Quick Start Approach Wizard”

Page 43: The View - Deploying domino applications to BlackBerry MDS Studio

43

First Application: Creating a New Project (cont.)

• Now enter the URI of the Web service Applicationhttp://<server>/<database>/<webservicename>?WSDL

Page 44: The View - Deploying domino applications to BlackBerry MDS Studio

44

First Application: Creating a New Project (cont.)

• Select the web service(s) you wish to importIn our case, wejust choose thesingle function

GetJoke()

Page 45: The View - Deploying domino applications to BlackBerry MDS Studio

45

First Application: Creating a New Project (cont.)

• Finally, give the project a name

Page 46: The View - Deploying domino applications to BlackBerry MDS Studio

46

First Application: Quick Fix

• We shall apply a quick fix to this applicationThe default application sends a web service query to our Domino server, and then displays a screen stating that the web service request has been sentWe need to edit the Javascript routine that the “Go” buttoncalls in order to allow the response event to trigger, anddisplay our return valueIn the navigator screen, navigate to “Scripts”Open script “GETJOKERequest_onSubmit”Delete the second line of the scriptClick on “File”, “Save All”

Page 47: The View - Deploying domino applications to BlackBerry MDS Studio

47

First Application: Quick Fix (cont.)

Page 48: The View - Deploying domino applications to BlackBerry MDS Studio

48

First Project: Running the Project:

• Right click on the project name in the 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

Page 49: The View - Deploying domino applications to BlackBerry MDS Studio

49

First Project: Running the Project (cont.)

• The simulator will appearUse your mouse scrollwheel (or the down–arrow)to select the MDS Control Center icon on the BlackBerry menuClick the mouse scrollbutton to select (or click on the ScrollWheel on the right)

• Can’t see the simulator? Check your taskbar.It often hidesdown there

GOTCHA!

Page 50: The View - Deploying domino applications to BlackBerry MDS Studio

50

First Project: Viewing the Project on the Simulator

• On the simulator screenSelect MDS Control CenterScroll down to your application

Click on theapplication and choose“Start” from the menu

Page 51: The View - Deploying domino applications to BlackBerry MDS Studio

51

First Project: Running the Project on the Simulator

• We see a single screen with a single button

Select and click on “Go”

The application will then call our Domino Web service anddisplay the results

Page 52: The View - Deploying domino applications to BlackBerry MDS Studio

52

First Project: Initial Comments

• We need to do some workAdd more meaningful screen titlesBypass the “Go” button on the first screen so that the application automatically gets the first JokeAdd a “Get Another” button to the second screenMake the Joke text read-only so that the user does not have to scroll past it to get to the button

In fact — lets move the button to the top

Page 53: The View - Deploying domino applications to BlackBerry MDS Studio

53

First Project: Updating the Front Screen

• Switch back to Blackberry MDS StudioOn the Blackberry MDS Studio, switch from the “Test Perspective” back to the “Development Perspective”On the Navigator, expand the “Test” project, expand “Applications”, expand “Screens”Double-click on the “scrMain” screenRemove the buttonChange the caption to “fetching the first joke”Click on the screen itself and change the Initialize property to run Script “GETJOKERequest_onSubmit”Change the window title to “Joke Server”Now click on “File”, “Save All”

Page 54: The View - Deploying domino applications to BlackBerry MDS Studio

54

First Project: Updating the Front Screen (cont.)

Page 55: The View - Deploying domino applications to BlackBerry MDS Studio

55

First Project: Updating the Second Screen

• Lets update the second screenDouble click on the “scrGETJOKEResponse” screenDelete the “Service Response” text and iconDelete the “JokeResponse” labelDrag the button to the top of the screenChange the button text to “Get Another Joke”Change the OnClick action

To a ScriptChoose Script GETJOKERequest_onSubmit

Change the returned text to “read-only”Change the window title to “Joke Server”

• Click on “File”, “Save All”

Page 56: The View - Deploying domino applications to BlackBerry MDS Studio

56

First Project: Updating the Second Screen (cont.)

Page 57: The View - Deploying domino applications to BlackBerry MDS Studio

57

First 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 screenCheck that the version of the application on the simulator is the version you expect

Page 58: The View - Deploying domino applications to BlackBerry MDS Studio

58

First Project: Conclusion

• Congratulations! We have just completed an entire test + development cycle

Web service enabled a Domino applicationTested the web service applicationCreated a complete new BlackBerry application using the Web Service Definition Language (WSDL)Deployed the application to the simulatorTested that application making “live” web service callsback to DominoRedesigned the UI of that applicationRecompiled and redeployed the application back to the simulator

Page 59: The View - Deploying domino applications to BlackBerry MDS Studio

59

What We'll Cover …

• Introduction• Architectures• Web Service Enabling a Domino Application• Installing BlackBerry MDS Studio• BlackBerry MDS Studio Overview• First Application• A Complex Application• Wrap-up

Page 60: The View - Deploying domino applications to BlackBerry MDS Studio

60

A More Complex Application: Introduction

• A more complex application allows the user to send data to the web service and act on its results

In this case we shall allow the user to send a categoryor a search stringThe new version of the web service is not much more complicated.Only two new calls:

GetJokeByCategory(category as String) as StringSearchForJoke(searchString as String) as String

• This demonstration shows:How to bind returned data to edit controlsHow to trigger messages when edit controls change

Page 61: The View - Deploying domino applications to BlackBerry MDS Studio

61

A More Complex Application: Note

• Note that:This is still not an enterprise applicationThe methods used are to illustrate BlackBerry MDS Studio techniques, not necessarily best practiceIt is a live demo and therefore highly likely to crash!

Demo

Blackberry MDS Studio

Demo

Page 62: The View - Deploying domino applications to BlackBerry MDS Studio

62

What We'll Cover …

• Introduction• Architectures• Web Service Enabling a Domino Application• Installing BlackBerry MDS Studio• BlackBerry MDS Studio Overview• First Application• A Complex Application• Wrap-up

Page 63: The View - Deploying domino applications to BlackBerry MDS Studio

63

Resources

• The BlackBerry MDS Studio:www.blackberry.com

• The BlackBerry Developers areaDomino Sample Code:

www.blackberry.com/developers/resources/domino/samplecode.shtml

• Example database for this presentation:

Page 64: The View - Deploying domino applications to BlackBerry MDS Studio

64

Key Points to Take Home

• Domino applications can be easily web service enabled• You don’t need a BlackBerry or a BES Server to code and

test BlackBerry applications• Deploying Domino applications to the BlackBerry

MDS StudioUses web servicesIs straightforward

• Blackberry MDS StudioIs a fairly simple IDEQuick to code and testMay run out of steam with more complex applications

Page 65: The View - Deploying domino applications to BlackBerry MDS Studio

65

Your Turn!

Questions?

How to Contact Me:Bill Buchan

[email protected]