This tutorial contains detailed information about how can we use IBM® Lotus® Domino® Web Services (using Web Services Provider) in Java® Development. Using this sample application, we’ll able to do full-text search in the Domino Directory using Web Services (Provider) technology. Just we’ll need to enter search keyword and click to Search button. That’s all. Let's start our sample application.
In this part of tutorial will use following Development IDE & Tools.
Now we will create Lotus Notes Application to begin our tutorial. In the application (a.k.a. notes database) we’ll create new Web Services Provider design element. BlackBerry® application invoke this web services and gets the results.
Create new Lotus Notes Application using following information :
Also you can create your application any where in your server data directory. Web Services URL seems like that : http://<hostname>/<nsf db file path>/<web service name>?wsdl

Picture 1 - Create Database
Create Web Services Provider design element using following information :

Picture 2 - Domino Designer IDE - Web Service Providers

Picture 3 - New Web Service Provider (SearchPeople)


Picture 4 - Web Service Properties
Create Web Services Provider design element using following information :
Add following codes to the Declarations event of Web Service.
%REM
############################################################
WEB SERVICES : SearchPeople
DEVELOPER : Ferhat BULUT
WEB SITE : www.bestcoder.net
E-MAIL : ferhat@bestcoder.net
CREATED DATE : JANUARY 13, 2010
MODIFIED DATE : DECEMBER 28, 2010
COMMENTS
Bu WebService BestCoder.NET sitesinde yayınlanmak üzere blackberry mobil uygulama geliştirme örneği için hazırlanmıştır.
############################################################
%END REM
REM Declaration of global variables accessible from all parts of the Web service.
Class Person
Public NameSurname As String
Public NoteID As String
End Class
Class PersonList
Public Persons () As Person
End Class
Class SearchPeople
Public Function Search ( Key As String ) As PersonList
On Error Goto ErrorHandler
Dim oSession As New NotesSession
Dim oDatabase As NotesDatabase
Dim i As Integer
Dim strSearchString As String
Set Search = New PersonList
REM Debug
Print "WebService : SearchPeople - Function : Search - Start"
REM Get Current Database
Set oDatabase = oSession.CurrentDatabase
Dim oNamesDB As NotesDatabase
Dim oPersonCollection As NotesDocumentCollection
Dim oPersonDoc As NotesDocument
Dim oNNPerson As NotesName
REM Get Domino Directory Database
Set oNamesDB = oSession.GetDatabase ( oDatabase.Server, "names.nsf", False )
REM Create FT Search String
strSearchString = {[FORM] CONTAINS "Person" AND [FULLNAME] CONTAINS "} + Key + {"}
Set oPersonCollection = oNamesDB.FTSearch( strSearchString, 10, FT_SCORES, FT_FUZZY )
REM If collection is empty go to exit
If oPersonCollection.Count = 0 Then
Redim Search.Persons ( 0 )
Set Search.Persons ( 0 ) = New Person
Search.Persons ( 0 ).NameSurname = "NOT_FOUND"
Search.Persons ( 0 ).NoteID = ""
Gosub Finish
End If
REM resize person array with the size of collection
Redim Search.Persons ( oPersonCollection.Count - 1 )
i = 0
Set oPersonDoc = oPersonCollection.GetFirstDocument
Do While Not ( oPersonDoc Is Nothing )
REM Create person class in person array
Set Search.Persons ( i ) = New Person
Set oNNPerson = New NotesName ( oPersonDoc.FullName ( 0 ) )
Search.Persons ( i ).NameSurname = oNNPerson.Abbreviated
Search.Persons ( i ).NoteID = Cstr ( oPersonDoc.NoteID )
Set oPersonDoc = oPersonCollection.GetNextDocument ( oPersonDoc )
i = i + 1
Loop
Finish:
REM Debug
Print "WebService : SearchPeople - Function : Search - End"
Exit Function
ErrorHandler:
REM Debug
Print "WebService : SearchPeople - Function : Search - Error Description : " + Error$ + " - Error Line Number : " + Cstr (Erl)
End
End Function
End Class
Save and close. Our webservice is ready.
But don’t forget to check the values of some field on your Lotus Domino server configuration document as following :
Lets check our Web Service is running ?

