Fixing Issues with Citrix Netscaler WSDL

The locator class in our generated service access helper module ( NSStat_services. py) is defined as shown in Listing 2-8.

Listing 2-8. The Locator class definition

# Locator class NSStatServiceLocator:

NSStatPort_address = "http://netscaler_ip/soap/" def getNSStatPortAddress(self):

return NSStatServiceLocator.NSStatPort_address def getNSStatPort(self, url=None, **kw):

return NSStatBindingSOAP(url or NSStatServiceLocator.NSStatPort_address,^

This is obviously wrong, because the service host name netscaler_ip is not a valid IP address (it should have been 192.168.1.1), nor is a valid domain name. Citrix Netscaler has always been exposing its endpoint this way, so we can only assume this is done by design.

One possible reason it is done this way is that you may want to use the same WSDL information along with your software to manage multiple load-balancing devices, and therefore it would be impractical to retrieve and compile WSDL from every single device you are going to manage. Therefore it is left to the API user/developer to replace this address with the correct one. All examples from Netscaler SOAP API manual behave the same way, and ignore this variable instead of passing their own settings.

Therefore you have to modify the NSStatPort_address variable by replacing netscaler_ip with the IP address of your device. Fortunately this has to be done only once; WSDL is not going to change very often (usually only during the major OS upgrades). Listing 2-9 shows the modification.

Listing 2-9. Manually modifying the Locator class

# Locator class NSStatServiceLocator:

NSStatPort_address = "http://192.168.1.1/soap/" def getNSStatPortAddress(self):

return NSStatServiceLocator.NSStatPort_address def getNSStatPort(self, url=None, **kw):

return NSStatBindingSOAP(url or NSStatServiceLocator.NSStatPort_address,^

If you do not wish to modify the module, you will see another way of fixing the issue later in the chapter, where you can specify the service end point during the initialization of the Locator object.

Was this article helpful?

0 0

Post a comment