I need to call a Java function from the worklight ADAPTER. I have followed the "adding Java to worklight adapter" document, but my problem did not get solved. I was not able to call the function.
The structure of the Java code that I have is as follows:
server/java
com.worklight.custonmode package name
loginfunction.java java
login java method in class loginfunction
From the adapter, I am calling:
function loginmodules(username, passwd) {
return {
result : com.worklight.custonmode.loginfunction.login()
};
}
I am getting the error as:
response [/apps/services/api/erLight/common/query] success: /-secure- {"responseID":"2","errors":["Ecma Error: TypeError: Cannot call property login in object [JavaPackage com.worklight.custonmode.loginfunction]. It is not a function, it is \"object\". (C%3A%5CUsers%5CADMIN%5CworkspaceM11%5CMobileClient%5Cadapters%5CAdapter/Adapter-impl.js#103)"],"isSuccessful":false,"warnings":[],"info":[]}/
worklight.js (line 1112)
Procedure invocation error. Ecma Error: TypeError: Cannot call property login in object [JavaPackage com.worklight.custonmode.loginfunction]. It is not a function, it is "object". (C%3A%5CUsers%5CADMIN%5CworkspaceM11%5CMobileClient%5Cadapters%5CAdapter/Adapter-impl.js#103)