3

I need to make a call to a HTTPS based service, from LotusScript.

Previously, I have used:

Set http = CreateObject("Msxml2.ServerXMLHTTP.3.0")

But now we have moved the application to a Domino server on Linux.

My first attempt to replace this code, was to call the shell function, with a call to curl. It works, but the shell function always return an integer, so the response is transferred back to LotusScript as temporary files. The curl solution is rather slow. Approximately 2 seconds response time is too long. The MsXml solution responded in 170 ms!

Then, to get rid of the temporary files, I tried using libcurl, but it requires a callback method to receive the response. It is my understanding that LotusScript is unable to pass callback methods to native methods.

The next attempt was using LS2J to make the HTTP request from Java. It worked, but with a response time of more than 6 seconds, it is useless for our application.

How can I call an external API from LotusScript on Linux, with descent performance?

@IBM: Can we please have a HTTP client and a JSON parser in LotusScript?

Renaud Tarnec
  • 79,263
  • 10
  • 95
  • 121
Bo Frederiksen
  • 2,087
  • 1
  • 14
  • 21
  • 1
    Strange. I used LS2J and it's fast enough. In fact, we never checked the speed, no need. Also, the JSON library I use in LS is fast enough. It's all on OpenNTF as far as I know. What did you use? Or could you share some of your code? – D.Bugger Dec 30 '17 at 08:37
  • Link to HCL's documentation of the new class: https://help.hcltechsw.com/dom_designer/11.0.1/basic/H_NOTES_HTTPREQUEST_CLASS.html – Bo Frederiksen Oct 28 '20 at 20:59

2 Answers2

1

LotusScript can declare and call functions in external C libraries, which I suppose you already know from trying to use libcurl. What you can do is write your own C library which acts as a front-end to libcurl. Your C code will have to provide the callback and wait for it to handle the result so you can pass it back to your LotusScript.

Richard Schwartz
  • 14,463
  • 2
  • 23
  • 41
  • 1
    I have been thinking along those lines, but I don't have any experience with coding C libraries on Linux. Do you by any chance have any "pointers"? ;-) – Bo Frederiksen Jan 02 '18 at 11:34
  • It has been a long time since I worked with a team that did C coding in a Domino/Linux environment. If I had to get some work done myself right now, the person I would contact is Daniel Nashed. I don't believe he has an account on this site. His info is here: http://blog.nashcom.de/nashcomblog.nsf/dx/contact.htm. Note that he is a consultant and does not necessarily give advice for free. – Richard Schwartz Jan 02 '18 at 13:13
  • 1
    We got a friend of ours to make a wrapper: https://github.com/iDoerDK/CurlWrapper Notice: Domino 10 will ship with some kind of HTTP client. :-) – Bo Frederiksen Sep 24 '18 at 10:11
1

I'd suggest to get rid of LS and do what you need to do in Java. In Java you have native libs for http. Or you can use callbacks from C when you use JNA

Dietmar Höhmann
  • 397
  • 3
  • 10
  • Thanks for your suggestion. I cannot get rid of LotusScript, just like that, since we already have a lot of business logic in LS. I'm also concerned about the response time of Java based web agents. – Bo Frederiksen Jan 02 '18 at 11:30