When the PropertyCollector returns array data representing an array of strings, the array has the type xsd:anyType. To use the data in your application, you must first cast it to a specialized type for arrays of strings.
This example code uses the JAX-WS-generated Java bindings for the VMware vSphere Web Services SDK WSDL.
Procedure
- Use the DynamicProperty.getVal() method to retrieve the anyType property value.
- Cast the anyType value to a value of type ArrayOfString.
- Use the corresponding get method to assign the result of the cast operation to a list variable.
Example
/* * Handling arrays of strings. * Cast the return value to ArrayOfString and use getString(). */ List[] stringList = ((ArrayOfString) dynamicProp.getVal()).getString();