Now we are finishing our Blackberry development tutorial. It take so long i know but time is limited for me 🙂
Sorry for this situation.
First, I want to share links of previous posts.
Now Part 3 is coming …
Blackberry de uygulama geliştirme örneğimizi bu bölüm ile bitiriyoruz. Tabi ki şimdilik 🙂 Yeni konular elbetteki gelecektir. Bu bölümü bitirmem uzun zaman aldı farkındayım maalesef, bu konuda üzgünüm ama zaman hepimiz için çok kısıtlı biliyorsunuz.
Kusuruma bakmayın diyerek son bölüme başlıyorum 🙂
Öncelikle, eski bölümlerin linklerini sizlerle paylaşmak istiyorum. (Linkler yeni pencerede açılacaktır.)
Şimdi Bölüm 3 …
Album: Search People – Album
Now i am using updated Eclipse platform. Eclipse 1.1.2 is available. I don’t know is there newer version right now but i used this version during development. But i think, all codes are backward compatible.
We will use following development IDE & tools during our tutorial.
- Lotus Domino 8.5.1
- Lotus Domino Designer 8.5.1
- Eclipse 1.1.2 (With this version, you have to download OS plugins (4.5.0 or etc) from Available Software Sites screen using http://www.blackberry.com/go/eclipseUpdate/3.5/java)
- BlackBerry Email and MDS Services Simulator Package v4.1.4 (Download)
- Sun Java (TM) Wireless Toolkit 2.5.2_01 for CLDC (Download)
Our sample Web Service Provider (SearchPeople) updated.
%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. 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 ) 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
Album: Search People – Album
———————
Artık yeni bir Eclipse platformu kullanıyoruz. O kadar zaman geçti ki yeni versiyon bile çıktı ya 🙂 Eclipse 1.1.2 versiyonunu kullanıyorum şuan. Ancak yeni versiyon çıktı mı açıkcası araştırmadım, ihtiyaç da duymadım.
Aşağıda listelediğim geliştirme ortamlarını ve araçları kullandık/kullanacağız.
- Lotus Domino 8.5.1
- Lotus Domino Designer 8.5.1
- Eclipse 1.1.2 (Bu versiyon ile farklı bir OS için plugin eklemek için Window > Settings > Available Software Sites bölümünde http://www.blackberry.com/go/eclipseUpdate/3.5/java linkini kullanıyoruz. Bu linki kullanarak farklı OS ler ile alakalı Plugin indirilebilmektedir. Ben 4.5.0 ı indirdim ve bu versiyonda geliştirme yaptım mesela.)
- BlackBerry Email and MDS Services Simulator Package v4.1.4 (Download)
- Sun Java (TM) Wireless Toolkit 2.5.2_01 for CLDC (Download)
Örnek Web Service Provider elemanımızın kodlarında birkaç küçük geliştirme oldu. NSF i sayfanın en altında linkler bölümünde bulabileceksiniz.
%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. 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 ) 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
Projemizde aşağıdaki dosyalar mevcuttur. Kodlarda mümkün olduğu kadar çok ve açık ifadelerde yorum (comment) kullanmaya çalıştım.
Eğer yetersiz gelirse ben buradayım, yazmaktan çekinmeyin lütfen 🙂 Hatta yazınnn yazınnn, hiç follower ım yok yahu 🙂
Hi Ferhat,
Good post on this.
I have developed a Blackberry Java application that connects to Lotus Notes Web service, using the same principle as described in your post.
Default and Anonymous has “No Access” to the Lotus Notes database. So, first, I have put the HttpConnection to authenticate user to the database. Once authenticated, it will then call a specific function in the Web Service.
It has been working if it connects to Lotus Notes Web Service in our development server. However, the connection does not work in our production server.
We have investigated into this issue. What we find is that the setting of Session Authentication in domino server document is disabled in development server, but enabled (selected as Single Server) in production server.
As the Session Authentication is set to “Single Server” or “Multiple Server”, the send/receive call to the Web Service returns an error : “either SOAP Envelope or SOAP body is missing”.
With this option disabled, user does not need to authenticate for send/receive call to the web service. And with this option enabled, each send/receive call requires authentication.
Do you know a way to connect from the Blackberry Java app to the Lotus Notes Web Service, where the Session Authentication is enabled in the domino server? Any directions on this would be much appreciated.
Thank you.
Best Regards,
Melissa Ngatiman
Hello Melissa,
I didn’t find solution yet about http authentication using jsr 172. I mean, using generated stub classes etc. I don’t know maybe it doesn’t support basic authentication, so I think, some people developed ksoap package.
If I needed to make authentication with server, i used standart http connection methods and basic authentication. It’s very complex, hard to write -you know post xml and get xml and parse it- but it works. Google it “httpgetandpostdemo” keyword. You will see 1 result -forum post- in this post, you will see HttpLibrary.zip file. You can use it as reference to make http connection. I am writing on mobile, so i didn’t write exact url. Maybe it can be solution for you. This zip file includes very good classes. You can test it directly from your device.
You can use http get and post with your lotus web service providers and also for your agents, views etc.
hope it helps.
Regards
Ferhat
Hi,
I am trying to access a URL, using Connector class, i got connection but when i used connection.openInputStream, applcation gets hang for sometime and nothing is called what written after that line.
I am using BlackBerry Java Plug-in 1.3.0 for Eclipse.
Please help.
Merhabalar, blackberry uygulama geliştirme için Türkçe kaynak neredeyse sıfır. Bu yazı türkçe fakat öncekiler ingilizce, java bilen biri eminim ingilizce dökümanıda rahatlıkla anlayabilir fakat bilmeyen için bberry uygulama geliştirme konusuna giriş yapmak isteyen kişiler için ne yazık ki anlayabileceği seviyeden değil. Umarım en kısa sürede türkçe makalelerde hazırlarsınız.
teşekkürler
Merhaba,
Aşağıdaki URL den bu makalemin türkçesine ve ingilizcesine erişebilirsiniz.
Türkçe :
http://lotusturkiye.org/LotusQuickr/lugtr/Main.nsf/h_Toc/4df38292d748069d0525670800167212/?OpenDocument#{type=0&unid=98EF9668DEC7249AC225785A005D70BA}
İngilizce :
http://supportforums.blackberry.com/t5/Java-Development/Tutorial-How-to-Use-Lotus-Domino-Web-Services-in-Java/ta-p/732837
Selamlar