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
1 | Use the
DynamicProperty.getVal()
method to retrieve the anyType property value.
|
2 | Cast the
anyType value to a value of
type
ArrayOfString.
|
3 | Use the corresponding get method to assign
the result of the cast operation to a list variable.
|
/*
* Handling arrays of strings.
* Cast the return value to ArrayOfString and use getString().
*/
List[] stringList = ((ArrayOfString) dynamicProp.getVal()).getString();