Hi
We are consuming a webservice from our IBM Domino 9 server.
I have connected it to a website, using lotus script agents, which uses LS2J to use some java classes placed in a java script library that does the actual job of consuming the webservice.
This all works but its slow - like 5-10 secs to make a webservice call.
The reason its slow is that every time the user clicks a search on the website, i call a lotus script agent, which then reads the configuration files and opens the connection to the webservice server, any subsequent calls only takes about 1 sec but only within the agents scope.
I still need to read the configurations the first time someone activates the search, but i would like to reuse the open connections on subsequent calls to save time. I have made a singleton class instead of the contructor and it seems to work, but it still reads the configurations every time the search is clicked. I was hoping that a singleton class would be attached to the HTTP tasks JVM and that it would be accessible after the first search.
Is that possible somehow?
Heres my singleton java code (stripped for some code)
public class Client {
private static Client me = null;
private Client() {
super();
try {
if (applicationContext == null) {
String configs = new String[4];
configs[0] = “file:/applicationContext-resources.xml”;
configs[1] = “file:/applicationContext-security.xml”;
configs[2] = “file:/applicationContext-ws-client.xml”;
configs[3] = “file:/ws-client.xml”;
applicationContext = new ClassPathXmlApplicationContext(configs);
}
} catch (Exception e) {
e.printStackTrace();
}
}
public static Client getInstance() {
if (me == null) {
me = new Client();
}
return me;
}
}
And my Lotus Script code calling the singleton class:
Public Class Test_client
Private jSession As JavaSession
Private jError As JavaError
Private objClass As JavaClass
Private obj As JavaObject
Public Sub New()
Set jSession = New JavaSession
Set objClass = jSession.GetClass(“Client”)
Set obj = objClass.Getmethod(“getInstance”, “()Ldk/wsclient/Client;”).Invoke(nothing)
End Sub