Hi Guys,
I'm using the new v9 code from poulpreben github for our cloud connect portal, however I ran into two issues:
- line 45 in veeam.class.php base_url has to be changed into base_uri in order to prevent PHP error 6 - host not resolved (even when using IP only, this has changed in Guzzle client 6+)
- I still have an issue of authentication using the veeam.class.php
error log in apache
Code: Select all
http://172.20.1.148:9399/api/sessionMngr/?v=v1_2` resulted in a `401 Unauthorized` response:\n<?xml version="1.0" encoding="utf-8"?><Error StatusCode="401" Message="Authorization header is missing" xmlns="http://ww (truncated...)\n' in /var/www/html/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:107\nStack trace:\n#0 /var/www/html/vendor/guzzlehttp/guzzle/src/Middleware.php(65): GuzzleHttp\\Exception\\RequestException::create(Object(GuzzleHttp\\Psr7\\Request), Object(GuzzleHttp\\Psr7\\Response))\n#1 /var/www/html/vendor/guzzlehttp/promises/src/Promise.php(199): GuzzleHttp\\Middleware::GuzzleHttp\\{closure}(Object(GuzzleHttp\\Psr7\\Response))\n#2 /var/www/html/vendor/guzzlehttp/promises/src/Promise.php(152): GuzzleHttp\\Promise\\Promise::callHandler(1, Object(GuzzleHttp\\Psr7\\Response), Array)\n#3 /var/www/html/vendor/guzzlehttp/promises/src/TaskQueue.php(60): GuzzleHttp\\Promise\\Promise::GuzzleHttp\\Promise\\{closure}()\n#4 /var/ in /var/www/html/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php on line 107, referer: http://172.20.1.139/
error log in veeam api log
Code: Select all
22.01.2016 11:36:47] <253> Info [POST] request to [http://172.20.1.148:9399/api/sessionMngr/?v=v1_2] deserialized. Message: []; Parameters: [].
[22.01.2016 11:36:47] <253> Info [Authenticated] Logging on...
[22.01.2016 11:36:47] <253> Error Login failed.. RequestUri: [http://172.20.1.148:9399/api/sessionMngr/?v=v1_2].
[22.01.2016 11:36:47] <253> Error Authorization header is missing (Veeam.Backup.Interaction.RestAPI.CRestAPICommunicationException)
[22.01.2016 11:36:47] <253> Error at Veeam.Backup.Enterprise.RestAPIService.CRestOperationContext.GetAuthorizationHeader()
[22.01.2016 11:36:47] <253> Error at Veeam.Backup.Enterprise.RestAPIService.CEnterpriseRestServiceStub.LogInAfterAuthentication(LoginSpecType loginSpec, String version)
i think the issue is in this part of the code
Code: Select all
public function __construct($host, $port, $username, $password, $backup, $replication) {
$this->client = new GuzzleHttp\Client(array(
"base_uri" => "http://" . $host . ":" . $port . "/api/",
"defaults" => array(
"auth" => array(
$username,
$password
),
"headers" => array(
"Content-Type" => "text/xml"
),
)
));
$response = $this->client->post('sessionMngr/?v=v1_2');
$this->backup_create = $backup;
$this->replication_create = $replication;
$this->session_id = $response->getHeader('X-RestSvcSessionId');
$this->client->setDefaultOption('headers', array('X-RestSvcSessionId' => $this->session_id));
$this->tenant_password = $this->veeam_generate_password(12);
}
any ideas?