User`s guide

Create a Data Object
To create a data object, you can either invoke an empty constructor and then call the setters for the object or
invoke the constructor with parameters.
Each data object class includes a constructor method whose parameters represent attributes of the class and
all of its ancestors. Attributes are marked as protected to restrict their visibility. All classes contain setter and
getter methods for XML elements and attributes.
The general form of setter and getter method names is operation_attribute-name for attributes and
operationElementName for elements, where operation is one of set or get. For example, the
VMware_VCloud_API_ReferenceType class supports set_name() and get_name() methods that get or set the value
of its name attribute. The VMware_VCloud_API_UserType class supports setFullName() and getFullName()
methods that set or get the value of the FullName element in a User object.
Procedure
n
Create a data object by invoking an empty constructor and calling the setters for the object.
$ref = new VMware_VCloud_API_ReferenceType();
$ref->set_href($href);
$ref->set_type($type);
$ref->set_name($name);
n
Create a data object by invoking the constructor with parameters.
$ref = new VMware_VCloud_API_ReferenceType ($href=$href, $type=$type, $name=$name);
Create a Root Object
In the vCloud API, root objects such as VCloud and VMWExtension do not have containers. The vCloud SDK for
PHP provides dedicated constructors for these objects.
Procedure
n
To create a VMware_VCloud_SDK_Service object to use as an entry point for user API operations, use
VMware_VCloud_SDK_Service::getService, as this example shows:
$service = VMware_VCloud_SDK_Service::getService();
n
To create a VMware_VCloud_SDK_Admin object to use as an entry point for administrative operations,
use createSDKAdminObj, as this example shows:
$sdkAdminObj = $service->createSDKAdminObj();
n
To create a VMware_VCloud_SDK_Extension object to use as an entry point for vSphere Platform Extensions
operations, use createSDKExtensionObj, as this example shows:
$sdkExtObj = $service->createSDKExtensionObj();
Use a Different HTTP Library
Example programs included in the vCloud SDK for PHP require the PEAR HTTP_Request2 package. You can
use a different HTTP library.
Procedure
1 Create an HTTP client object that implements the VMware_VCloud_SDK_Http_Client_Interface interface.
Chapter 3 Working with the vCloud SDK for PHP
VMware, Inc. 25