You have always seen NetScaler receiving request from clients and then forwarding the request to backend servers. On return path it receives responses from backend server and maps it to right client on frontend. Thus invoking a request right from NetScaler becomes a special feature and a capability which is extremely powerful. This feature is provided by AppExpert framework and known as HTTP Callout. Being part of AppExpert framework this capability can be invoked by any feature or layer which supports the framework. HTTP Callout is a unique tool for generating HTTP requests from NetScaler. HTTP callouts are extremely powerful in obtaining information from external applications running over HTTP. You can send a HTTP request on fly to external server or a vserver/service configured on NS. HTTP callouts are configured as special policy objects. After configuring an HTTP callout object, you can invoke it from policies and other functions that use advanced expressions.
An HTTP callout object has following components:
• Parameters that identify the application to be queried
• Parameters that NetScaler uses to create an HTTP request
• Or a single parameter that contains a fully-formed HTTP request
• Parameters for extracting data of interest from HTTP response
An HTTP callout is invoked from any policy expression on AppExpert framework by compounding the existing policy expression with a new expression “SYS.HTTP_CALLOUT(CalloutName)”. After invoking the Callout particular policy processing is kept on hold till NetScaler receives response on Callout request. The response from Callout could be of following nature:
Thus further operation done on Callout result has to be specific to nature of return type. This needs to be taken care of while configuring the Result Expression in Callout object as well. Only HTTP.RES based advanced expressions can be used to build the result expression. The expression must conform to the return type of the invoked policy. For example, if the return type of the HTTP callout policy is TEXT, the following expression is valid:
If the return type is NUM, then expression could be:
Callout configuration is driven from following simple commands on CLI:
add policy httpCallout myCallout
set httpCallout myCallout -ipaddress 10.102.3.10 -port 80 -returnType text -httpMethod GET -hostExpr “‘/10.102.3.10/'” -urlStemExpr “‘/mysite/index.html/'” -parameters name(HTTP.REQ.HEADER(“Name”)) -resultExpr HTTP.RES.BODY(100)
Every feature which supports AppExpert Advanced Expressions supports HTTP Callout. Invoking an HTTP callout from NetScaler and sending request to external server adds additional processing load on NetScaler. In cases where callout requests are made often, it is better to cache callout responses. You could configure a caching policy in NetScaler to cache the response received by HTTP callout. Upon subsequent callout request the response is served from Cache based on the cache parameter configuration. Thus callout does enjoys runtime in memory HTTP Caching benefits on NetScaler which improves system performance further.