WebSphere Web Services Client for C++, Version 1.0.1 운영 체제: Linux, Windows

출력 매개변수로 유형 배열

프로토타입 메소드에서는 출력 배열을 작성해야 합니다. 이 배열은 제대로 작성 및 관리되어야 합니다.

입력 매개변수로 유형 배열의 예와 같이 다음 예제는 웹 서비스에서 simpleArray 메소드를 호출하고 리턴된 배열을 사용하는 클라이언트 응용프로그램을 보여 줍니다. 다음 예제는 nillable 단순 유형 배열의 WSDL 예에서 소개된 메소드의 일반적인 사용을 보여 줍니다. 응답 정수 배열에는 직접 액세스할 수 없습니다. 임베디드 정수 배열을 가져오려면 사용자는 다음과 같이 piSimpleResponseArray 오브젝트에서 가져오기 메소드를 호출해야 합니다.

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;
참고:
  1. 리턴된 포인터는 NULL이 아닙니다.
  2. 사용자는 웹 서비스에 대한 호출로 리턴된 오브젝트를 삭제하기만 하면 됩니다. 클라이언트는 이 오브젝트 내에서 추출된 오브젝트를 삭제하면 안됩니다. 예를 들어, 이전 코드 샘플에서 ppiIntArray는 상위 오브젝트(piSimpleArrayResponse)가 삭제될 때 삭제되므로 사용자가 삭제하면 안됩니다.
  3. 정수 값(ppiIntArray)에 대한 포인터의 배열에 대한 포인터가 NULL이면 이것은 빈 배열은 나타냅니다. 이 경우 iSize가 0입니다.

Reference topic

이용약관 | 피드백

시간소인 아이콘마지막 갱신 날짜: 3 Mar 2006
http://publib.boulder.ibm.com/infocenter/dmndhelp/v6rxmx/index.jsp?topic=/com.ibm.websphere.wscc.doc.nl1\ref\wscc_rmemman_stypearrays_op.html

(C) Copyright IBM Corporation 2005. All Rights Reserved.
이 information Center는 Eclipse 기술을 기반으로 합니다. (http://www.eclipse.org)