4.1.2 Enumeration of Instances
If there are multiple instances of a class, enumeration can be used to retrieve all instances of the CIM class. The example from Retrieving a CIM Instance (section 4.1.1) can be extended to add another instance.
-
[abstract] class Base { [key]sint32 id; }; class MyClass : Base { string Data1; }; instance of MyClass { id = 1; Data1 = "Hello World"; }; instance of MyClass { id = 2; Data1 = "Hello Again"; };
Enumeration involves multiple requests and response exchanges, as shown in the following figure.

Figure 11: CIM class instances enumeration request-response sequence
The Web Services Management Protocol Extensions for Windows Vista client sends an Enumerate request with the resource URI of the CIM class.
The Web Services Management Protocol Extensions for Windows Vista service responds with an Enumerate response that contains an enumeration context.
The client sends a Pull request and includes the Enumeration Context returned in the Enumerate response.
The service responds with one or more instances of the CIM class along with a new Enumeration Context. The number of instances is determined by maxElements specified in the Pull request.
The client sends a Pull request and includes the Enumeration Context received in the previous Pull response.
The service responds with one or more instances of the CIM class along with a new Enumeration Context.
This sequence is repeated until the service sends an EndofSequence, which indicates there are no more instances.
The client can send a Release request at any time during the enumeration to stop the exchange.