Upload
bill-buchan
View
548
Download
2
Embed Size (px)
DESCRIPTION
Citation preview
© 2006 Wellesley Information Services. All rights reserved.
Deploying Domino Applications to BlackBerryMDS Studio
Bill BuchanHADSL
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
3
Who is the Target Audience?
• Lotus Notes developers in BlackBerry enabled environments• Developers who wish to deploy applications to BlackBerries
4
What Is This About?
• This talk aims to demonstrate:How to web service enable Domino applicationsThe BlackBerry MDS studioDeveloping your first BlackBerry application
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
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
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
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
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
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
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
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
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
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”
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
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”
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();
}}
}
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
19
Web Services: Running the Consumer (cont.)
• Click on “Actions”, “GetTheJoke”
The results will appear inthe Java Console window
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
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
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!
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
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
25
Blackberry MDS Studio: Installation
• Run the downloaded file, it will extract:“Setup.exe”a PDF document
• Run “Setup.exe”
26
Blackberry MDS Studio: Installation (cont.)
• Accept all four license screensIncluding the “Bouncy Castle” License
27
Blackberry MDS Studio: Installation (cont.)
• Enter the file pathI usually choose the default one
28
Blackberry MDS Studio: Installation (cont.)
• Enter the registration data you received from theBlackBerry Web site
29
Blackberry MDS Studio: Installation (cont.)
• Enter a Uniform Resource Identifier (URI) you wish to associate with your applications
I used “CompanyName.com”
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!
31
Blackberry MDS Studio: Installation (cont.)
• Choose where you wish to create shortcuts
32
Blackberry MDS Studio: Installation (cont.)
• Confirm you wish to continue
33
Blackberry MDS Studio: Installation (cont.)
• Now sit back for 10-30 minutes whilst it installs
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!
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
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
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
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
39
MDS Demo
Demo
Blackberry MDS Studio
First look
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
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
42
First Application: Creating a New Project
• Choose “File, New Project”And choose “Quick Start Approach Wizard”
43
First Application: Creating a New Project (cont.)
• Now enter the URI of the Web service Applicationhttp://<server>/<database>/<webservicename>?WSDL
44
First Application: Creating a New Project (cont.)
• Select the web service(s) you wish to importIn our case, wejust choose thesingle function
GetJoke()
45
First Application: Creating a New Project (cont.)
• Finally, give the project a name
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”
47
First Application: Quick Fix (cont.)
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
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!
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
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
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
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”
54
First Project: Updating the Front Screen (cont.)
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”
56
First Project: Updating the Second Screen (cont.)
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
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
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
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
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
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
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:
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