Hello again,
We are starting to develop blackberry mobile application. Our mobile application will be developed based on the domino webservice technology. So we are starting to develop our sample webservice.
We will use following development IDE & tools during our tutorial.
Now we will create lotus notes application to develop our webservice.
- Title : Search People
- DB File Name : searchpeople.nsf
- Other settings : Default
- Add anonymous entry to ACL with Author & Create Document property.
Also you can create your database at any where in your server data directory. Webservice url seems like that : http://<hostname>/<nsf db file path>/<web service name>?wsdl
01. Create Database
Create webservice design element.
-
Open your database at designer
-
Expand Code \ Web Service Providers
-
Click to New Web Service Provider button.
-
Name : SearchPeople
-
Type : LotusScript
-
Click to OK.
02. Domino Designer IDE
03. Webservice (SearchPeople)
04. Web Service Properties
Web Service Properties (03. Webservice – Basics Tab & 04. Web Service – Advance Tab)
-
Tab : Basics
-
Name : SearchPeople
- PortType Class : SearchPeople
-
-
Tab : Advcance
-
Options \ Programming model : RPC
-
SOAP Message Format :Doc/literal
-
Include operation name in SOAP action : Checked
-
Port type name : SearchPeople
-
Service element name : SearchPeopleService
-
Service port name : Domino
-
Add following codes to the Declarations event of webservice.
%REM
############################################################
WEB SERVICES : SearchPeople
DEVELOPER : Ferhat BULUT
WEB SITE : www.bestcoder.net
E-MAIL : ferhat@bestcoder.net
CREATED DATE : JANUARY 13, 2010
MODIFIED DATE : -
COMMENTS
Bu WebService BestCoder.NET sitesinde yayınlanmak üzere blackberry mobil uygulama geliştirme örneği için
hazırlanmıştır.
SIGNATURE
..:: Dream It, Code It ::..
############################################################
%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 )
Search.Persons ( 0 ).NameSurname = ""
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 donot forget to configure your domino server settings :
- Check Http task is running
- Add Signer of webservice to Security \ Programmability Restrictions \ Sign or run unrestricted methods and operations field.
- Internet Protocols \ Domino Web Engine \ Web Agents and Web Services \ Run web agents and web services concurrently? value must be Enabled
- Give an integer value to Internet Protocols \ Domino Web Engine \ Web Agents and Web Services \ Web agent and web services timeout field. Maybe 60 seconds
Lets check our webservice is OK ?
Open your browser.
Write to address field. http://<local computer ip or host name>/<Db file path>/PeopleSearch?wsdl and hit to Enter. You will see following picture in your browser.
OK. Web will develop client side of our tutorial at Part 2. We will use Eclipse with Blackberry Plugin IDE. See you next time.
Great Tutorial . I am following your article. Waiting for Tutorial 2
Hi Abeish,
Thank you so much. Nice to see my blog post is being read 🙂
I am trying to find a free time to complete my tutorial. Within a few days i will add Eclipse part of this tutorial.
See you
It is really a good article. Waiting for the client side(Blackberry) sample code.
Thanks for this information it really useful for me to know. Thanks Vinay from BlackBerry Application Development
Team, KryptonSoft, India
Indeed a nice post! I am also associated with the Web design, Mobile apps development India, blackberry apps developer India and love to enjoy reading fresh posts on this subject. I would like to thank you for writing this post and now I am your regular reader as I have subscribed your blog in my RSS reader.