Entity handler properties
- Last Updated: February 1, 2023
- 8 minute read
- OpenEdge
- Version 12.2
- Documentation
You use the entity operation handler
as a JSON object with the following properties:
type— use this property to identify the type of ABL program. Possible values includeclassandprocedure. If no value is set, the DOH usesclassas the default value. If you are referencing a procedure, you must set the value toprocedure.name— the name of the ABL class or persistent procedure, as is set in your application's PROPATH. If the ABL class is contained in a package, specify the full package name (for example,Business.Customer). If the ABL procedure file is in a folder in the ABL web app project, specify the relative path (for example,Business/Customer).function— the name of the ABL class method, procedure, or user-defined function that needs to be invoked.arg— a JSON array of objects to map the method or procedure's input and output parameters to message elements in the HTTP request or response. Each object in the array represents the mapping of a single parameter to HTTP message elements. Each parameter object contains the following properties:ablName— the name of the ABL input or output parameter. If the parameter type is RETURN, as set in theioModeproperty (see below), skip this property.ablType— the datatype of the ABL parameter. Possible values includeCHARACTER,LONGCHAR,INTEGER,INT64,DECIMAL,LOGICAL,ROWID,RECID,DATE,DATETIME,DATETIME-TZ,RAW,MEMPTR,DATASET1,TABLE2,BLOB,CLOB,EXTENT3, andCLASS4.ioMode— the parameter type. Possible values includeINPUT,OUTPUT,INPUT-OUTPUT, andRETURN.msgElem— a JSON object or array of objects that maps the ABL parameter to a message element in the HTTP request or response. EachmsgElemobject contains two properties--typeandname. The value of thenameproperty depends on the value of thetypeproperty. Specify values fortypeandnameas described in this table.
| Type | Name | When to use | Use for both requests and responses? |
|---|---|---|---|
none |
Leave the name property
blank or use null. |
|
Requests and Responses |
path |
Specify the name of the path parameter as defined in the WEB transport properties | When the ABL parameter is an input type and its value
needs to be extracted from a parameter in the requested URL path. For example,
assume that a client application makes a GET request to http://localhost:8810/myapp/web/
CustomerOrderService/customers/123 to retrieve customers records
by customer ID (123). To
set this up, set |
Requests only |
query |
Specify the name of the query parameter | When the ABL parameter is an input type and its value
needs to be extracted from a query in the requested URL path. For example,
assume that a client application makes a GET request to http://localhost:8810/myapp/web/ CustomerOrderService?id=123 to
retrieve customers records by customer ID (123). To set this up, set |
Requests only |
queryMap |
Leave the name property
blank or use null |
When the ABL parameter is an input type and the requested
URL path contains a query of the type
|
Requests only |
header |
The name of the HTTP header. For complex headers with
parameters, use the syntax <headername>;
<parameter> |
When the ABL parameter is an input, output, or input-output type, and its value needs to be either retrieved from an HTTP request header (for input operations) or passed on to an HTTP response header (for output operations). | Requests and responses |
headerSet |
Leave the name property
blank or use null |
When the ABL parameter is an input, output, or input-output type and its value is an array of HTTP header objects. This is mostly useful for debugging. | Requests and responses |
field |
The name of a root-level key in a JSON or multipart message | When the ABL parameter is an input, output, or
input-output type, and the value needs to be retrieved from or passed on to a
JSON or multi-part message in an HTTP request or response. You can only retrieve
or pass the value of a key that is at the topmost level in the message
hierarchy. For example, in the following JSON message, you can only retrieve the
value of message, status, date, or customer. If you need to access a 'child' element
(such as text, target, id, or name in this example), you must do so from within
your ABL
code.
|
Requests and responses |
cookie |
Specify the name of the browser cookie | When the ABL parameter is an input, output, or input-output type, and its value needs to be retrieved from or passed on to a single-value browser cookie. | Requests and responses |
statusCode |
Leave the name property
blank or use null |
When the ABL parameter is an output type, and the its
value needs to be passed to the client application as an HTTP status code. Note
that this overrides the statusCode property
set for the HTTP verb. |
Responses only |
body |
Leave the name property
blank or use null |
When the ABL parameter is an input, output, or
input-output type, and you need to either retrieve its value from the message
body of the HTTP request or pass on the value from the ABL parameter to the
message body of the HTTP response. While retrieving the value for an INPUT
parameter, you can set a flag to strip the envelope from the HTTP request
message. Similarly, in the case of an OUTPUT parameter, you can optionally set a
flag to add the envelope to the parameter output before forming the HTTP
response. To set these flags, add a an options
property under the HTTP verb in the mapping file as shown in this example:
|
Requests and responses |
request |
Leave the name property
blank or use null |
When the ABL parameter is an input type, and you want to populate its value with the complete HTTP request message, including the headers, body, etc. | Requests only |
httpMethod |
Specify the name of the HTTP verb | When you want to perform some type of debugging by passing the HTTP method name (GET, PUT, POST, etc) to an ABL method via an INPUT parameter. | Requests only |
constant |
Specify the value that you want to pass on to the ABL parameter | When you want to populate the value of an input parameter
with the value of the name property. This is
mostly useful for testing. |
Requests only |
Example of a dataset schema in the mapping file
If you specify DATASET in the ablType property, you must specify the dataset schema in the mapping
file. Place the dataset or temp-table schema under a schemas object inside your ServiceName (HelloService in the following example), at the bottom of the JSON
mapping file. Here is an example of a schema for a dataset that contains a
temp-table:
|
If you have related temp-tables in a dataset and you want the
response message to represent this relationship as nested JSON objects, you must
define the relationship in the dataset schema. Here is the format (note the
relationship in the attr object):
|
Each of the relationship attributes (name, nested,
active, recursive, and reposition)
correspond to options that you can specify in the data-relation part of an ABL
dataset definition. To learn more about these options, see Static ProDataSet and its
Data-Relations.
relations JSON
array. The relationships should be defined in the same order as in the ABL
dataset definition.Example
Consider a customer record that is related to multiple order records. Without a relationship defined (between the Customer and Order temp-tables) in the dataset schema, the DataObjectHandler produces individual JSON objects in the response message:
|
|
Example output in response message
|
DATASET as the ablType,
you also need to define the dataset schema in the mapping file. To learn
more, see the example dataset schema that follows the msgElem properties table.msgElem properties table
below.<Datatype> EXTENT
(for example, CHARACTER EXTENT).CLASS <full.type.name> (for example, CLASS Business.Customer)