Cool! I just saw that I have received an e-mail from Torben Bang with some C API code to get at the LotusScript for the web services in a Domino 7 database. I haven’t had a chance to look at the code yet but it sure sounds promising. Thanks!!
Domino 7 web services woes
I really want to expand LotusScript.doc so it can document web services in Domino 7 written in LotusScript. For all the other design elements (forms, views, agents etc.) I can get the LotusScript source code via DXL but this isn’t possible for web services. The DXL only contains a number of elements containing something that looks like Base64 encoded data (<rawitemdata type=’14’>-elements).
I noticed however that the design element itself has a $FILE item with an attachment called %%webserviceresource%%.jar. Guessing that the JAR-file contained the code I tried detaching it and expanding the JAR-file via LotusScript.
Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim e As Variant
Set db = session.CurrentDatabase
Set doc = db.GetDocumentByUNID("239E4CB31E6F407FC12570A00049AE3A")
Set e = doc.GetAttachment("%%webserviceresource%%.jar")
Call e.ExtractFile("d:lekkim.jar")
End Sub
But no. The JAR-file only contains a WSDL document a property-file and some binary stuff (see below to a directory listing).
I also tried decoding the Base64 encoded data from the DXL document and I found something that looks like my web service LotusScript code. I removed a header of some sort with some non-ASCII characters from the listing below.
'++LotusScript Development Environment:2:5:(Options):0:74 Option Public Option Explicit '++LotusScript Development Environment:2:5:(Forward):0:1 Declare Public Class Lekkim '++LotusScript Development Environment:2:5:(Declarations):0:10 Public Class Lekkim Public Function GetName(user As String) As String End Function End Class
The above is of cause parsable but it would be easier if I would simply get at the code.
If anyone knows how to get at the LotusScript of a web service without decoding the Base64 data from the DXL please let me know. Thanks.
LotusScript.doc well received
As you might know LotusScript.doc has been released and I’m very pleased that I’m seeing a fair number of downloads without any promotion. Very encouraging.
Once the article in The VIEW is out I expect it to pick up further.
My personal experience after using LotusScript.doc in production for internal code and for customer development for a couple of months is very good. Once all projects is automatically being documented developers start adding more and more code comments which further enhances the benefit. I have even had developers come up to me and say how they started using code from other projects. Sweet.
How I would love if IBM Lotus would promote OOP in LotusScript
In the Lotus Support RSS feed I saw a technote about what to do if the you need an array with an index larger than an Integer (32767). Their suggestion is to use a List with string keys!! A List!!
Why not promote the OO features of LotusScript and provide an ArrayWrapper class that simply handles multiple arrays internally and a Long for the counter? I know it would have limitations such as the fact that you cannot use it in Forall statements but still… An object would be so much more elegant. I know OOP is more advanced but if you need such large arrays you really should know what you are doing.
I’m baffled – why not use the opportunity?
Technote 1221020: How to use a list to get around the Array size limit
LotusScript.doc Lotusphere submission
My abstract submission for a Lotusphere 2006 session about LotusScript.doc was not accepted. I just received an e-mail from the track owner. Major bummer since I think it would have been a great session and a good venue to promote code documentation and object oriented design and development…
I will have to cry myself to sleep… 🙁
Submatches in RegExp from LotusScript
As previously described you can use the Visual Basic Script RegExp component for regular expression matching on Windows. The component supports backreferencing and submatches which makes it easy to extract the results from pattern matching from the text. No more Instr’ing and Mid’ing to extract the information.
The below example shows you how to extract the id from a URL with an id-parameter. The output from the example will be two messageboxes stating:
- We matched: http://www.example.com?id=123
- Submatch 1: 1234
Sub Initialize
'declarations
Dim regexp As Variant
Dim rc As Integer
Dim text As String
Dim submatch_count As Integer
'set text
text = |This is a random link http://www.example.com?id=1234 where we want to extract the id.|
'create object
Set regexp = CreateObject("VBScript.RegExp")
'make pattern matching case insensitive
regexp.IgnoreCase = True
'set pattern
regexp.Pattern = |http://.*?id=([d]*)|
'test pattern
Dim matches As Variant
Set matches = regexp.Execute(text)
Forall m In matches
Msgbox "We matched: " + m.Value
submatch_count = 1
Forall submatch In m.Submatches
Msgbox "Submatch " & submatch_count & ": " & submatch
submatch_count = submatch_count + 1
End Forall
End Forall
End Sub
LotusScript.doc released
LotusScript.doc has been released and is available for download from the LotusScript.doc website…
A special thank to those who have helped me test out the application, submitted code or patches.
LotusScript.doc article draft is going back to The VIEW
I sent the article draft back to my editor at The VIEW yesterday and I must admit I was a little surprised as to the number of corrections she had made and that I had to look at. I ended up writing quite a lot of new content both clarifying existing points and making new ones.
It will be exciting to hear her thoughts on the added content.
LotusScript.doc release candidate 2
Release candidate 2 is just about to be released. The release contains a number of big improvements which include support for %INCLUDE files (also if nested), support for Page design elements and support for the Shared Actions design element.
Refer to to the changelog below for details on all improvements and bug fixes.
Thanks to all submitting comments, bug reports etc.
CHANGELOG – Release candidate 2
Fixes
- Change how a REM-section is recognized to avoid problems with TAB-characters etc. efter the %REM / %END REM (Lukas Martin).
- Added design element “namespace” handling to avoid generating the same key for different design elements with the same name (e.g. a form and an agent). (Chad Schelfhout)
- Fix problem with page titles and generating four html documents per form, view, agent and script library.
- Fix issue where name of function contained the returntype as well when the function didn’t contain any parentesis’ (e.g. Public Function MyFunction As Boolean)
- Properly handle arguments to class properties (James White).
Improvements
- Show known sub-classes for a particular class in the documentation.
- Show icon in view for Configuration documents included in background run.
- Provide action to go to the Documentation Index on the web.
- Sort list of design elements alphabetically when selecting subset of design elements in Configuration document (Torben Bang).
- Improved @-parameter parsing (tab/spaces)
- Add support for @author parameter
- Add support for Page design element.
- Add support for Shared Actions design element.
- Support for %INCLUDE files incl. nested %INCLUDE files (James White).
Known sub-classes in LotusScript.doc
When I wrote that I wouldn’t be adding more features before the release I must have been dreaming… I just couldn’t resist adding code that make it possible to see the known sub-classes of a particular class when browsing the documentation.
This makes it much easier to navigate to the sub-classes of an “interface-style” super-class as shown above where “SaveDecorator” is actually just describing the interface for the “NoAttachmentsSaveDecorator”- and “ReferencesSaveDecorator”-classes.
All this information in just 10 lines of added code – I love objects!!