Introduction |  Requirement |  Usage |  Cookie handling |  HTTPS support |  Samples |  Feature configuration samples
Introduction
The example code that accompanies this file uses Perl to communicate with Netscaler, using XML/SOAP. Here, we describe how to get it up and running.

The setConfig.pl example uses the Netscaler API to:
  • log in to Netscaler
  • add a service
  • bind a monitor
  • add a vserver
  • bind a service to a vserver
  • save configuration
  • remove added vservers and services
  • log out
The getConfig.pl example fetches information about all configured lb vservers, and prints selected information about each one.

The rmConfig.pl example removes all of the configuration that was created by setConfig.pl.

The getStat.pl example demonstrates usage of statistical api.

Additional documentation is available as inline comments in the Perl scripts.
Requirement
For the examples to work, you need the SOAP::Lite Perl module, available at http://www.soaplite.com/. HTTP::Cookie is used for client authentication purposes, as SOAP::Lite does not support cookies on its own. The following command should install all of the required modules:

perl -MCPAN -c "install 'SOAP::Lite'"
Usage
The parameters to all of the examples are :

run <protocol>://<NSIP> <username> <password>
Cookie handling
HTTP::Cookie is used for client authentication purposes, as SOAP::Lite does not support cookies on its own. Developers need to handle the cookies as follows:

# create cookie object. Server sends cookie for client authentication.
my $cookies = HTTP::Cookies->new(ignore_discard => 1, hide_cookie2 => 1);
# create the soap object and pass the cookies object
my $soap = SOAP::Lite->proxy("http://${NS}/soap", cookie_jar=>$cookies);
HTTPS support
Developers need to use the HTTPS protocol  to send the secured API request to NetScaler. Additional package (Crypt-SSLeay) needs to be installed to use the HTTPS protocol in API request.

perl <scriptname> https://<NSIP> <username> <password>
Samples
getConfig.pl The getConfig example fetches information about all configured entities, and prints selected information about each one.
setConfig.pl The setConfig example uses the Netscaler API to set and bind certain entities in the System.
rmConfig.pl The rmConfig example removes all of the configuration that was created by setConfig.
getStat.pl The getStat example demonstrates usage of statistical api.
Feature configuration samples
acl.pl ACL configuration sample.
cmp.pl Compression configuration sample.
csw.pl Content Switching configuration sample.
lb.pl Load Balancer configuration sample.
rba.pl RBA configuration sample.
rewrite.pl Rewrite configuration sample.
ssl.pl SSL Base configuration sample.
ssl_crl.pl SSL Client-Auth with CRL configuration sample.