Community maintenance is complete. Thank you for your patience!

Software Development Kit (SDK) and API Discussions

RequestIterator issues with Perl


I am able to run non-iterator based calls, such as getStorageArrays, but the example program loops through each array with

each array is not working.  It throws this error:


The method name 'null' in the request iterator, does not match the expected method name'VolumeRequest(storageId=86528). context=APISessionContext{clientVersion=1.0,id=3d92ee26:14be69a2397:-7fd2,time=1425575394391,limit=1000}


code snippet:


foreach my $storageArrayObject (@allStorageObjects) {

    # We need to build an empty request iterator to seed the call
    $iterObject = new SOAPParam( "RequestIterator_2", "namesp1:RequestIterator");

    print $storageArrayObject->name() . "\n\n";
    my $size = 0;
    my @allVolumeObjects;
    do {
        my $arrayRequester = new SOAP::Data(
            value => $storageArrayObject->id(),
            name => "String_3",
            type => "string");

print Dumper($APIContext);
print Dumper($iterObject);
print Dumper($arrayRequester);
        my $volumeResponse = $Soap->getVolumesByStorageArray($APIContext->getSOAP(), $iterObject->getSOAP(), $arrayRequester );
print "foo\n";
        $iterObject = Iterator->parseResult($volumeResponse);
        my @currVolumeObjects= Volume->parseResult($volumeResponse);

        push @allVolumeObjects, @currVolumeObjects;

    } while($iterObject->hasMore() eq "true");

    foreach my $volume (@allVolumeObjects){
        $size += $volume->capacityGB();

    print "Size in GB as returned by summing the volume sizes: ". $size . "\n\n\n";




Solved my own problem.  The issue is that $iterObject _is_ null when the method is first called, so don't use it then.
Once the code gets the first response, then I can set the $iterObject to the proper value and use it accordingly:


my @allStorageObjects; 

my $iterObject;

do {
    my $storageArraysResponse;
    if ($iterObject) {
        $storageArraysResponse = $Soap->getStorageArrays($APIContext->getSOAP(), $iterObject->getSOAP());
    } else {
        $storageArraysResponse = $Soap->getStorageArrays($APIContext->getSOAP());
    $iterObject = Iterator->parseResult($storageArraysResponse);
    my @currStorageArrayObjects = StorageArray->parseResult($storageArraysResponse);

    push @allStorageObjects, @currStorageArrayObjects;
} while($iterObject->hasMore() eq "true");

NetApp on Discord Image

We're on Discord, are you?

Live Chat, Watch Parties, and More!

Explore Banner

Meet Explore, NetApp’s digital sales platform

Engage digitally throughout the sales process, from product discovery to configuration, and handle all your post-purchase needs.

NetApp Insights to Action
I2A Banner