-
Notifications
You must be signed in to change notification settings - Fork 914
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Folder type is returned as ManagedObjectReference #2114
Comments
Which git revision of govmomi are you using? |
Its an old one - that I had branched out for vRNI limitations. |
It was an issue at one point, but it may have only been within a Pull Request (#1800), not in the master branch. |
Hi Doug, We tried with master branch as well, but with master branch govc sim, type property is still incorrectly coming as ManagedObjectReference. Thank you. Regards, |
When running % govc object.collect /DC0/host/DC0_H0/DC0_H0 parent The vcsim response is: <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>
<WaitForUpdatesExResponse xmlns="urn:vim25">
<returnval>
<version>-</version>
<filterSet>
<filter type="PropertyFilter">session[ca3e82fd-fa9a-46ee-b4cb-939c1b4f904a]5d919f35-5bd7-4d1e-987a-1c20593e5e04</filter>
<objectSet>
<kind>enter</kind>
<obj type="HostSystem">host-21</obj>
<changeSet>
<name>parent</name>
<op>assign</op>
<val xmlns:XMLSchema-instance="http://www.w3.org/2001/XMLSchema-instance" XMLSchema-instance:type="ManagedObjectReference" type="ComputeResource">computeresource-23</val>
</changeSet>
</objectSet>
</filterSet>
</returnval>
</WaitForUpdatesExResponse>
</soapenv:Body>
</soapenv:Envelope> Sounds like it could be a client-side issue, handling iirc that was the issue in #1800, on the Go client side. |
Hi Doug, Mocked VC:
Real VC:
We uses java based client to parse XML response. Is it possible to get the response in the above format? Do we have to do anything make the mocked vc response in that format? |
The differences I see there are:
I don't have any Java test case to reproduce what you're seeing, if you can provide that I can take a closer look. Or, if you want to try this patch, it swaps the order of the type attributes: diff --git a/vim25/xml/marshal.go b/vim25/xml/marshal.go
index c0c0a588..2efdb7a4 100644
--- a/vim25/xml/marshal.go
+++ b/vim25/xml/marshal.go
@@ -497,11 +497,6 @@ func (p *printer) marshalValue(val reflect.Value, finfo *fieldInfo, startTemplat
start.Name.Local = name
}
- // Add type attribute if necessary
- if finfo != nil && finfo.flags&fTypeAttr != 0 {
- start.Attr = append(start.Attr, Attr{xmlSchemaInstance, typeToString(typ)})
- }
-
// Attributes
for i := range tinfo.fields {
finfo := &tinfo.fields[i]
@@ -524,6 +519,11 @@ func (p *printer) marshalValue(val reflect.Value, finfo *fieldInfo, startTemplat
}
}
+ // Add type attribute if necessary
+ if finfo != nil && finfo.flags&fTypeAttr != 0 {
+ start.Attr = append(start.Attr, Attr{xmlSchemaInstance, typeToString(typ)})
+ }
+
if err := p.writeStart(&start); err != nil {
return err
} |
This issue is stale because it has been open for 90 days with no |
PropertyCollector responses always included the 'xsi:type' attribute. When a property type is ManagedObjectReference, there are 2 'type' attributes in the response, for example: <val xsi:type="ManagedObjectReference" type="LicenseAssignmentManager">LicenseAssignmentManager</val> Some clients (Java) have problems with this. Changing the order to be the same as real vCenter to workaround: <val type="LicenseAssignmentManager" xsi:type="ManagedObjectReference">LicenseAssignmentManager</val> Fixes vmware#2114
PropertyCollector responses always included the 'xsi:type' attribute. When a property type is ManagedObjectReference, there are 2 'type' attributes in the response, for example: <val xsi:type="ManagedObjectReference" type="LicenseAssignmentManager">LicenseAssignmentManager</val> Some clients (Java) have problems with this. Changing the order to be the same as real vCenter to workaround: <val type="LicenseAssignmentManager" xsi:type="ManagedObjectReference">LicenseAssignmentManager</val> Fixes vmware#2114 Signed-off-by: Doug MacEachern <dougm@broadcom.com>
PropertyCollector responses always included the 'xsi:type' attribute. When a property type is ManagedObjectReference, there are 2 'type' attributes in the response, for example: <val xsi:type="ManagedObjectReference" type="LicenseAssignmentManager">LicenseAssignmentManager</val> Some clients (Java) have problems with this. Changing the order to be the same as real vCenter to workaround: <val type="LicenseAssignmentManager" xsi:type="ManagedObjectReference">LicenseAssignmentManager</val> Fixes #2114 Signed-off-by: Doug MacEachern <dougm@broadcom.com>
Hi Doug,
It is for com.vmware.vim25.ws.VimStub#retrieveProperties, where managed object reference can be HostSystem, DataStore or VirtualMachine. And the property is parent.
Is this info sufficient ?
The text was updated successfully, but these errors were encountered: