// create, delete, update, get the GSLB services
private static void createService(nitro_service client, String serviceName, String serviceType, String serviceIp,
String servicePort, String siteName) throws ExecutionException{
try {
gslbservice service;
service = getServiceObject(client, serviceName);
String gslbServerName = generateGslbServerName(serviceIp);
if (!gslbServerExists(client, gslbServerName)) {
base_response apiCallResult;
com.citrix.netscaler.nitro.resource.config.basic.server nsServer = new com.citrix.netscaler.nitro.resource.config.basic.server();
nsServer.set_name(gslbServerName);
nsServer.set_ipaddress(serviceIp);
apiCallResult = com.citrix.netscaler.nitro.resource.config.basic.server.add(client, nsServer);
if ((apiCallResult.errorcode != 0) && (apiCallResult.errorcode != NitroError.NS_RESOURCE_EXISTS)) {
throw new ExecutionException("Failed to add server " + gslbServerName + " due to" + apiCallResult.message);
}
}
boolean isUpdateSite = false;
if (service == null) {
service = new gslbservice();
} else {
isUpdateSite = true;
}
service.set_sitename(siteName);
service.set_servername(gslbServerName);
int port = Integer.parseInt(servicePort);
service.set_port(port);
service.set_servicename(serviceName);
service.set_servicetype(serviceType);
if (isUpdateSite) {
service.set_viewip(null);
service.set_viewname(null);
gslbservice.update(client, service);
} else {
gslbservice.add(client, service);
}
if (s_logger.isDebugEnabled()) {