I am not sure if I am posting it on the right channel. The issue that I am facing is with the Esxi Webservice. I am attempting to login via web service and I don't get an OK response as shown below:
Any help is much appreciated
You are trying to log in directly to vsphere client or to vCenter?
From screenshots, I am not able to identify is this a monitoring tool or smth for network?
The issue is not passing the right SessionManager value in tag <urn:_this type="SessionManager"> .
To retrieve the SessionManager value, use the below POST SOAP API with the body and then pass the retrieved SessionManager value in the login API.
Step#1:
POST: https://<server>/sdk
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:vim25">
<soapenv:Header />
<soapenv:Body>
<urn:RetrieveServiceContent>
<urn:_this type="ServiceInstance">ServiceInstance</urn:_this>
</urn:RetrieveServiceContent>
</soapenv:Body>
</soapenv:Envelope>
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"...>
<soapenv:Body>
<RetrieveServiceContentResponse xmlns="urn:vim25">
...
<about>
....
</about>
...
<sessionManager type="SessionManager">ha-sessionmgr</sessionManager>
...
</returnval>
</RetrieveServiceContentResponse>
</soapenv:Body>
</soapenv:Envelope>
Step#2: Copy the above SessionManager value i.e, "ha-sessionmgr" and update in login api.
POST: https://<server>/sdk
BODY:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:vim25">
<soapenv:Header />
<soapenv:Body>
<urn:Login>
<urn:_this type="SessionManager">ha-sessionmgr</urn:_this>
<urn:userName>root</urn:userName>
<urn:password>XXXXXXXX</urn:password>
<urn:locale></urn:locale>
</urn:Login>
</soapenv:Body>
</soapenv:Envelope>
Response:
<?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>
<LoginResponse xmlns="urn:vim25">
<returnval>
<key>xxxxxxxx-xxxx-xxxx-xxxxx-xxxxxxxxxxxx</key>
<userName>root</userName>
<fullName>Administrator</fullName>
<loginTime>2023-01-31T09:06:39.124597Z</loginTime>
<lastActiveTime>2023-01-31T09:06:39.124615Z</lastActiveTime>
<locale>en</locale>
<messageLocale>en</messageLocale>
</returnval>
</LoginResponse>
</soapenv:Body>
</soapenv:Envelope>
It worked, thanks.