cancel
Showing results for 
Search instead for 
Did you mean: 

Web services in PHP and datatypes

rouwpi
Champ in-the-making
Champ in-the-making
Hi,

I'm trying to implement by myself some missinf features i need in the PHP API. But i'm not really familiar with this kind of datatypes.
For example when i wanna use the authoring service … let's say checkout… it requires 2 params … one predicate and the other parentReference… i've read the document «web service data types» but i still can't figure out what kind of data i have to pass.

Any idea please ???

Ps : by the way … i dunno who develops the php api … first thanks a lot, second if you need help just ask.

P.
9 REPLIES 9

rouwpi
Champ in-the-making
Champ in-the-making
Nobody knows how the datatypes work ?
When the webservice ask for a predicate ? what do i have to pass to it ?

Thanks.

P.

rouwpi
Champ in-the-making
Champ in-the-making
This is the code where i am for now :

function doCheckOut($node) {
      debug($node->id);
      $authoringService = WebServiceFactory::getAuthoringService($this->conf['server'],$this->ticket);
      $result = $authoringService->checkout(array(
         'items'=>array(
            'node'=>array(
               'uuid'=>'824948d4-8579-11dc-a1c1-0984a6647dd0',
               ),
                ),
         'destination'=>array(
            'associationType'=>'{http://www.alfresco.org/model/content/1.0}contains',
            'reference'=> array(
               'uuid'=>$node->id,
                    ),
            'childName'=>'copie de travail',
            ),
      ));
   }

I guess my parentReference is correct … it'sonly a guess… but the predicate ???
My soap call makes apache down.
Any help would be greatly apreciated.

Thanks a lot

P.

rouwpi
Champ in-the-making
Champ in-the-making
Hi there,

Nobody ?? come on please, i guess i'm not the only one working with php api.

Thanks a lot

P.

To get your complicated questions answered or requirements met, get in touch with our expert PHP developers.

jariel06
Champ in-the-making
Champ in-the-making
well, I create a file called DataTypes.php within the PHP API, this file have only two classes at the moment, see the following code:

<?php

class Reference
{
   private $store;
   private $uuid;
   private $path;
   
   public function __construct($store, $uuid, $path)
   {
      $this->store = $store;
      $this->uuid = $uuid;
      $this->path = $path;
   }
}

class Predicate
{
   private $nodes;
   private $store;
   private $query;
   
   public function __construct($nodes, $store, $query)
   {
      $this->nodes = $nodes;
      $this->store = $store;
      $this->query = $query;
   }
   
   public function setNodes($nodes)
   {
      $this->nodes = $nodes;
   }   
}

?>

I hope it works for you….

harris
Champ in-the-making
Champ in-the-making
I have tried code but when i execute got some error.
Can you tell what is use of $this-> ?

sonanaren
Champ in-the-making
Champ in-the-making
Hi,

I'm trying to implement by myself some missinf features i need in the PHP API. But i'm not really familiar with this kind of datatypes.
For example when i wanna use the authoring service … let's say checkout… it requires 2 params … one predicate and the other parentReference… i've read the document «web service data types» but i still can't figure out what kind of data i have to pass.

Any idea please ???

Ps : by the way … i dunno who develops the php api … first thanks a lot, second if you need help just ask.

P.

Hi,

Are you accessing Alfresoc repository remotely, how did u achieve the same?

i am trying to connect to remote alfresco repository for performing some action thru PHP application (remotely) .

i want to perform action like adding user, mapping user to groups and spaces, permissions etc. Went thru the lot of document in alfresco wiki which are not completed i guess.

Could you please help me with the procedure and guide me to the right path. please reply fast.

ddanninger
Champ in-the-making
Champ in-the-making
Hi you should extend your PHP Libary for the Role and User Management i think there is no implementation for the Administration Service atm.

Here an example: Based on WebService API => http://wiki.alfresco.com/wiki/Administration_Web_Service (http://wiki.alfresco.com/wiki/Alfresco_Content_Management_Web_Services)

