So, I am currently working on a PHP-based Alfresco upload applet. In a non-encrypted environment, the code at the end works great, over SSL, the $session->save(); command fails. providing the following error500 - socket_connect() failed. Reason: () The requested address is not valid in its context.
Hunting it down, when I use both SSL and non-SSL connections I am able to use GET/retrieve statements to retrieve data such as $repository->authenticate($user, $password); $repository->createSession($_SESSION["ticket"]); $session->getNode($spacesStore,$nodeID); and $props = $childNode->properties;So, I seem to be able to retrieve any data I wish from the repository using the alfresco PHP API over SSL however, $session->save(); doesn't like SSL. The code I am using is posted below. First, it sets up a session with the repo using a user-session ticket generated in another applet. It then pulls the children of the designated "drop box" node to see if a file with the same name exists. I don't want people to update/delete/overwrite files at this point. It successfully checks polls alfresco to run a file name comparison, then begins to setup the child. This code works great over a non-encrypted connection but, over ssl, everything works till i call $session-save().I am running a 1028 bit RSA ssl key over port 443 using a url like the following. https://server.company.com/alfresco/api. Alfresco is version "Version: Labs - v3.0.0 (Stable 1526)" this test box used the windows 3.0 full installer running on win 2k3 r2. The php server is the current version of xampp with openssl enabled. try{
//get configuration paramaters
$params = &JComponentHelper::getParams( 'com_alfrescodropbox' );
$params->merge( &$row->params );
$repoURL = (string)$params->get( 'Server' );
$nodeID = (string)$params->get( 'Node');
//setup session
$repository = new Repository($repoURL);
$session = $repository->createSession($_SESSION["ticket"]);
$spacesStore = new SpacesStore($session);
//find target dropbox node
$currentNode = null;
$currentNode = $session->getNode($spacesStore,$nodeID);
/////////////////////////
//check for file with existing name
$children = $currentNode->children;
foreach($children as $key=>$value){
$broken = explode('/', $key);
$childNode = $session->getNode($spacesStore,$broken[3]);
$props = $childNode->properties;
if($props['{http://www.alfresco.org/model/content/1.0}name'] == $_FILES['uploadedfile']['name']){
$updateError = 'We\'re sorry but, we currently do not allow users to update or delete files. <br /> Please change the file\'s name or contact your Project Manager to remove older files';
$this->setRedirect($link, $updateError, 'error');
return;
}
}
//////////////////////////
//create child
$upload = $currentNode->createChild('cm_content', 'cm_contains', 'cm_'.$_FILES['uploadedfile']['name']);
//prep file metadata/conetnt
$pathFile = $_FILES['uploadedfile']['tmp_name'];
$content_data = new ContentData($upload, $property, $mimetype, $encoding);
$content_data->mimetype = $_FILES['uploadedfile']['type'];
$content_data->encoding = "UTF-8";
$content_data->writeContentFromFile($pathFile);
//prep upload packaege
$upload->cm_content = $content_data;
$upload->cm_name = $_FILES['uploadedfile']['name'];
$fileName = (string)$upload->cm_name;
//push data to alfresco
$session->save(true);
}
catch (Exception $e) {
JError::raiseError(500, $e->getMessage());
}