Unset Optional
Properties
Many of the Data Objects in the vSphere Web
Services SDK have optional properties that may be set by your client
application or by a Server process or event. If you retrieve a data object that
has an optional property that is unset, the Server will not return a value for
the optional property. If you call an accessor function to retrieve the
property value, the value returned by the function depends on the programming
language that you are using.
For example, if you are programming in Java or C#,
the value you will receive for an unset property is
null
.
Figure 1
shows part of the Properties table for the
HostFirewallInfo
data object in the
vSphere Web Services SDK API
Reference
. When you look at properties in the
vSphere Web Services SDK API
Reference
, you can see that optional properties are marked with a red
asterisk.
In this example, that the
defaultPolicy
property is always returned, but the
ruleset
property will be returned as a
null
value if it has not been set.
Data Object - HostFirewallInfo
Properties

Since Data Objects are part of many different
constructs, there is no standard scenario for when an optional property should
be set, what will happen if an optional property is left unset, or what you
should do if a null value is returned.