NamedValues implementation:
<?php/* * Created by: Dominik Danninger <ddanninger@may.co.at> */class NamedValues {    private $_properties;    private $_session;        public function __construct($session) {        $this->_session = $session;        }        public function __get($name) {        $fullName = $this->_session->namespaceMap->getFullName($name);        if (array_key_exists($fullName, $this->_properties) == true)        {            return $this->_properties[$fullName];        }            else        {                return null;            }         }        public function __set($name, $value)    {        $fullName = $this->_session->namespaceMap->getFullName($name);        $this->_properties[$fullName] = $value;    }        public function __toArray()     {        $tempArray = array();        if (count($this->_properties) > 0) {            foreach ($this->_properties as $key => $value) {                $isMultiValue = false;                if (is_array($value))                    $isMultiValue = true;                $tempArray[] = array("name"=>$key,"value"=>$value,"isMultiValue"=>$isMultiValue);                }        }        return $tempArray;    }} 

AdministrationService Implementation (not completed):
<?php/* * Created by: Dominik Danninger <ddanninger@may.co.at> */ require_once 'WebService/WebServiceFactory.php';class Administration extends BaseObject {        public $administrationService;        private $_repository;    private $_session;    private $_store;    private $_ticket;        public function __construct($repository, $store, $session) {        $this->_repository = $repository;        $this->_store = $store;        $this->_session = $session;        $this->_ticket = $this->_session->getTicket();                $this->administrationService = WebServiceFactory::getAdministrationService($this->_repository->connectionUrl, $this->_ticket);    }   public function queryUsers($user_name=null) {        $filter = null;        if ($user_name != null) {            $filter = array("userName" => $user_name);           }            $result = $this->administrationService->queryUsers(array(                            "filter" => $filter));                                                    $resultSet = $result->result;             return $this->resultSetToUserDetails($this->_session,$this->_store,$resultSet);   }         public function getUser($user_name) {        $result = $this->administrationService->getUser(array(                            "userName" => $user_name));        $resultSet = $result->result;           return $this->resultSetToUserDetails($this->_session,$this->_store,$resultSet);   }      public function createUsers($userDetails) {        $result = $this->administrationService->createUsers(array(                            "newUsers" => $userDetails));        $resultSet = $result->result;           return $this->resultSetToUserDetails($this->_session,$this->_store,$resultSet);           }  }?>

Example of How to Use:
<?php        require_once "Alfresco/Service/Repository.php";        require_once "Alfresco/Service/Session.php";        require_once "Alfresco/Service/SpacesStore.php";        require_once "Alfresco/Service/NamedValues.php";            require_once "Alfresco/Service/Administration.php";    // Specify the connection details    $repositoryUrl = "http://localhost:8080/alfresco/api";    $userName = "admin";    $password = "admin";    // Authenticate the user and create a session    $repository = new Repository($repositoryUrl);    $ticket = $repository->authenticate($userName, $password);    $session = $repository->createSession($ticket);    // Create a reference to the 'SpacesStore'    $spacesStore = new SpacesStore($session);        $administration = new Administration($repository,$spacesStore,$session);        $NamedValues = new NamedValues($session);        $NamedValues->cm_firstName = "FIRSTNAME";        $NamedValues->cm_lastName = "LASTNAME";        $NamedValues->cm_email = "EMAIL@EMAIL.COM";            $userDetails = array("userName"=>"USERNAME",                         "password"=>"PASSWORD",                         "properties"=>$NamedValues->__toArray());                                  print_r($administration->createUsers($userDetails));?>

Hi Dominik,
I just installed the ifresco client with php 5.4.3 (using wamp server on my laptop). When I have logged into the client I got a lot of PHP Strict standard messages, which I cann't get rid of. They are all printed out on the screen … and, yes, I have set the responsible php.ini parameter error_reporting = E_ALL & ~E_NOTICE & ~E_STRICT … but the problem is still there. Any ideas?
Additional remark: the document loading takes lot of time, so that ifresco interupts the loding process for prompting me "should I continue? Yes / No". Any idea to this issue as well?
Thanks a lot, Ralf