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.
-
Right-click on the ABL class or procedure file in the Project Explorer
view, Source, or the Procedure
Editor tab, and select on the context menu. The Define Service
Interface wizard appears.
-
Select REST from the Definition
Mode drop-down.
-
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.
-
In the Backup area, select the Backup selected
resources check box to back up the procedure files before
defining the service interface.
-
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.
-
In the REST main annotation area, click Edit
to edit the REST annotation for the ABL file. The New REST
Annotation dialog appears.
-
In the New REST Annotation dialog, you can specify the
following:
-
Enter the type of annotation to be added in the Type field.
-
Select EXECUTION MODE from the drop-down.
Note: ABL procedure supports all the execution modes for REST. ABL class supports only
SINGLETON execution mode for REST.
-
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.
-
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.
-
Click OK.
-
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:
-
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.
-
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.
-
Click Finish.