Hi all!
I am having a little difficulty understanding the object model for web services. My aim is to get hold of a VirtualMachineConfigInfo object and a ServiceInstance object for the VM I am running on.
I have successfully retrieved a ServiceInstance object, got a MOR for SessionManager and logged in.
I know my IP address so I then perform a SearchIndex-FindByIp to get a MOR for my vm. This is what I get back.
<FindByIpResponse xmlns="urn:vim25"><returnval type="VirtualMachine">vm-966</returnval></FindByIpResponse>
I am guessing I need to use PropertyCollector - RetrieveProperties method.
1. Is this correct or should I be using something else?
If I should use the PropertyCollector - RetrieveProperties method, I have no clue what to specify in the propSet part of the PropertyFilterSpec to get the information I require. It says it can be NULL so I leave it NULL.
2. Can anyone provide any advice?
Anyway, this is what I am sending:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><n:RetrieveProperties xmlns:n="urn:vim25"><n:_this type="PropertyCollector">PropertyCollector</n:_this><n:specSet><n:propSet></n:propSet><n:objectSet><n:obj type="VirtualMachine">vm-966</n:obj><n:skip>false</n:skip></n:objectSet></n:specSet></n:RetrieveProperties></soapenv:Body></soapenv:Envelope>
and I receive:
<soapenv:Body>
<soapenv:Fault><faultcode>ServerFaultCode</faultcode><faultstring>Not initialized: vmodl.TypeName type</faultstring><detail><InvalidRequestFault xmlns="urn:vim25" xsi:type="InvalidRequest"></InvalidRequestFault></detail></soapenv:Fault>
</soapenv:Body>
Any help is appreciated!
Peter
Hi team,
I actually found a Java sample program that showed how to set up the request! Not sure if it is just me, but the doc could be clearer!
Cheers,
Peter
My recent two blogs may help you to understand the object model and propertycollector:
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)
Wow! Thanks for that.....wish I had this link a few weeks ago....
Thanks again.
Peter