1

I'm building a web application that allows to upload many types of files, some of them very big. Backend is built using Symfony (v3.1 in fact, but I don't think this matters for the issue) and I am using Gaufrette Bundle to interact with the filesystem. I found it a great solution, since it allows me to easily switch between local storage and cloud object storage depending on the file type and size.

However, I don't manage to make it work with Softlayer Object Storage. It has many built in wrappers, one of them for OpenStack based clouds (e.g. Rackspace or Softlayer) and the documentation seems very comprehensive, but I can't successfully connect to Softlayer API.

I have tried both integration within the Symfony Bundle and using the libraries directly in my classes and none of them works, below the latter:

public function uploadFromUrl($url)
{
    $connection = new OpenStack(
        'https://fra02.objectstorage.softlayer.net/auth/v1.0/',
        array(
            'username' => 'myuser',
            'password' => 'mykey'
        )
    );
    dump($connection);
    $objectStore = $connection->objectStoreService('cloudFiles', 'fra02', 'publicURL');

    $adapter = new OpenCloudAdapter(
        $objectStore,
        'mycontainer'
    );

    $filesystem = new Filesystem($adapter);

    $filename = pathinfo($url, PATHINFO_FILENAME);

    $filesystem->write($filename, file_get_contents($url));
    return $filename;
}

And the error I am getting:

Client error response
[status code] 400
[reason phrase] Bad Request
[url] https://fra02.objectstorage.softlayer.net/auth/v1.0/tokens

I suspect the problem is related to a bad formatting of the curl the library is doing internally, but I have no way to find out what are the parameters it is passing and whether they match with Softlayer API. I have tried both OpenStack and Rackspace examples shown in Gaufrette documentation with no luck

MarcSitges
  • 282
  • 3
  • 11

1 Answers1

0

I tried to reproduce your issue but I couldn't (I didn't have success to connect with the Object Storage). Anyway, it seems the same issue from the following forum (see below), because you are using php opencloud library:

I would recommend to use: SoftLayer Object Storage PHP Client, I hope it helps with your requirements

Community
  • 1
  • 1
  • Ruber, I've had time to try the client, and it does work. As described in the thread you mentioned, the problem arises because a different version of the OpenStack API. Do you have any plans to upgrade it? And is it the client still in development, do you plan to make any official release? – MarcSitges Oct 21 '16 at 13:35
  • I recommend to submit a ticket to get more information about it – Ruber Cuellar Valenzuela Oct 21 '16 at 14:26