Calling Appeon Server open interfaces via EJB component

Appeon Server open interfaces (methods) in EAServer 6.x, JBoss, JEUS, WebLogic and WebSphere are encapsulated in a standard EJB component named OpenInterface that is included in the ASInterface package. To invoke the open interfaces in PowerBuilder, you need to follow the instructions of how to call Appeon EJBObject. Details refer to the section called “Calling EJB Component”.

Following is general step guide to write code in PowerBuilder to invoke the open interface.

Step 1: Load Appeon Workarounds PBL to the application.

Step 2: Deploy Appeon Bridge.

Step 3: Connect to the J2EE application server where Appeon Server and Appeon Bridge are installed through Appeon EJBobject.

For example:

string ls_prop[5] 
string ls_serurl, ls_msg 
ls_serurl = "http://192.0.3.35:8000/appeonbridge/Dispatch" 
ls_prop[1] = "applicationA" 
ls_prop[2] = "javax.naming.Context.INITIAL_CONTEXT_FACTORY='com.sybase.ejb.InitialContextFactory'" 
ls_prop[3] = "javax.naming.Context.PROVIDER_URL='iiop://192.0.1.249:2000'" 
ls_prop[4] = "username=admin@system" 
ls_prop[5] = "password=appeon249" 
ls_msg = io_ejb.connectserver (ls_serurl, ls_prop) 
if ls_msg <> "" then 
MessageBox ("Error when connecting with the application server!", ls_msg) 
return 
end if

Step 4: Create an instance of the EJB component OpenInterface.

The JNDI name for EAServer is java:comp/env/ejb/ASInterface.EJBOpenInterfaceHome, and the JNDI name for WebSphere, WebLogic, JEUS, & JBoss is OpenInterfaceBean.

For example:

String ls_jndi, ls_home, ls_method, ls_msg 
ls_jndi = "java:comp/env/ejb/ASInterface.EJBOpenInterfaceHome" 
ls_msg = io_ejb.createremoteinstance (ls_jndi, ls_home, "create", ref il_bean1) 
if ls_msg <> "" then 
MessageBox ("Failed to create the remote instance!", ls_msg) 
return 
end if

Step 5: Invoke one or more open interfaces in the component. For example:

string ls_msg 
int c_val 
string retval01 
c_val = -1 
io_ejb.regstring ("")
io_ejb.regstring ("")
ls_msg = io_ejb.invokeretstring (il_bean1, "getAllSessions", true, ref retval01) 
if ls_msg = "" then 
messagebox ('', "retval=" + string(retval01)) 
else 
messagebox ("", "retval=" + ls_msg) 
end if

Step 6: Deploy the PowerBuilder application to Appeon Server the same way you would deploy a normal PowerBuilder application.

The above code will take effect in the Appeon-deployed application.