Sub-requests
Sub-requests
Many URLRequests can contain sub-requests underneath (SubRequest elements). Nested sub-requests are especially useful while interacting with multiple similar requests on the same server like REST services.
Sub-requests are just like ordinary requests except that they inherit some of their parent properties:
Property/Element | How sub-request inherits from parent |
---|---|
URL property | Sub-request URL string can be relative to parent URL. E.g. if parent URL="http://server/api" and sub-request URL="set" then actual sub-request URL will be URL="http://server/api/set". |
RequestTranslator and ResponseTranslator elements | Sub-request inherits closest parent request Translator (if left unspecified). |
Network setup properties like Interface, UserPwd, Encryption, etc | Sub-requests are using their parent URLRequest network setup property values. |
ValueMap elements | Sub-request inherits closest parent request ValueMaps. However, ValueMaps can be overridden in the sub-request level. For example, if the parent has mapped values 0<=>OFF and 1<=>ON, then the sub-request can possibly override only ValueMap 100<=>ON to have mapped values 0<=>OFF and 100<=>ON. |
Sub-request do not have any connection setup properties like UserPwd, Proxy, Interface etc of their own. Instead they inherit these properties from parent. Therefore, using sub-requests can be very convenient when you have to make many different requests to the same server with same connection parameters. Then you can set up one parent request, configure connection parameters once and create all actual requests as sub-requests that will share these connection parameters.
Sub-requests can also be useful when sequential run of requests is needed. In general, ExternalControlIO requests are processed and run in parallel, all being processed in separate thread. In contrary, sub-requests are running in the same thread with their parent, therefore ensuring that any sub-request will only run when its parent request nor any other sub-request of that parent is not running (i.e. finished or not triggered for run).
Get started with CDP Studio today
Let us help you take your great ideas and turn them into the products your customer will love.