Try OpenEdge Now
skip to main content
Application Developer's Guide
Developing an application : Using JavaScript in a workstep : Integrating JavaScript : Invoking an adapter for communicating to BP Server API
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();
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:
         function fl(){
             var cls = jst.loadClass("readOnly");
             var ro = cls.newInstance();
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:
var ro = cls.newInstance
Now you can invoke methods on the instances.