Hello,
I am trying to use the vSphere web services api using SOAPUI, but I am unable to receive a successful response. Is there any special configuration I must do on the ESXi to allow the use of the API?
the ESXi I have deployed is version 6.0 u2.
So far, I succeeded in making a connection to the endpoint:
https://10.1.1.3/sdk/vimService
which successfully loaded all the wsdls. Now I am trying to use the method QueryEvents but I get the error:
<faultcode>ServerFaultCode</faultcode>
<faultstring>The session is not authenticated.</faultstring>
I read on the community and other forums so I tried to authenticate using the 'Login' method but still get the same error, so I am unable to establish a session to the API.
This is the Login request I send:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:vim25">
<soapenv:Header/>
<soapenv:Body>
<urn:Login>
<urn:_this type="SessionManager">SessionManager</urn:_this>
<urn:userName>root</urn:userName>
<urn:password>pass</urn:password>
<!--Optional:-->
<urn:locale>en</urn:locale>
</urn:Login>
</soapenv:Body>
</soapenv:Envelope>
and the response I get 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>
<soapenv:Fault>
<faultcode>ServerFaultCode</faultcode>
<faultstring>The session is not authenticated.</faultstring>
<detail>
<NotAuthenticatedFault xsi:type="NotAuthenticated" xmlns="urn:vim25">
<object type="SessionManager">SessionManager</object>
<privilegeId>System.View</privilegeId>
</NotAuthenticatedFault>
</detail>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
I tried running methods from the JMX at:
https://10.1.1.3/mob/?moid=ha-eventmgr
and it is working.
Bu nothing worked through SOAPUI, I even tried reinstalling the ESXi and I still can't get the session cookie. What is needed in order to be able to send SOAP requests to the API?
Thanks,
Lyubo