Try OpenEdge Now
skip to main content
Online Help
Introducing OpenEdge REST : Tasks : Developing ABL REST Web applications : Defining REST service annotations
 
Defining REST service annotations
To create an REST Web application, you must identify the procedures and classes to be exposed as REST services. You must add REST interface annotations to the ABL code that specify which procedures or classes should be exported. To use a procedure .p or class .cls file, you must add the service interface definition to it. Defining the service interface refers to defining or adding REST interface annotations in the ABL class and procedure file.
1. Right-click on the ABL class or procedure file in the Project Explorer view, Source, or the Procedure Editor tab, and select Progress OpenEdge > Define Service Interface on the context menu. The Define Service Interface wizard appears.
2. Select REST from the Definition Mode drop-down.
3. In the Project Explorer view, the ABL class or procedure selected in step 1 is automatically checked from the list of procedures and classes in the workspace, and the corresponding resources, internal functions, procedures, and methods are listed in the ABL routines area.
4. In the Backup area, select the Backup selected resources check box to back up the procedure files before defining the service interface.
5. In the Location area, click Browse and specify the backup location, and then click Next. The Edit Annotation page appears. It displays the following parameters in the REST main annotation and REST detail annotation sections:
*File - This attribute is mandatory. It specifies that the annotation applies to the main annotation at the ABL class or procedure level.
*Type - This attribute is mandatory. The value of this attribute is a comma separated list of types. If you are annotating an external procedure for use with an AppServer REST Adapter, the value of this attribute must include REST. If you are exporting a procedure for use with both the REST Adapter and the ESB Adapter, then the value of this attribute can include both types.
*executionMode - This attribute is mandatory. It specifies how the ABL class or procedure, or an external procedure runs. If you specify the value as EXTERNAL, the procedure runs externally, the value SINGLE-RUN allows you to call internal procedures and user defined functions in a procedure file, and the value SINGLETON allows you to call methods in a class file or internal procedures in a procedure file. Ensure that the top-level procedure contains no parameters and the state is discarded between calls to internal procedures and functions. Persistent procedures are not supported since REST services are stateless in nature.
*useReturnValue - This attribute is optional. It specifies whether a return string is used for procedures. The default value is false.
*writeDataSetBeforeImage - This attribute is optional and the only valid value for REST is false. It specifies whether before-image data is written out when ProDataSet parameters are serialized as XML. Before-image is not supported for JSON.
6. In the REST main annotation area, click Edit to edit the REST annotation for the ABL file. The New REST Annotation dialog appears.
7. In the New REST Annotation dialog, you can specify the following:
a. Enter the type of annotation to be added in the Type field.
b. Select EXECUTION MODE from the drop-down.
ABL procedure supports all the execution modes for REST. ABL class supports only SINGLETON execution mode for REST.
c. Select USE RETURN VALUE check box, if the ABL procedure file returns a value. A retVal parameter is added to the procedure file to store the return value.
d. Select WRITE DATASET BEFORE IMAGE check box, if you want before-image data written to the OpenEdge file when ProDataSet parameters are serialized as XML.
8. Click OK.
9. In the REST detail annotation area, click Edit to edit the REST annotation for the ABL routine of the main procedure file. The New REST Annotation dialog appears, perform the following steps:
a. Select USE RETURN VALUE check box, if the selected internal procedure returns a value. A retVal parameter is added to the procedure file to store the return value.
b. Select WRITE DATASET BEFORE IMAGE check box, if you want before-image data written to the OpenEdge file when ProDataSet parameters are serialized as XML.
Note: You can edit REST detail annotation only if an ABL routine is selected in 3.
10. Click Finish.