Hello
I'm trying to use the SearchIndex.FindAllByDnsName method to retrieve a list of vms registered on my host.
However, this methods always send me back a soap fault message : A general system error occurred: Missing non-optional field
Here is my code. i'm using Qt framework, and gSoap (2.8) for web services embedding. The previous calls to other methods (RetrieveServiceContent, Login) works fine.
VimBindingProxy l_vim;
vim25__ManagedObjectReference ManagedObjectRef;
vim25__RetrieveServiceContentRequestType RetrieveServiceContentReq;
vim25_RetrieveServiceContentResponse RetrieveServiceContentRes;
vim25__ServiceContent *ServiceContent;
l_vim.soap_endpoint = "https://10.126.28.188/sdk";
soap_ssl_init();
soap_ssl_client_context(l_vim.soap,SOAP_SSL_NO_AUTHENTICATION,NULL,NULL,NULL,NULL,NULL)
ManagedObjectRef.__item = "ServiceInstance";
ManagedObjectRef.type = "ServiceInstance";
RetrieveServiceContentReq._USCOREthis = &ManagedObjectRef;
if ( l_vim.RetrieveServiceContent(&RetrieveServiceContentReq, RetrieveServiceContentRes) == SOAP_OK )
{ qDebug() << "RetrieveServiceContent - OK";
}
ServiceContent = RetrieveServiceContentRes.returnval;
vim25__LoginRequestType LoginReq;
vim25_LoginResponse LoginRep;
LoginReq._USCOREthis = ServiceContent->sessionManager;
LoginReq.userName = "root";
LoginReq.password = "xxxxxx";
if (l_vim.Login(&LoginReq,LoginRep) == SOAP_OK)
{ qDebug() << "Login - OK";
}
vim25__FindAllByDnsNameRequestType FindAllByDnsNameReq;
vim25_FindAllByDnsNameResponse FindAllByDnsNameRep;
FindAllByDnsNameReq._USCOREthis = ServiceContent->searchIndex;
FindAllByDnsNameReq.dnsName = "xxx"; //==> hostName of my vm
FindAllByDnsNameReq.vmSearch = true;
qDebug() << "FindAllByDnsName"<< l_vim.FindAllByDnsName(&FindAllByDnsNameReq,FindAllByDnsNameRep);
qDebug() << l_vim.soap_fault_string();
When trying on the direct webservice interface using a soap tool (SoapUI), I get the same exact error.
Request :
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:vim25">
<soapenv:Header/>
<soapenv:Body>
<urn:FindAllByDnsName>
<urn:_this type="SearchIndex">ha-searchindex</urn:_this>
<urn:dnsName>xxx</urn:dnsName>
<urn:vmSearch>true</urn:vmSearch>
</urn:FindAllByDnsName>
</soapenv:Body>
</soapenv:Envelope>
Response :
<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>A general system error occurred: Missing non-optional field</faultstring>
<detail>
<SystemErrorFault xsi:type="SystemError" xmlns="urn:vim25">
<reason>Missing non-optional field</reason>
</SystemErrorFault>
</detail>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
Any idea ?
thanks
MK
Ce message a été modifié par : mankonit