Discovering Notes 8: Web service enabled script libraries

In a recent edition of the newsletter Julian listed some of the new AppDev features of Notes 8. Among them were the new web service enabled script libraries.

Basically what you do is simply pointing a script library to a WSDL file and some stub code is automatically generated for you. Then when you use the script library from agents etc. the methods you call will automatically be forwarded to the actual web service without you worrying about SOAP, HTTP etc. It actually is that easy!

To test it out I found an example of a public stock quote web service ( and used that for an example.

Start by creating a new empty LotusScript script library. Now click the “WSDL…” button at the bottom of Domino Designer and simply select “Import WSDL”. Now paste the above URL into the filename field and click Open (it’s really nice that you can actually simply paste the WSDL URL into the dialog instead of first saving the WSDL to a local file). Now your script library should look like this:

%INCLUDE "lsxsd.lss"
Const n4 = "http://www.webserviceX.NET/"
Class StockQuoteSoap_n4 As PortTypeBase

  Sub NEW
    Call Service.Initialize ("HttpWwwWebserviceXNETStockQuote", _
    "StockQuote.StockQuoteSoap", _
    "", _

  End Sub

  Function GetQuote(symbol As XSD_STRING) As XSD_STRING
    Set GetQuote = Service.Invoke("GetQuote", symbol)
  End Function

End Class

Now save the script library and call it “Stock quote”.

Create a LotusScript agent and in Options import the script library (Use “Stock quote”). Now we want to call the script library which is done using code like this:

Sub Initialize
  Dim ws As New NotesUIWorkspace
  Dim sq As New StockQuoteSoap_n4()
  Dim symbol As String
  Dim symbols(2) As String
  symbols(0) = "IBM"
  symbols(1) = "JAVA"
  symbols(2) = "AAPL"
  symbol = ws.Prompt(4, "Stock symbol", _
    "Select stock for quote...", "", symbols)
  If symbol = "" Then
    Exit Sub
    Print "Using symbol: " + symbol
  End If

  Dim sh As New XSD_STRING()
  Call sh.setValueFromString(symbol)
  Set sh = sq.GetQuote(sh)
  Msgbox sh.getValueAsString()
End Sub

Now when you run the agent and you select a stock symbol it will actually automatically go out to the web service, get the quote and return it to the caller. All this with the code I just showed you. Nice!

Stand by for a post on the nitty, gritty details…

13 thoughts on “Discovering Notes 8: Web service enabled script libraries”

  1. Hello,

    Im currently trying to wire an database agent and a Sidebar plugin together. I dont know why but I somehow found out that it should work with A WSDL file ( like in composite applications).

    Can you tell me if i’m at the good route or that i have to think the complete oppsite way?


  2. As a java developer i’m completely new to the Lotus notes / domino environment and alot of things are still a big puzzle to me. At the company i work there is need for a Java library that can be used in a database which can access plugins from the new Lotus notes 8 client.

    Thus far I havent found any information regarding this manner. Is this because its just not possible or?


  3. While composite applications use WSDL files to wire they are not in fact Web Services. So an external WSDL will probably not work at all.

    Nice, short and good demo lekkim.  🙂  The creation of Java Webservices is also very easy, although a bit more verbose.


  4. Thank you for this really clear “how to”.
    After using this, I needed to parameterize the Url ( in your example). I got the confusing message “The Script Libarary cannot be saved. The changes made to the generated source code would prevent its proper operation.” when saving.
    Fortunately it’s possible to change the NEW like this (and save):

    Sub NEW(Service_URL as string)
        Call Service.Initialize ("HttpWwwWebserviceXNETStockQuote", _
        "StockQuote.StockQuoteSoap", _
        Service_URL, _
    End Sub

    Maybe trivial, but nevertheless, I share this with you.


  5. Hi, I get "Not a Sub or Function Name: INITIALIZE" when I try to save. What am I doing wrong? I also tried the gentleman’s example above with the same result. I checked and "lsxsd.lss" is in the proper place and being imported…


  6. Hello

    I tried the above and it seems to work BUT, I keep getting an error Web Service Stock Quote Soap GETQuote error, Error connecting to on port 80, remote server no longier responding

    hopefully you can help me with this ? Is there a simple setting i need to change in the server document ?


  7. Hi,

    Thanks a lot for the post, u are simply great!!!!!!!!!!!!!!!!!!!!!!

    I invested my three days and the finally I found your solutions and implemented your solution in my project. Do you have any idea how to to implement same in Domino 7?

    Thanks again!!!!



  8. What about SSL? Web service I will use requires a certificate on the client side. How to do it in the agent that will run every day on the server?


  9. What about SSL? Web service I will use requires a certificate on the client side. How to do it in the agent that will run daily on the server?


  10. Hi, I tried your example and I get error: "SET may only be used on class instance assignments" in my Agent script in line "<span style="font-size: 13.333333015441895px; line-height: 13px;">Set sh = sq.GetQuote(sh)</span>" and I can’t save it. 

    What’s wrong with it?




Comments are closed.