Software Development Kit (SDK) and API Discussions

OptionsListInfo command generates exception?

SLYNCH095
2,761 Views

I am trying to get te complete list of filer options, the same as executing "options' from the CLI, but the SDK generates an object not set to an instance of an object exception. No NetApp example code seeing this work in action but is very straight forward and not sure why this is broken. The user account that I use to login to filer generates this list perfectly from CLI. Any help would be greatly appreciated. See my code sample below.....            

               

//Create a filer object...

NaFiler filer = new NaFiler( this.Filer );

               

//Create network credentials for the filer...

filer.Credentials = new NetworkCredential( this.UserID,this.Password );

               

//Create the command to execute to the filer...

OptionsListInfo command = new OptionsListInfo();

//Execute the command...

OptionsListInfoResult output = command.Invoke(filer);




4 REPLIES 4

kunalm
2,761 Views

Steven

Maybe you can try executing the API through ZExplore...

I am pasting the code in Java that I get from ZExplore for options-list-info, this code has ONTAPI version as 1.15 as I had selected ONTAP 8.1, you can change that to the version number you are using

import java.io.IOException;

import java.net.UnknownHostException;

import java.util.List;

import netapp.manage.NaElement;

import netapp.manage.NaException;

import netapp.manage.NaServer;

public class ApiClient {

          public static void main(String[] args) {

                    try {

                              NaServer s = new NaServer("<server name or IP address>", 1 , 15);

                              s.setServerType(NaServer.SERVER_TYPE_FILER);

                              s.setTransportType(NaServer.TRANSPORT_TYPE_HTTPS);

                              s.setPort(443);

                              s.setStyle(NaServer.STYLE_LOGIN_PASSWORD);

                              s.setAdminUser("<user name>", "<password>");

                              NaElement api = new NaElement("options-list-info");

                              NaElement xo = s.invokeElem(api);

                              System.out.println(xo.toPrettyString(""));

                    } catch (NaException e) {

                              handleException(e);

                    } catch (UnknownHostException e) {

                              handleException(e);

                    } catch (IOException e) {

                              handleException(e);

                    }

          }

          private static void handleException(Exception e) {

                    System.out.println(e.getMessage());

                    e.printStackTrace();

          }

}

SLYNCH095
2,761 Views

First let me say thanks for the workaround!  I'm not sure why NetApp would have a nice API and simple commands are broken, I'm baffled.. They must not do TDD....

rle
NetApp Alumni
2,761 Views

Steven -

Is 'filer' null?

   - Rick -

SLYNCH095
2,761 Views

No, Filer is a valid object that works just fine. I have used
the exact code to execute other API’s in the SDK and filer object is spot on…

Public