I want to create a log for all my webservices. I have the log in java, it works. I want to do the same thing in Lotus Domino using the java's class I do with LS2J class.
It works to compil my java class and the ls2j code. When i try to call this java in lotus it works ! But i have a null value when i call it in java with the getter !
Class GetAllDocuments
Private logDTO As LogWSDTO
Private objectJavaA As JAVAOBJECT
Private a As LogWebService
Private db As NotesDatabase
Public Sub New()
Set logDTO = New LogWSDTO()
Set a = New LogWebService()
Set objectJavaA = a.getJavaObject
End Sub
Public Function GetAllDocuments()
call logDTO.setNomBaseNotesWS(db.FileName)
objectJavaA.setLog(logDTO.getJavaObject())
End Function
I have a class in lotus which called my java class :
UseLSX "*javacon"
Class LogWSDTO
sessionJava As JAVASESSION
classJava As JAVACLASS
objectJava As JAVAOBJECT
methodJava As JAVAMETHOD
Public Sub New()
Set sessionJava = New JAVASESSION
Set classJava = sessionJava.GetClass("com.pasquier.DTO.WS/LogWSDTO")
Set objectJava = classJava.CreateObject
End Sub
Public Function getNomBaseNotesWS()
Set methodJava = classJava.GetMethod("getNomBaseNotesWS","()Ljava/lang/String;")
getNomBaseNotesWS = objectJava.getNomBaseNotesWS()
End Function
Public Sub setNomBaseNotesWS(nomBaseNotesWS As String)
Set methodJava = classJava.GetMethod("setNomBaseNotesWS","(Ljava/lang/String;)V")
objectJava.setNomBaseNotesWS(nomBaseNotesWS)
End Sub
In java : I can't have to have a session, this is always null
public void setLog(LogWSDTO log) {
System.out.println("entrée java");
System.out.println(log.getNomBaseNotesWS()); <== I Have the data !!
this.logDTO = log;
if (session == null)
{
System.out.println("alert !");
session = session.getSession(); <== it doesn't compil i pass it in comment to test
System.out.println("alert !");
}
System.out.println("Session :" + session );
}
the result is :
"entrée java"
"GetAllDocuments"
"alert!"
"alert!"
Session :"null
UPDATE 2 :
I modify my code, I take with an agent the token of my session LotusScript, I put in myLogBean. In java, I try to create a new session :
public void setLog(LogWSDTO log) {
this.logDTO = log;
String sessionParam = logDTO.getSessionParam();
if (session == null)
{
try {
session = lotus.domino.NotesFactory.createSession("myhost",sessionParam);
} catch (NotesException e) {
// TODO Bloc catch auto-généré
e.printStackTrace();
}
System.out.println("alert !");
}
System.out.println("Session :" + session );
}
And the result is :
NotesException: Could not get IOR from Domino Server:
http://myhost/diiop_ior.txt
at lotus.domino.NotesFactory.requestIORPlain(Unknown Source) at lotus.domino.NotesFactory.requestIORUsingArgs(Unknown Source) at lotus.domino.NotesFactory.getIOR(Unknown Source) at lotus.domino.NotesFactory.createSessionC(Unknown Source) at lotus.domino.NotesFactory.createSession(Unknown Source) at com.pasquier.launcher.LogWebService.setLog(LogWebService.java:64) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) at java.lang.reflect.Method.invoke(Method.java:611) at lotus.domino.JavaConnectInvoker.invoke(Unknown Source) at sun.reflect.GeneratedMethodAccessor3780.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) at java.lang.reflect.Method.invoke(Method.java:611)
I try to change some point in config of the server :
In the Server document, I go to the Internet Protocols tab, then the DIIOP tab. I specify the Internet host name for the server in the Host name/Address field. I go to the Internet Protocols tab, HTTP tab, and R5 Basics tab. Then I set the "Allow HTTP clients to browse databases" field to Yes.
I add the task DIIOP and it is'nt the same error :
NotesException: Invalid user name/password
But I put the token ? what I do wrong ?
An idea ?
logDTO.setDateHeureDebutWS(dt)
tocall logDTO.setDateHeureDebutWS(dt)
– user784540call
directive as I mentioned in previous comment? – user784540logDTO
– user784540logDTO
refers to an instance of classLogWSDTO
and there's only one methodsetDateHeureDebutWS(dateHeureDebut As String)
As you can see it takes a string parameter, and you are trying to pass aNotesDateTime
parameter value. – user784540