網上能找到一些用Java, .Net 或者C#寫的調用OBIEE WebService的例子,沒找到用PHP寫的。但是官方文檔有寫到:Oracle BI Web Services is an application programming interface (API) that implements SOAP. 是以肯定也可以用PHP來調用。本文就是用PHP來調用的一個簡單的例子。
<?php
$client = new SoapClient('http://url:port/analytics/saw.dll?WSDL');
$option = array(
'name'=>"UserName",
'password'=>"Password");
$session = $client->__call('logon',array($option));
$session_id = $session->sessionID;
$sql = 'OBIEE Answer Logic SQL';
$executionOptions = array(
'async'=> false,
'maxRowsPerPage'=> 100,
'refresh'=> true,
'presentationInfo'=> true,
'type'=> 'foo2');
$para = array(
'sql'=> $sql,
'outputFormat'=> "SAWRowsetSchemaAndData",
'executionOptions'=> $executionOptions,
'sessionID'=> $session_id
);
$result = $client->__call('executeSQLQuery',array($para));
$rowset = $result->return->rowset;
$client->__call('logoff',array($session_id));
?>