Quantcast
Channel: VMware Communities : All Content - vSphere Management SDK
Viewing all articles
Browse latest Browse all 1860

vSphere (4.1) API and PHP

$
0
0

Hi all,

 

I'm tearing my hair out here. I can successfully connect to the API via SOAP using PHP and calling the "ServiceInstance" method, I can get the following:

 

 

stdClass Object
(
    [returnval] => stdClass Object
        (
            [rootFolder] => stdClass Object
                (
                    [_] => ha-folder-root
                    [type] => Folder
                )
            [propertyCollector] => stdClass Object
                (
                    [_] => ha-property-collector
                    [type] => PropertyCollector
                )
            [viewManager] => stdClass Object
                (
                    [_] => ViewManager
                    [type] => ViewManager
                )
            [about] => stdClass Object
                (
                    [name] => VMware ESXi
                    [fullName] => VMware ESXi 4.1.0 build-260247
                    [vendor] => VMware, Inc.
                    [version] => 4.1.0
                    [build] => 260247
                    [localeVersion] => INTL
                    [localeBuild] => 000
                    [osType] => vmnix-x86
                    [productLineId] => embeddedEsx
                    [apiType] => HostAgent
                    [apiVersion] => 4.1
                    [licenseProductName] => VMware ESX Server
                    [licenseProductVersion] => 4.0
                )
            [setting] => stdClass Object
                (
                    [_] => HostAgentSettings
                    [type] => OptionManager
                )
            [userDirectory] => stdClass Object
                (
                    [_] => ha-user-directory
                    [type] => UserDirectory
                )
            [sessionManager] => stdClass Object
                (
                    [_] => ha-sessionmgr
                    [type] => SessionManager
                )
            [authorizationManager] => stdClass Object
                (
                    [_] => ha-authmgr
                    [type] => AuthorizationManager
                )
            [perfManager] => stdClass Object
                (
                    [_] => ha-perfmgr
                    [type] => PerformanceManager
                )
            [eventManager] => stdClass Object
                (
                    [_] => ha-eventmgr
                    [type] => EventManager
                )
            [taskManager] => stdClass
However, I try to invoke a login call, but keep getting the following error message:
Uncaught SoapFault exception: [ServerFaultCode] The session is not authenticated
If I try and change ommit the userName or password nodes, I get the following (expected) error:
SOAP-ERROR: Encoding: object has no 'userName' property
This is my XML:
<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>redacted</urn:userName>
         <urn:password>redacted</urn:password>
      </urn:Login>
   </soapenv:Body>
</soapenv:Envelope>
Any pointers greatly appreciated :-)

Viewing all articles
Browse latest Browse all 1860

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>