The prototype method requires an output array to be created. This array must be created and managed properly.
Following on from the example in Array types as input parameters, the following example shows the client application calling the simpleArray method on the web service and using the returned array. The following example shows a typical usage of the method produced by the WSDL example of an array of nillable simple type. The response integer array is not directly accessible. To get the embedded integer array, the user has to call the get method on the piSimpleResponseArray object as follows:
xsd__int_Array * piSimpleResponseArray = ws.simpleArray( &iInputArray); int iSize = 0; // Size of the array. // Pointer to a pointer that will contain the array. Get the contents // of the response. The return value will be a pointer to a pointer containing // the array and iSize will contain the number of elements in the array. // Note that it is a const pointer so cannot be manipulated. const xsd__int ** ppiIntArray = piSimpleResponseArray->get( (int&) iSize); // Check if the array size greater than zero before processing it! if( iSize > 0) { // For each element of the array... for( int iCount = 0 ; iCount < iSize ; iCount++) { // Check that that element is not null before use... if( ppiIntArray[iCount] != NULL) { cout <<“Element[” << iCount << “]=“ << *ppiIntArray[iCount] <<endl; } } } // Later in the code... delete piSimpleResponseArray; piSimpleResponseArray = NULL;