Skip to content

Commit 675534a

Browse files
committed
fix: vcsim: swap order of xsi type attribute
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 <[email protected]>
1 parent 211be90 commit 675534a

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

vim25/xml/marshal.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -497,11 +497,6 @@ func (p *printer) marshalValue(val reflect.Value, finfo *fieldInfo, startTemplat
497497
start.Name.Local = name
498498
}
499499

500-
// Add type attribute if necessary
501-
if finfo != nil && finfo.flags&fTypeAttr != 0 {
502-
start.Attr = append(start.Attr, Attr{xmlSchemaInstance, typeToString(typ)})
503-
}
504-
505500
// Attributes
506501
for i := range tinfo.fields {
507502
finfo := &tinfo.fields[i]
@@ -524,6 +519,11 @@ func (p *printer) marshalValue(val reflect.Value, finfo *fieldInfo, startTemplat
524519
}
525520
}
526521

522+
// Add type attribute if necessary
523+
if finfo != nil && finfo.flags&fTypeAttr != 0 {
524+
start.Attr = append(start.Attr, Attr{xmlSchemaInstance, typeToString(typ)})
525+
}
526+
527527
if err := p.writeStart(&start); err != nil {
528528
return err
529529
}

0 commit comments

Comments
 (0)