Skip to content
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

vmware ESXi 4.1 support #4

Closed
ikarishinjieva opened this issue Oct 28, 2014 · 2 comments
Closed

vmware ESXi 4.1 support #4

ikarishinjieva opened this issue Oct 28, 2014 · 2 comments

Comments

@ikarishinjieva
Copy link

Hi @igm,

I tried vim25 on vmware ESXi 4.1, and got server error:

undefined TraversalSpec name

The root cause is that ESXi 4.1 cannot recognize following tags correctly:

<selectSet xmlns:XMLSchema-instance="http://www.w3.org/2001/XMLSchema-instance" XMLSchema-instance:type="TraversalSpec">

And it should be:

<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.

@igm
Copy link
Owner

igm commented Oct 28, 2014

Hi @ikarishinjieva
let me look at this problem. However I haven't updated this library for a while as it seems there's an official library developed by VMWare https://github.com/vmware/govmomi

So I'm not sure I'll actively continue working on this project when there's a library directly from VMware.

@ikarishinjieva
Copy link
Author

Thank you, @igm .
I will try official library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants