Java client for Progress 9.1e AppServer

modig

New Member
Hello Experts;
I am using PROGRESS 9.1e on Windows.
My query is "Can I connect and run a Progress 4GL code on AppServer (Application Server) calling from a JAVA program?"
Design should be like this
AppServer <-> Java Client

As I studied Progress Application Server, I found that it is based upon JAVA RMI design but that was too old study recently I am looking for this option.

thanks in advance.
Devang
 

Ashwani Mishra

New Member
Hello Experts;
I am using PROGRESS 9.1e on Windows.
My query is "Can I connect and run a Progress 4GL code on AppServer (Application Server) calling from a JAVA program?"
Design should be like this
AppServer <-> Java Client

As I studied Progress Application Server, I found that it is based upon JAVA RMI design but that was too old study recently I am looking for this option.

thanks in advance.
Devang
Using ProxyGen (Progress Tool to generate proxies file from Progress .r code for Java / .Net OpenClient) you can achieve this.

(Below steps are copied from GitHub - labai/opa: OPA - Openedge Procedure Adapter ) - You might get some working example here too.

To call procedures from Java, Progress offers to use ProxyGen. It requires few steps:
  1. To have prepared ProxyGen project.
  2. Compile .p code into .r code.
  3. Move these .r code to some place where ProxyGen project will see them.
  4. Generate java classes.
  5. Move these classes to your Java project.
If procedure parameters (input/output parameters, temp-table) is changed, then it require to repeat all steps again.

Java sample code example:

Code:
import java.io.IOException;
import com.progress.open4gl.Open4GLException;
import com.progress.open4gl.javaproxy.Connection;
import com.progress.open4gl.javaproxy.OpenAppObject;
import com.progress.open4gl.javaproxy.OpenProcObject;
import com.progress.open4gl.javaproxy.ParamArray;
import com.progress.open4gl.javaproxy.ParamArrayMode;
import com.progress.open4gl.*;

public class JavaAppServer {
    
        
  public void run() throws Exception
  {
    System.out.println("Inside run method...");
    
    ParamArray m_ParamArray = null;
    
    try{
                
      
com.progress.open4gl.javaproxy.Connection m_Conn1 = new Connection("AppServer://hostname:5162/appservername", "", "", ""); /*5162 is NameServerport where appservername is connected*/
      
      System.out.println("Before creating OpenAppObject...");
      m_Conn1.setSessionModel(0);
      System.out.println("After m_Conn1.setSessionModel...");
      OpenAppObject m_AppObject1 = new OpenAppObject(m_Conn1, "");
      System.out.println("Connecti1on Success...");
      AppTest test = new AppTest();
      m_ParamArray = new ParamArray(0);
      m_AppObject1.runProc("AppTest.r", m_ParamArray);
      System.out.println("Done");
        
    
    }
    catch (Open4GLException o4GLex)
    {
      o4GLex.printStackTrace();
    }
 
     catch (IOException ioex)
   {
    ioex.printStackTrace();
   }
   }
 
  public static void main(String[] args) {
    
      JavaAppServer test = new JavaAppServer();
      System.out.println("Inside main method...");
    
    try {

        System.out.println("Calling run method...");
      test.run();
    
    } catch (Exception e) {e.printStackTrace();
    }
  }
}
 
Top