Picture 5 - Web Service Provider Browser Preview
In this part of tutorial will use following Development IDE & Tools.
Note : Sun Java Wireless Toolkit 2.5.2_01 for CLDC is 32-bit application. So Java (JDK) on your computer have to be 32-bit. I had a problem during stub generation process with Sun Java Wireless Toolkit (32-bit) and JDK (64-bit).
Check your webservice is running. Type the Web Service url to address field. Webservice url seems like that : http://<local computer ip or host name>/<Db file path>/PeopleSearch?wsdl and press to Enter.
Open the Sun Java Wireless Toolkit application using Utilities link.

Picture 6 - Utilities > Stub Generator
Select Stub Generator and click to Launch button.
Picture 7 - Run Stub Generator
Enter necessary information in Stub Generator Dialog screen.
Select OK button to finish process.
If you got an error, please check this list to solve problem :
If everything is fine, Stub Generator shows a dialogbox like this. “Stub Generation Complete”
After that close Stub Generator application. Goto C:\SearchPeople directory. Look at files. You will see 8 files.
You need these *.java files to begin BlackBerry Java Application Development part of the tutorial.

Picture 8 - Stubs - Output Files of Web Service
Open your BlackBerry Java Plug-in for Eclipse v1.1.2 application.
Create new BlackBerry Project.

Picture 9 - New BlackBerry Project
Enter a name of project. I entered “SearchPeople” for my project’s name. And click to Finish button.

Picture 10 - Sample BlackBerry Project - SearchPeople
Our project looks like following pciture in Package Explorer window.

Picture 11 - SearchPeople Project
Now we need to add our java files to project.
Create a Package element under src folder with the name “com.blackberry.lotus”
Now import Java stub files to this package.
Picture 12 - Import Stub Files in Project
Now our application looks like :
Picture 13 - Project Files Preview
In this part of tutorial will use following Development IDE & Tools.
We created stub files using Java Wireless Toolkit. Imported into our BlackBerry Project.
Our project files are listed below. I tried to write a detailed comments into source files. If it is not enough for you, please donot hesitate to contact with me from ferhat@bestcoder.net.
Before starting to development, check the wsdl url from Common.wsdlURL variable. New value have to be your sample Lotus web service provider url.
Picture 14 - Common.wsdlURL Variable

AboutScreen.java : About screen file of application
Common.java : Using for common variables
GlobalNotificationScreen.java : Additional screen. Using to show general notifications, errors, etc.
ListFieldExt.java : Extended ListField class. I don’t remember the author. It was public code.
PERSON.java : Web Service File – from Stub Generation. Includes user details.
PERSONLIST.java : Web Service File – from Stub Generation. Includes users using PERSON class.
SearchPeople_Stub.java : Web Service File – from Stub Generation
SearchPeople.java : Web Service File – from Stub Generation
UiAppWelcome.java : Entry Point of the Application
SplashScreen.java : Additional screen for Splash
SearchPeopleScreen.java : Main screen for our demo application
SelectPersonScreen.java : Additional screen.
Also we covered multiple language support using resource files. And also it is related to device language. The application is very clever, automatically identify language and shows application in this language.
SearchPeople_en.rrc : Resource File for English language
SearchPeople_tr.rrc : Resource File for Turkish language
SearchPeople.rrc : Resource File
SearchPeople.rrh : Resource File
We covered following functionallities in this tutorial.
If you have any question, please donot hesitate to contact with me from ferhat@bestcoder.net.
Thanks in advance
Ferhat BULUT
Blog : http://www.bestcoder.net
Twitter : BestCoder81