Hi all,
I'm trying to get a status of a task (like when rebooting a vm or such).
I have a Task ID (like: task-90) and this is my XML for the call:
<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body> <RetrieveProperties xmlns="urn:vim25"> <_this type="PropertyCollector">PropertyCollector</_this> <specSet> <propSet> <type>Task</type> <all>false</all> </propSet> <objectSet> <obj type="Task">task-90</obj> </objectSet> </specSet> </RetrieveProperties> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
The return from this call though is not good:
=>
string(15) "ServerFaultCode"
=>
string(70) "The object has already been deleted or has not been
completely created"
=>
array(1) {
=>
array(1) {
=>
string(17) "PropertyCollector"
Any help on this is greatly appreciated!
Thanks!
Two places to check:
1. When you set the all to be false, you need to specify pathSet.
<specSet>
<propSet>
<type>Task</type>
<all>false</all>
</propSet>
2. The Task is a short live managed object. Your task as "task-90" might had expired when you tried to retrieve its status.
Steve JIN
Author of VMware VI and vSphere SDK (Prentice Hall)
Creator of open source vSphere (VI) Java API(Tutorial, Testimonials, Download, Samples)
Blog: DoubleCloud.ORG ( Top 10 Best Practices,[Common Mistakes|http://www.doublecloud.org/2010/01/31/common-mistakes-using-vmware-vi-and-vsphere-sdk/], Tiny REST API)
Hi Steve.
Thanks for your reply. What would the path be though? That's the part I find confusing...
Thanks!
Hmm you were right. pathSet was missing...
After some searching on-line I found it should be <pathSet>info</pathSet>.
Any idea on where I can find this? I mean "info" string was not even close to my mind in oder to get this working, and it isn't documented on line either.
Thanks!
You want to read the API Reference doc here:
In particular there is a link at the bottom "Show WSDL type definition." It gives you the XML schema.
Now, how about "info?" Check out API Ref as well. Watch out the property name of Task object.
Having said all these, we don't recommend you to work on the XML messages directly in general.
Steve JIN
Author of VMware VI and vSphere SDK (Prentice Hall)
Creator of open source vSphere (VI) Java API(Tutorial, Testimonials, Download, Samples)
Blog: DoubleCloud.ORG ( Top 10 Best Practices,[Common Mistakes|http://www.doublecloud.org/2010/01/31/common-mistakes-using-vmware-vi-and-vsphere-sdk/], Tiny REST API)
Thanks Steve.
I'm writing a PHP framework which can communicate with vCenter Servers so I do not have much choice other than fully understanding the XML being sent.
Thanks for the "info" puzzle as well. I find the API documentation a bit hard to follow at times. I wish when one clicks on the WSDL link you mention, I could see full sample call for that request (recursively to any other nested properties for a field) - but this is not quite the case.
Next on my list is trying to get a CloneVM_Task XML working... Will write back here if I stumble upon something ![]()
P.
Thanks
