Invoking an adapter for communicating to BP Server API
To invoke an adapter that talks to the BP Server API using JavaScript, complete the following:
function f1(){
var cls = jst.loadClass(adaptername, path);
var adpt = cls.newInstance();
adpt.methodname();
}f1()
In the above example, adaptername is the java adapter that talks to BP Server and path is the absolute directory path.
The next line, var cls = jst.loadClass; creates an instance of Class object. Once the Class object is obtained, you can retrieve an instance of the adapter class by calling:
var adpt = cls.newInstance();
You can invoke methods using the object adpt of the BP Server adapter class. Locate the adapter class in the OEBPS_HOME\ebmsapps directory.
JavaScripts, however, cannot invoke BP Server adapters. The solution is for the EJBClassLoader to load the JavaScript classes. The JavaScripts function invokes the adapter which calls BP Server using the following code, similar to the above:
<PreFunction>
function fl(){
var cls = jst.loadClass("readOnly");
var ro = cls.newInstance();
ro.read();
fl()
</PreFunction>
In the above prefunction, the class object of readOnly (This is the adapter that talks to BP Server) is called by:
var cls = jst.loadClass("readOnly");
Once the class is obtained, the new instance is called by: