FrancoisBotha.io
Back

Getting Started with Progress Application Server Development

The Progress Application Server (PAS) provides Web server support for Progress applications. In this tutorial I will demonstrate how to create a very basic PAS application from scratch in version 12.1 of Progress OpenEdge. This will involve the following steps:

  1. Create a Workspace
  2. Create a Client project
  3. Create a database
  4. Create a database server
  5. Create an App Server Instance
  6. Create a Server project
  7. Link the database to the server project
  8. Link the database to the App Server
  9. Create a server program
  10. Publish the server program
  11. Create a client program

Create a Workspace

Open developer studio -- the next window will display:

In the window above I created a new workspace named "OETutorials". Click on "Launch" to continue. Progress Developer Studio opens to the welcome screen:

Create a Client Project

We will be using a basic client/server two-tiered architecture in this tutorial. First, we create the client project by selecting File -> New -> OpenEdge Project:

Enter "clientBasic" as the project name. Select the bottom tab "General" and select the "OpenEdge Basic" radio button. Click on Finish:

Create a database

In this section we will create a database. First, change the perspective to DB Navigator by selecting Window -> Perspective -> Open Perspective -> DB Navigator. The IDE changes to display the following views:

In the Connections view, select the dropdown to the left and click on "Create OpenEdge Database":

On the next window enter a path and file name for the database, and select the option to start with a copy of the Sports2020 database:

Create a database server

In this section we will create a database server for the database created in the previous step. First, open up OpenEdge Explorer, by click on the icon in the toolbar:

Log in, and click on Resources -> Database to create a new database server:

On the next screen, enter the following details to create the database server:

On the next screen click on the button to start the database.

Create a PAS OE instance

The next step is to create an instance of the PAS OE Application server. First, change perspectives to "Server": Window -> Perspective -> Open Perspective -> OpenEdge Server. Server views will be added:

Click on the hyperlink to create a new server:

On the next screen, click on configure to set up the OpenEdge Explorer Options:

Click on Edit to configure OpenEdge Explorer:

Enter the correct password and test the connection to make sure it works as intended:

The "Define a new Progress Application Server for OpenEdge" screen will be updated as follows:

Click on finish to add the server to your workspace.

Create a Server project

In this section we will create the server-side project. The Application server will execute code located here and pass the results to the client. Create the server project by selecting File -> New -> OpenEdge Project:

Name the project "ServerBasic" and on the "Server" tab select "APSV" to create an App Server transport. Accept the default on the next screen. On the screen after that the server we created above will be selected:

Accept the default PROPATH on the following screen and click on "Next". On the following screen click on the "Configure database connections" screen to link the database to the project:

Link the database to the Server Project

Continuing from the previous step, the database connections screen will display as follows:

Click on "New" and enter the configuration details as per the screen below. Make sure to test the connection:

Click on next and accept the defaults to add a SQL connection:

On the following screen uncheck the option to auto-start the database, as it will already have been started. Click on next and apply. Check the database connection just created to complete this task.

The DB Structure view will now list the newly added database, and the DB Details view can be used to obtain additional information on the database, including functionality to preview table data:

Link the database to the Application Server

In the previous step, we have connected the database to our project. We also need to configure our Application Server (PAS) to connect to the database. In the "Servers" view, double-click on the Application Server to view the following screen:

Under the Publishing heading, be sure to select the option not to publish automatically. Then click on the "Open launch configuration" tab:

Click on the "Startup" tab, and be sure to enter the database connection parameters in the "Agent startup parameters" field:

-T "C:\OpenEdge_12_1\WRK\oepas1/temp" -db "C:\OpenEdge_12_1\WRK\sports2020" -H localhost -S 21002

Create a Server program

Now we need to create a server program that will expose some functionality to our client. We will create a program that will return the name for a given item number. Right click on the server project, and select New -> ABL Procedure:

Enter the name of the file and click on Finish:

Enter the following code and save the program:

/******************
 * getItemName.p  *
 ******************/

define input parameter pIntItemNum as integer no-undo.

define output parameter pChrName as character no-undo.

find first item no-lock

where Item.ItemNum = pIntItemNum

no-error.

if available item

then pChrName = item.ItemName.

else

pChrName = \"ERROR\". 

This code defines an input parameter and uses it to retrieve an item name from the database. Once retrieved it assigns it to the output parameter that is returned to the client.

Publish the Server program

Next, we will publish the server program we created above. To do this, select the "Servers" view and right-click on the oepas1 instance, select "Publish" from the context menu:

Create a Client program

Here we will create a program to test our App Server. Create a new ABL procedure following the instructions above, and name it ItemUI.p. Update it with the following code listing:

/******************
 * getItemName.p  *
 ******************/

define variable chrConnectionParam as character no-undo.

define variable logIsConnected as logical no-undo.

define variable appHandle as handle.

define variable chrItemName as character no-undo label "Item Name:"
format "x(30)".

define variable intItemNum as integer no-undo.

// Set connection details

assign chrConnectionParam = \"-URL http://localhost:8810/apsv\".

// Set App Server connection

create server appHandle.

logIsConnected = appHandle:connect(chrConnectionParam).

// Set Item Number

assign intItemNum = 2.

run getItemName.p on appHandle

(input intItemNum,

output chrItemName ).

display chrItemName.

In this code section we do the following: First, we define connection parameters that we will use to set up a connection to the App Server. Then we define a variable to pass into our server application, and another variable to hold the result. Next, we set up our connection details, and use it to establish a connection with the App Server. Next, we call the getItemName program on the AppServer. Finally, we used the obtained result and display it to our end-users: