Using the GET Method to Invoke HEAD

To invoke the HEAD method for a REST consumer Application Service, use the GET method. A new property will be created on the ApplicationServiceBase class called HeadRequest. This is both a SET and a GET property taking a boolean value. When set, the HTTP method for GET will change internally to HEAD.

The following example illustrates the use of the GET method to invoke a HEAD for the FLIGHTDATA_CON consumer Application Service:

import PTCBAPPLSVCDEFN:ApplicationServiceBase;
import PTCBAPPLSVCDEFN:MessageAPI;

Local string &AppSrv = "FLIGHTDATA_CON";
Local string &AppSrvRoot = "flight";
Local string &AppSrvMethod = %AppService_HTTP_GET;
Local integer &AppSrvIndex = 1;

&base = create PTCBAPPLSVCDEFN:ApplicationServiceBase();
&base.HeadRequest = True;
&ServiceAPI = &base.createService(&AppSrv, &AppSrvRoot, &AppSrvIndex, &AppSrvMethod);