Adding the client php to required
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/2c6ccedd Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/2c6ccedd Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/2c6ccedd Branch: refs/heads/master Commit: 2c6ccedd706eaab7a8cf2b8a54a265bfeb34064e Parents: 050fd1d Author: Suresh Marru <[email protected]> Authored: Thu May 22 14:32:18 2014 -0400 Committer: Suresh Marru <[email protected]> Committed: Thu May 22 14:32:18 2014 -0400 ---------------------------------------------------------------------- client-samples/GetAPIVersion.php | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata/blob/2c6ccedd/client-samples/GetAPIVersion.php ---------------------------------------------------------------------- diff --git a/client-samples/GetAPIVersion.php b/client-samples/GetAPIVersion.php index 1a53c71..f5dd8f9 100644 --- a/client-samples/GetAPIVersion.php +++ b/client-samples/GetAPIVersion.php @@ -5,12 +5,14 @@ require_once 'samples_config.php'; $GLOBALS['THRIFT_ROOT'] = '../lib/Thrift/'; require_once $GLOBALS['THRIFT_ROOT'] . 'Transport/TTransport.php'; +require_once $GLOBALS['THRIFT_ROOT'] . 'Transport/TBufferedTransport.php'; require_once $GLOBALS['THRIFT_ROOT'] . 'Transport/TSocket.php'; require_once $GLOBALS['THRIFT_ROOT'] . 'Protocol/TProtocol.php'; require_once $GLOBALS['THRIFT_ROOT'] . 'Protocol/TBinaryProtocol.php'; require_once $GLOBALS['THRIFT_ROOT'] . 'Exception/TException.php'; require_once $GLOBALS['THRIFT_ROOT'] . 'Exception/TApplicationException.php'; require_once $GLOBALS['THRIFT_ROOT'] . 'Exception/TProtocolException.php'; +require_once $GLOBALS['THRIFT_ROOT'] . 'Exception/TTransportException.php'; require_once $GLOBALS['THRIFT_ROOT'] . 'Base/TBase.php'; require_once $GLOBALS['THRIFT_ROOT'] . 'Type/TType.php'; require_once $GLOBALS['THRIFT_ROOT'] . 'Type/TMessageType.php'; @@ -20,9 +22,12 @@ require_once $GLOBALS['THRIFT_ROOT'] . 'StringFunc/Core.php'; $GLOBALS['AIRAVATA_ROOT'] = '../lib/Airavata/'; require_once $GLOBALS['AIRAVATA_ROOT'] . 'API/Airavata.php'; +require_once $GLOBALS['AIRAVATA_ROOT'] . 'Model/Workspace/Types.php'; require_once $GLOBALS['AIRAVATA_ROOT'] . 'Model/Workspace/Experiment/Types.php'; require_once $GLOBALS['AIRAVATA_ROOT'] . 'API/Error/Types.php'; +require_once '../lib/AiravataClientFactory.php'; + use Airavata\API\Error\AiravataClientException; use Airavata\API\Error\AiravataSystemException; use Airavata\API\Error\InvalidRequestException; @@ -35,22 +40,29 @@ use Airavata\API\AiravataClient; /* this is the same as the factory */ $transport = new TSocket(AIRAVATA_SERVER, AIRAVATA_PORT); $transport->setRecvTimeout(AIRAVATA_TIMEOUT); + +$protocol = new TBinaryProtocol($transport); $transport->open(); $airavataclient = new AiravataClient($protocol); - try { $version = $airavataclient->GetAPIVersion(); } -catch (TException $texp) +catch (InvalidRequestException $ire) { - print 'Exception: ' . $texp->getMessage()."\n"; + print 'InvalidRequestException: ' . $ire->getMessage()."\n"; +} +catch (AiravataClientException $ace) +{ + print 'Airavata System Exception: ' . $ace->getMessage()."\n"; +} +catch (AiravataSystemException $ase) +{ + print 'Airavata System Exception: ' . $ase->getMessage()."\n"; } - -echo 'Airavata server version is ' . $version; - +echo 'Airavata API Version is ' . $version; $transport->close();
