Example #1
0
$project_id = 0;
//not needed
$tracker_id = 52;
$offset = 0;
$limit = 100;
$criteria = array(array('field_name' => 'open_date', 'value' => array('dateAdvanced' => array('from_date' => mktime(0, 0, 0, 9, 4, 2014), 'to_date' => mktime(1, 0, 0, 9, 5, 2014)))));
$soap_options = array('cache_wsdl' => WSDL_CACHE_NONE, 'exceptions' => 1, 'trace' => 1);
$host_login = $serverURL . '/soap/?wsdl';
$host_tracker = $serverURL . '/plugins/tracker/soap/?wsdl';
// Establish connection to the server
$client_login = new SoapClient($host_login, $soap_options);
$session_hash = $client_login->login($login, $password)->session_hash;
try {
    // Connecting to the soap's tracker api
    $client_tracker = new SoapClient($host_tracker, $soap_options);
    $response = $client_tracker->getArtifacts($session_hash, $project_id, $tracker_id, $criteria, $offset, $limit);
    var_dump($response);
    echo "total_artifacts_number: " . $response->total_artifacts_number . "\n";
    foreach ($response->artifacts as $artifact) {
        $message = "#" . $artifact->artifact_id;
        foreach ($artifact->value as $value) {
            if ((string) $value->field_name == "description") {
                $message .= " " . (string) $value->field_value;
            }
            if ((string) $value->field_name == "remaining_effort") {
                $message .= " (" . (string) $value->field_label . ": " . (string) $value->field_value->value . ")";
            }
        }
        echo $message . "\n";
    }
} catch (Exception $e) {
Example #2
0
<?php

///////////////////////////////////////
// Configuration part
$test_server = 'http://' . $_SERVER['SERVER_ADDR'] . ':' . $_SERVER['SERVER_PORT'];
$login = '******';
$password = '******';
$group_id = 101;
$tracker_id = 102;
///////////////////////////////////////
try {
    $client_tracker_v5 = new SoapClient($test_server . '/plugins/tracker/soap/wsdl?wsdl', array('trace' => 1, 'exceptions' => 0, 'soap_version' => SOAP_1_1, 'cache_wsdl' => 0));
    $client = new SoapClient($test_server . '/soap/codendi.wsdl.php?wsdl', array('trace' => 1, 'exceptions' => 0, 'soap_version' => SOAP_1_1, 'cache_wsdl' => 0));
    $session = $client->login($login, $password);
    $session_hash = $session->session_hash;
    $user_id = $session->user_id;
    echo 'User ' . $login . ' (user_id=' . $user_id . ') is logged with session hash = ' . $session_hash . '<br>';
    echo '<h1>Get artifacts of tracker ' . $tracker_id . ' in project ' . $group_id . '</h1>';
    echo '<h3>function getArtifacts</h3>';
    $artifacts = $client_tracker_v5->getArtifacts($session_hash, $group_id, $tracker_id);
    var_dump($artifacts);
} catch (SoapFault $fault) {
    var_dump($fault);
}