How to compile sample API code written in Java

Added by Gaurav Joshua Vaz , last edited by Vishal Ganeriwala on Feb 24, 2008  (view change)
Tags: 

Basic instructions to compile Java programs which use the Citrix NetScaler API.

Requirements

To compile Java code which uses the Citrix NetScaler API, you need the JSDK 1.4.2 or later, Axis 1.1 or later, Xerces-2.5.0. or the Sun Java Web Service Development Pack: http://java.sun.com/webservices/jwsdp/index.jsp

Instruction to compile samples

Instructions to create Client applications using the NetScaler WSDL (NSconfig.wsdl)

  1. Modify the path of JDK_HOME, JAVA_HOME, AXIS_HOME,XERCES_HOME in build.bat and run.bat
  2. Compile the sample Client application : build.bat
    The Client application is compiled with stub sources and generates setConfig.java, setConfig.class, setConfig.class.
  3. Execute the NSConfig to configure the NetScaler box remotely - run.bat.

Cookie Handling

NetScaler uses the cookies for client authentication purposes. Java client needs to handle the cookies. Please add the following code in client code to handle the cookie.

public static void main(String[] args) {
...
client = new NSStatBindingStub(new URL(<url>),null);
client.setMaintainSession(true); // This is to handle the cookies.
...

HTTPS Support

You should use the HTTPS protocol to send secure API requests to the Citrix NetSclaer. The Citrix NetScaler, by default, uses a self signed CA certificate, therefore all java clients need to handle the self signed certificate if a HTTPS request is sent to the NetScaler.

usage : run  https://	<NS IP> <username> <password>

More Information