undefined TraversalSpec name
<selectSet xmlns:XMLSchema-instance="http://www.w3.org/2001/XMLSchema-instance" XMLSchema-instance:type="TraversalSpec">
<selectSet xsi:type="TraversalSpec">
I tried go-lang XML tags, but failed to get it work. So I did a hack on service.go:
--- a/service.go
+++ b/service.go
@@ -45,6 +45,12 @@ func (s *Service) SoapRequest(body *Body) (*Body, error) {
if err != nil {
return nil, err
}
+
+ //4.1 hacks
+ xmlEnvelope = []byte(strings.Replace(string(xmlEnvelope), "XMLSchema-instance:type", "xsi:type", -1))
+ xmlEnvelope = []byte(strings.Replace(string(xmlEnvelope), "xmlns:XMLSchema-instance=\"http://www.w3.org/2001/XMLSchema-instance\"", "", -1))
+ xmlEnvelope = []byte(strings.Replace(string(xmlEnvelope), "<Body xmlns=\"http://schemas.xmlsoap.org/soap/envelope/\">", "<Body xmlns=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">", -1))
+
req, err := http.NewRequest("POST", s.Url, bytes.NewReader(xmlEnvelope))
if err != nil {
return nil, err
It works for me on ESXi 4.1 & 5.1, but I don't think it's a good practice.