You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@openmeetings.apache.org by ba...@aim.com on 2013/06/01 20:54:22 UTC

Not getting expected result from Calendar Web Service getAppointmentsByRange

I am  getting familiar with using  calendarService  method  getAppointmentsByRange  which I have not used before.

I was  expecting a  list of the  appointment  that occur during the  period I selected, i.e. all of 2013.

All but one of the appointments is in the past and one is tommorrow.   Here is the code I am using followed by the results.

The username is one that is configured as an administrator. 


//<?php
   
 $clientUserService  = new soapClient("http://...com:5080/openmeetings/services/UserService?wsdl");
 $clientCalendarService = new  soapClient("http://...com:5080/openmeetings/services/CalendarService?wsdl");
 $result = $clientUserService->getSession();
 
 $SID = $result->return->session_id;
 
 $param = array('SID' => $SID, 'username' => "...", 'userpass' => "...");
 $result = $clientUserService->loginUser($param);
 $returnCode = $result->return;
 if ($returnCode < 0) {
    $param = array('SID' => $SID, 'errorid' => $returnCode, 'language_id' => 1);
    $result = $clientUserService->getErrorByCode($param);
    print($result->return->errortype.": ".$result->return->errmessage); 
    exit;
}
echo  $SID;
$start =  date_create('00:00:00 2013-01-01', timezone_open('America/New_York')); // By the way using date followed by time gives same results 
$end   =  date_create('23:59:00 2013-12-31', timezone_open('America/New_York'));
 

$param = array(
    'SID'          => $SID,
    'starttime'    =>  $start,
    'endtime'      =>  $end 
 );
print('<pre>');
print ('$param is: ');
print_r($param);
print ('</pre>'); 
 try
 {
 $result = $clientCalendarService->getAppointmentByRange($param);
 }
 catch (\Exception $e) {
  echo $e;
     
}
print('<pre>');
print ('result from $clientCalendarService->getAppointmentByRange($param) is ');
var_dump($result);
print ('</pre>');
   
$returnCode = $result->return;
 if ($returnCode < 0) {
    $param = array('SID' => $SID, 'errorid' => $returnCode, 'language_id' => 1);
    $result = $clientUserService->getErrorByCode($param);
    print($result->return->errortype.": ".$result->return->errmessage);
    exit;
}  
 
?>
------------------------------------------Results after execution of the web service------------------------------------
$param is: Array
(
    [SID] => 0e161afb670083e00cfff4d54e0cbffc
    [starttime] => DateTime Object
        (
            [date] => 2013-01-01 00:00:00
            [timezone_type] => 3
            [timezone] => America/New_York
        )
    [endtime] => DateTime Object
        (
            [date] => 2013-12-31 23:59:00
            [timezone_type] => 3
            [timezone] => America/New_York
        )
)
result from $clientCalendarService->getAppointmentByRange($param) is object(stdClass)#3 (1) {
  ["return"]=>
  NULL
}



Re: Not getting expected result from Calendar Web Service getAppointmentsByRange

Posted by Maxim Solodovnik <so...@gmail.com>.
AFAIR OM adds 1 day to the end time, and subtracts one day from the
beginning not to loose anything.


On Sun, Jun 2, 2013 at 1:54 AM, <ba...@aim.com> wrote:

> I am  getting familiar with using  calendarService  method
> getAppointmentsByRange  which I have not used before.
>  I was  expecting a  list of the  appointment  that occur during the
> period I selected, i.e. all of 2013.
>
> All but one of the appointments is in the past and one is tommorrow.
> Here is the code I am using followed by the results.
>  The username is one that is configured as an administrator.
>
> //<?php
>
>  $clientUserService  = new soapClient("
> http://...com:5080/openmeetings/services/UserService?wsdl");
>  $clientCalendarService = new  soapClient("
> http://...com:5080/openmeetings/services/CalendarService?wsdl");
>  $result = $clientUserService->getSession();
>
>  $SID = $result->return->session_id;
>
>  $param = array('SID' => $SID, 'username' => "...", 'userpass' => "...");
>  $result = $clientUserService->loginUser($param);
>  $returnCode = $result->return;
>  if ($returnCode < 0) {
>     $param = array('SID' => $SID, 'errorid' => $returnCode, 'language_id'
> => 1);
>     $result = $clientUserService->getErrorByCode($param);
>     print($result->return->errortype.": ".$result->return->errmessage);
>     exit;
> }
> echo  $SID;
> $start =  date_create('00:00:00 2013-01-01',
> timezone_open('America/New_York')); // By the way using date followed
> by time gives same results
> $end   =  date_create('23:59:00 2013-12-31',
> timezone_open('America/New_York'));
>
>
> $param = array(
>     'SID'          => $SID,
>     'starttime'    =>  $start,
>     'endtime'      =>  $end
>  );
> print('<pre>');
> print ('$param is: ');
> print_r($param);
> print ('</pre>');
>  try
>  {
>  $result = $clientCalendarService->getAppointmentByRange($param);
>  }
>  catch (\Exception $e) {
>   echo $e;
>
> }
> print('<pre>');
> print ('result from $clientCalendarService->getAppointmentByRange($param)
> is ');
> var_dump($result);
> print ('</pre>');
>
> $returnCode = $result->return;
>  if ($returnCode < 0) {
>     $param = array('SID' => $SID, 'errorid' => $returnCode, 'language_id'
> => 1);
>     $result = $clientUserService->getErrorByCode($param);
>     print($result->return->errortype.": ".$result->return->errmessage);
>     exit;
> }
>
> ?>
> ------------------------------------------Results after execution of the
> web service------------------------------------
> $param is: Array
> (
>     [SID] => 0e161afb670083e00cfff4d54e0cbffc
>     [starttime] => DateTime Object
>         (
>             [date] => 2013-01-01 00:00:00
>             [timezone_type] => 3
>             [timezone] => America/New_York
>         )
>     [endtime] => DateTime Object
>         (
>             [date] => 2013-12-31 23:59:00
>             [timezone_type] => 3
>             [timezone] => America/New_York
>         )
> )
> result from $clientCalendarService->getAppointmentByRange($param) is
> object(stdClass)#3 (1) {
>   ["return"]=>
>   NULL
> }
>
>



-- 
WBR
Maxim aka solomax