Step 3: Define the records

In this step you define the records you need for the HTTP Request and Response and the processing of the data.

Declare a record to use for HTTP Request/Response status. The calculator demo application creates a user-defined TYPE (TYP_status) to reference when defining variables.

    TYPE TYP_status RECORD  
        code INTEGER,  # The HTTP status code
        desc STRING    # The HTTP status description
    END RECORD
    
Declare a public record called info to hold the pieces of information that make up the HTTP request you send out and that comes back in the response from the Web service. You will use this when processing the data and outputting it for display.
 
PUBLIC DEFINE info RECORD 
    url     STRING,       #  URI of resource on the server
    verb    STRING,       #  HTTP method (e.g. POST, PUT, GET, or DELETE ) 
            #  For HTTP Request   
    reqtype STRING,       #  Request type identifier (e.g. Content-Type)
    request STRING,       #  Request data format (e.g. application/json, or application/xml)
    status  STRING,       #  Status of the HTTP Request  
            #  For HTTP Response 
    resptype STRING,      #  Response type identifier (e.g. Accept)    
    response STRING,      #  Response data format (e.g. application/json, or application/xml)
    result RECORD         #  Use this record for runtime execution errors
        code INT,
        desc STRING
    END RECORD
END RECORD
Declare two records, one (add_in) to hold operands for the add calculation and another (add_out) to hold the result of the calculation and response status. Recall that the type TYP_status was defined at the top of the module.

DEFINE 
    add_in RECORD         # Declare a record with 2 integer variables to hold operands for add calculation
      a INTEGER,
      b INTEGER
    END RECORD,

    add_out RECORD        # Declare a record to hold result  
      status TYP_status,  # A record of TYP_status for HTTP response status
      r INTEGER           # A variable for calculation result
    END RECORD

At this stage we are ready to code the HTTP Request, Step 4: Build the HTTP request