© 1999-2017 Citrix Systems, Inc. All rights reserved. p.224https://docs.citrix.com
To account for the failure of some operations within the bulk operation, NITRO allows you to configure one of the
following behaviors:
Exit. When the first error is encountered, the execution stops. The commands that were executed before the error are
committed.
Continue. All the commands in the list are executed even if some commands fail.
Note: You must configure the required behavior while establishing a connection with the appliance, by setting the onerror
param in the nitro_service() method.
The following sample code adds two NetScalers in one operation:
ns[] newns = new ns[2];
//Specify details of first NetScaler
newns[0] = new ns();
newns[0].set_name("ns_instance1");
newns[0].set_ip_address("10.70.136.5");
newns[0].set_netmask("255.255.255.0");
newns[0].set_gateway("10.70.136.1");
...
...
...
//Specify details of second NetScaler
newns[1] = new ns();
newns[1].set_name("ns_instance2");
newns[1].set_ip_address("10.70.136.8");
newns[1].set_netmask("255.255.255.0");
newns[1].set_gateway("10.70.136.1");
...
...
//upload the details of the NetScalers to the NITRO server
ns[] result = ns.add(nitroservice, newns);
Exception Handling
The errorcode field indicates the status of the operation.
An errorcode of 0 indicates that the operation is successful.
A non-zero errorcode indicates an error in processing the NITRO request.
The error message field provides a brief explanation and the nature of the failure.
All exceptions in the execution of NITRO APIs are caught by the com.citrix.sdx.nitro.exception.nitro_exception class. To get
information about the exception, you can use the getErrorCode() method.
For a more detailed description of the error codes, see the API reference available in the <NITRO_SDK_HOME>/doc folder.