VI SDK access from PHP

Has anyone had any success in accessing the SOAP APIs from PHP ? I'm using the built-in SOAP library of PHP 5, but I keep getting an exception thrown - with no real information on where it failed

PHP Fatal error: Uncaught SoapFault exception: \[ServerFaultCode] type in /home/.....

I've found a reference on run-virtual.com, but not had any luck in getting that to work.

I've obviously got an incorrect parameter value (the "_this" parameter) - but I can't seem to work out what it should be.


$esx = new SoapClient(null,

array('location' => "",

'uri' => "urn:vim2",

'exceptions' => TRUE,

'user_agent' =>"SOAP/php-version"));

echo $esx->__soapCall("RetrieveServiceContent",

array( new SoapParam("ServiceInstance", "_this")


array( "uri" => "urn:vim2"));


0 Kudos
1 Reply

This is from www.run-virtual.com but it uses the nuSOAP library.


However, when I started to look at using PHP and its SOAP libraries to talk to the SDK, I found that none of them would return a complex data object (e.g. a ManagedObjectReference). Instead they would return the value portion only.

This made them useless (or proved I couldn't figure out how to make it work) since you need both the type and the value of a MoRef.