Step 2: Import extension packages (com, xml, util)

The functions you need to create a REST Web Service client application are contained in the classes that make up the com package of the Genero Web Services (GWS). Use the IMPORT statement to include the required packages.

Since this example application also uses util.JSON and XML class data types for the data exchange, you need to include the following lines at the top of your module as instructions to import the required packages:

IMPORT com    
IMPORT xml    
IMPORT util   
Inside your module's "MAIN" code block:
  • Declare variables of the com class to handle the HTTP request and response.
  • Declare xml.DomDocument and xml.DomNode objects of the XML class to handle the XML option for data exchange.
    DEFINE req com.HttpRequest       
    DEFINE resp com.HttpResponse 
    DEFINE doc xml.DomDocument   
    DEFINE node xml.DomNode       

In the next step we define some records Step 3: Define the records