Hello,
I'm not sure, it the good location for my post..
anyway, I'm begining using webService to interact with my esx 4.1.
This one is under a vCenter.
I'm interacting through php script with soap client.
Here is my code :
<?php $serverIP = "XXX"; $serverUser = "XXX"; $serverPassword = "XXX"; $client = new SoapClient("https://$serverIP/sdk/vimService.wsdl", array("trace" => 1, "location" => "https://$serverIP/sdk/") ); $soapmsg["_this"] = array( "_" => "ServiceInstance", "type" => "ServiceInstance"); $result = $client->RetrieveServiceContent($soapmsg); $ServiceContent = $result->returnval; $soapmsg = NULL; $soapmsg["_this"] = $ServiceContent->sessionManager; $soapmsg["userName"] = $serverUser; $soapmsg["password"] = $serverPassword; $result = $client->Login($soapmsg); $UserSession = $result->returnval; echo "User " . $UserSession->userName . " is connected\n";$soapmsg = NULL; $soapmsg["_this"] = $ServiceContent->sessionManager; $result = $client->Logout($soapmsg); ?>
It work well directly on my esx, but when I try to login to the WS of my vCenter, (replacing the credentials) I've got the following error:
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing Schema: can't import schema from 'https://192.168.10.12/sdk/reflect-messagetypes.xsd' in /root/VMwarePHPWebServices/vmwareTestAPI.php:10
Stack trace:
#0 /root/VMwarePHPWebServices/vmwareTestAPI.php(10): SoapClient->SoapClient('https://192.168...', Array)
#1 {main}
thrown in /root/VMwarePHPWebServices/vmwareTestAPI.php on line 10
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
I looked on the web and other people faced this problems, it seems to be the fault of the WSDL file syntax?
I wondered if this problem is knowed, I am on the good track, do someone have a solution?
Or maybe it's not the same way to contact the vCenter?
Thanks in advance!