I've run the .wsdl file through wsdl2ruby (v. 1.5.5) and I'm going along prety good but I've run into a snag with retrieveProperties.
Here is my code...
os = ObjectSpec.new()
os.obj = morVirtualMachine
os.skip = false
spec = PropertyFilterSpec.new()
spec.propSet =
spec.objectSet =
ocary = ObjectContent.new
pc = ManagedObjectReference.new( _sic.returnval.propertyCollector) sp = PropertyFilterSpec.new sp = [ [spec ]] rp = RetrieveProperties.new( pc, sp ) ocary = _service.retrieveProperties(rp)
I get "InvalidRequest" And here is the wire dump...
Wire dump:
= Request POST /sdk HTTP/1.1 SOAPAction: "" Content-Type: text/xml; charset=utf-8 Cookie: vmware_soap_session=C964C65F-3509-4FBD-919C-09B513E0EBA7 User-Agent: SOAP4R/1.5.8 (/114, ruby 1.8.6 (2007-03-13) ) Date: Wed Oct 03 16:02:24 -0700 2007 Content-Length: 947 Host: 10.16.80.227 <?xml version="1.0" encoding="utf-8" ?> <env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <env:Body> <n1:RetrieveProperties xmlns:n1="urn:vim2"> <n1:_this>PropertyCollector</n1:_this> <n1:specSet xsi:type="n1:PropertyFilterSpec"> <n1:propSet xsi:type="n1:PropertySpec"> <n1:type>VirtualMachine</n1:type> <n1:all>false</n1:all> <n1:pathSet>name</n1:pathSet> <n1:pathSet>config.cpuAllocation</n1:pathSet> <n1:pathSet>config.memoryAllocation</n1:pathSet> <n1:pathSet>config.hardware</n1:pathSet> </n1:propSet> <n1:objectSet xsi:type="n1:ObjectSpec"> <n1:obj>vm-1073</n1:obj> <n1:skip>false</n1:skip> </n1:objectSet> </n1:specSet> </n1:RetrieveProperties> </env:Body> </env:Envelope> = Response HTTP/1.1 500 Internal Server Error Date: Wed, 3 Oct 2007 22:56:34 GMT Cache-Control: no-cache Content-Type: text/xml; charset=utf-8 Content-Length: 527 <?xml version="1.0" encoding="UTF-8"?> <soapenv:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soapenv:Body> <soapenv:Fault> <faultcode>ServerFaultCode</faultcode> <faultstring>type</faultstring> <detail> <InvalidRequestFault xmlns="urn:vim2" xsi:type="InvalidRequest"/> </detail> </soapenv:Fault> </soapenv:Body> </soapenv:Envelope>
What am I doing wrong?
Hi,
The correct SOAP request should be as follows. The changes have been highlighted.
<?xml version="1.0" encoding="utf-8" ?>
<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<env:Body>
<n1:RetrieveProperties xmlns:n1="urn:vim2">
<n1:_this type="PropertyCollector">propertyCollector</n1:_this>
<n1:specSet xsi:type="n1:PropertyFilterSpec">
<n1:propSet xsi:type="n1:PropertySpec">
<n1:type>VirtualMachine</n1:type>
<n1:all>false</n1:all>
<n1:pathSet>name</n1:pathSet>
<n1:pathSet>config.cpuAllocation</n1:pathSet>
<n1:pathSet>config.memoryAllocation</n1:pathSet>
<n1:pathSet>config.hardware</n1:pathSet>
</n1:propSet>
<n1:objectSet xsi:type="n1:ObjectSpec">
<n1:obj type="VirtualMachine"> vm-1073</n1:obj>
<n1:skip>false</n1:skip>
</n1:objectSet>
</n1:specSet>
</n1:RetrieveProperties>
</env:Body>
</env:Envelope>
~ Sidharth
Hi,
The correct SOAP request should be as follows. The changes have been highlighted.
<?xml version="1.0" encoding="utf-8" ?>
<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<env:Body>
<n1:RetrieveProperties xmlns:n1="urn:vim2">
<n1:_this type="PropertyCollector">propertyCollector</n1:_this>
<n1:specSet xsi:type="n1:PropertyFilterSpec">
<n1:propSet xsi:type="n1:PropertySpec">
<n1:type>VirtualMachine</n1:type>
<n1:all>false</n1:all>
<n1:pathSet>name</n1:pathSet>
<n1:pathSet>config.cpuAllocation</n1:pathSet>
<n1:pathSet>config.memoryAllocation</n1:pathSet>
<n1:pathSet>config.hardware</n1:pathSet>
</n1:propSet>
<n1:objectSet xsi:type="n1:ObjectSpec">
<n1:obj type="VirtualMachine"> vm-1073</n1:obj>
<n1:skip>false</n1:skip>
</n1:objectSet>
</n1:specSet>
</n1:RetrieveProperties>
</env:Body>
</env:Envelope>
~ Sidharth