1, "cache_wsdl" => WSDL_CACHE_DISK));
// Login
$params = array(
"userName"=>"xxx",
"password"=>"xxx",
"options"=>array(
"ApplicationId"=>"app name",
"PartnerId"=>"partner id"
)
);
$response = $client->Login($params);
$responseJSON = json_encode($response);
echo $responseJSON . "
";
// Set SessionId
$sessionId = $response->LoginResult->SessionId;
$header = new SoapHeader('http://clarizen.com/api', 'Session', array("ID"=>$sessionId));
$client->__setSoapHeaders($header);
// Get Timesheet
$LeftStartDate = array (
"FieldName" => "StartDate");
$MinDate = "2012-01-15";
$RightStartDate = array (
"Value" => new SoapVar ($MinDate, XSD_DATETIME, "dateTime", "http://www.w3.org/2001/XMLSchema"));
$StartDateCondition = array (
"LeftExpression" => new SoapVar ($LeftStartDate,SOAP_ENC_OBJECT, "FieldExpression", "http://clarizen.com/api/queries"),
"Operator" => "GreaterThan",
"RightExpression" => new SoapVar ($RightStartDate,SOAP_ENC_OBJECT, "ConstantExpression","http://clarizen.com/api/queries"));
$LeftEndDate = array (
"FieldName" => "StartDate");
$MaxDate = "2013-02-15";
$RightEndDate = array (
"Value" => new SoapVar ($MaxDate, XSD_DATETIME, "dateTime", "http://www.w3.org/2001/XMLSchema"));
$EndDateCondition = array (
"LeftExpression" => new SoapVar ($LeftEndDate,SOAP_ENC_OBJECT, "FieldExpression", "http://clarizen.com/api/queries"),
"Operator" => "LessThan",
"RightExpression" => new SoapVar ($RightEndDate,SOAP_ENC_OBJECT, "ConstantExpression","http://clarizen.com/api/queries"));
$AndCondition = array (
"Conditions" => array ( new SoapVar ( $StartDateCondition,SOAP_ENC_OBJECT, "Compare", "http://clarizen.com/api/queries" ),
new SoapVar ( $EndDateCondition,SOAP_ENC_OBJECT, "Compare", "http://clarizen.com/api/queries" )
));
$params = array(
"Fields" => array("Name", "StartDate"),
"TypeName" => "Project",
"Orders" => array(
array(
"FieldName" => "Name",
"Order" => "Ascending"
)
),
"Where" => new SoapVar ($AndCondition, SOAP_ENC_OBJECT, "And", "http://clarizen.com/api/queries"),
"Paging" => array(
"PageNumber" => 0,
"PageSize" => 1000
)
);
$request[] = new SoapVar($params, SOAP_ENC_OBJECT, "EntityQuery", "http://clarizen.com/api/queries");
$executeResponse = $client->Execute(array("request"=>$request));
$responseJSON = json_encode($executeResponse);
echo $responseJSON . "
";
?>